Auto status change to "Under Review"
Show More
@@ -1,226 +1,217 b'' | |||||
1 | <%namespace name="dt" file="/data_table/_dt_elements.mako"/> |
|
1 | <%namespace name="dt" file="/data_table/_dt_elements.mako"/> | |
2 |
|
2 | |||
3 | <%def name="form_item(position=None, title=None, redirect_url=None, repo=None, repo_group=None)"> |
|
3 | <%def name="form_item(position=None, title=None, redirect_url=None, repo=None, repo_group=None)"> | |
4 | <tr> |
|
4 | <tr> | |
5 | <td class="td-align-top" > |
|
5 | <td class="td-align-top" > | |
6 | <div class="label"> |
|
6 | <div class="label"> | |
7 | <label for="position">${_('Position')}:</label> |
|
7 | <label for="position">${_('Position')}:</label> | |
8 | </div> |
|
8 | </div> | |
9 | <div class="input"> |
|
9 | <div class="input"> | |
10 | <input type="text" name="position" value="${position}" style="width: 40px"/> |
|
10 | <input type="text" name="position" value="${position}" style="width: 40px"/> | |
11 | ${h.hidden('cur_position', position)} |
|
11 | ${h.hidden('cur_position', position)} | |
12 | </div> |
|
12 | </div> | |
13 | </td> |
|
13 | </td> | |
14 |
|
14 | |||
15 | <td> |
|
15 | <td> | |
16 | <div class="label"> |
|
16 | <div class="label"> | |
17 | <label for="title">${_('Bookmark title (max 30 characters, optional)')}:</label> |
|
17 | <label for="title">${_('Bookmark title (max 30 characters, optional)')}:</label> | |
18 | </div> |
|
18 | </div> | |
19 | <div class="input"> |
|
19 | <div class="input"> | |
20 | <input type="text" name="title" value="${title}" style="width: 300px" maxlength="30"/> |
|
20 | <input type="text" name="title" value="${title}" style="width: 300px" maxlength="30"/> | |
21 |
|
21 | |||
22 | <div class="field pull-right"> |
|
22 | <div class="field pull-right"> | |
23 | <div> |
|
23 | <div> | |
24 | <label class="btn-link btn-danger">${_('Clear')}:</label> |
|
24 | <label class="btn-link btn-danger">${_('Clear')}:</label> | |
25 | ${h.checkbox('remove', value=True)} |
|
25 | ${h.checkbox('remove', value=True)} | |
26 | </div> |
|
26 | </div> | |
27 | </div> |
|
27 | </div> | |
28 | </div> |
|
28 | </div> | |
29 | <p class="help-block help-block-inline" > |
|
|||
30 | ${_('Server URL is available as ${server_url} variable. E.g. Redirect url: ${server_url}/_admin/exception_tracker')} |
|
|||
31 | </p> |
|
|||
32 |
|
29 | |||
33 | <div class="label"> |
|
30 | <div class="label" style="margin-top:10px"> | |
34 | <label for="redirect_url">${_('Redirect URL')}:</label> |
|
31 | <label for="redirect_url">${_('Redirect URL')}:</label> | |
35 | </div> |
|
32 | </div> | |
36 | <div class="input"> |
|
33 | <div class="input"> | |
37 | <input type="text" name="redirect_url" value="${redirect_url}" style="width: 600px"/> |
|
34 | <input type="text" name="redirect_url" value="${redirect_url}" style="width: 600px"/> | |
38 | </div> |
|
35 | </div> | |
39 |
|
36 | <p class="help-block help-block-inline"> | ||
|
37 | ${_('Server URL is available as ${server_url} variable. E.g. Redirect url: ${server_url}/_admin/exception_tracker')} | |||
|
38 | </p> | |||
40 |
|
39 | |||
41 | <div class="select"> |
|
40 | <div class="select" style="margin-top:5px"> | |
|
41 | <div class="label"> | |||
|
42 | <label for="redirect_url">${_('Templates')}:</label> | |||
|
43 | </div> | |||
|
44 | ||||
42 |
|
|
45 | % if repo: | |
43 | <div class="label"> |
|
|||
44 | <label for="redirect_url">${_('Repository template')}:</label> |
|
|||
45 | </div> |
|
|||
46 | ${dt.repo_name(name=repo.repo_name, rtype=repo.repo_type,rstate=None,private=None,archived=False,fork_of=False)} |
|
46 | ${dt.repo_name(name=repo.repo_name, rtype=repo.repo_type,rstate=None,private=None,archived=False,fork_of=False)} | |
47 | ${h.hidden('bookmark_repo', repo.repo_id)} |
|
47 | ${h.hidden('bookmark_repo', repo.repo_id)} | |
48 | % elif repo_group: |
|
48 | % elif repo_group: | |
49 | <div class="label"> |
|
|||
50 | <label for="redirect_url">${_('Repository group template')}:</label> |
|
|||
51 | </div> |
|
|||
52 | ${dt.repo_group_name(repo_group.group_name)} |
|
49 | ${dt.repo_group_name(repo_group.group_name)} | |
53 | ${h.hidden('bookmark_repo_group', repo_group.group_id)} |
|
50 | ${h.hidden('bookmark_repo_group', repo_group.group_id)} | |
54 | % else: |
|
51 | % else: | |
55 |
<div |
|
52 | <div> | |
56 | <label for="redirect_url">${_('Template Repository or Repository group')}:</label> |
|
53 | ${h.hidden('bookmark_repo', class_='bookmark_repo')} | |
|
54 | <p class="help-block help-block-inline">${_('Available as ${repo_url} e.g. Redirect url: ${repo_url}/changelog')}</p> | |||
57 | </div> |
|
55 | </div> | |
58 | ${h.hidden('bookmark_repo', class_='bookmark_repo')} |
|
56 | <div style="margin-top:5px"> | |
59 | <span style="padding-right:15px">OR</span> |
|
|||
60 | ${h.hidden('bookmark_repo_group', class_='bookmark_repo_group')} |
|
57 | ${h.hidden('bookmark_repo_group', class_='bookmark_repo_group')} | |
|
58 | <p class="help-block help-block-inline">${_('Available as ${repo_group_url} e.g. Redirect url: ${repo_group_url}')}</p> | |||
|
59 | </div> | |||
|
60 | ||||
61 | % endif |
|
61 | % endif | |
62 | </div> |
|
62 | </div> | |
63 |
|
63 | |||
64 | <p class="help-block help-block-inline" > |
|
|||
65 | % if repo: |
|
|||
66 | ${_('Available as ${repo_url} e.g. Redirect url: ${repo_url}/changelog')} |
|
|||
67 | % elif repo_group: |
|
|||
68 | ${_('Available as ${repo_group_url} e.g. Redirect url: ${repo_group_url}')} |
|
|||
69 | % else: |
|
|||
70 | ${_('Available as full url variables in redirect url. i.e: ${repo_url}, ${repo_group_url}.')} |
|
|||
71 | % endif |
|
|||
72 | </p> |
|
|||
73 | </td> |
|
64 | </td> | |
74 |
|
65 | |||
75 | </tr> |
|
66 | </tr> | |
76 | </%def> |
|
67 | </%def> | |
77 |
|
68 | |||
78 | <div class="panel panel-default"> |
|
69 | <div class="panel panel-default"> | |
79 | <div class="panel-heading"> |
|
70 | <div class="panel-heading"> | |
80 | <h3 class="panel-title">${_('Your Bookmarks')}</h3> |
|
71 | <h3 class="panel-title">${_('Your Bookmarks')}</h3> | |
81 | </div> |
|
72 | </div> | |
82 |
|
73 | |||
83 | <div class="panel-body"> |
|
74 | <div class="panel-body"> | |
84 | <p> |
|
75 | <p> | |
85 | ${_('Store upto 10 bookmark links to favorite repositories, external issue tracker or CI server. ')} |
|
76 | ${_('Store upto 10 bookmark links to favorite repositories, external issue tracker or CI server. ')} | |
86 | <br/> |
|
77 | <br/> | |
87 | ${_('Bookmarks are accessible from your username dropdown or by keyboard shortcut `g 0-9`')} |
|
78 | ${_('Bookmarks are accessible from your username dropdown or by keyboard shortcut `g 0-9`')} | |
88 | </p> |
|
79 | </p> | |
89 |
|
80 | |||
90 | ${h.secure_form(h.route_path('my_account_bookmarks_update'), request=request)} |
|
81 | ${h.secure_form(h.route_path('my_account_bookmarks_update'), request=request)} | |
91 | <div class="form-vertical"> |
|
82 | <div class="form-vertical"> | |
92 | <table class="rctable"> |
|
83 | <table class="rctable"> | |
93 | ## generate always 10 entries |
|
84 | ## generate always 10 entries | |
94 | <input type="hidden" name="__start__" value="bookmarks:sequence"/> |
|
85 | <input type="hidden" name="__start__" value="bookmarks:sequence"/> | |
95 | % for item in (c.bookmark_items + [None for i in range(10)])[:10]: |
|
86 | % for item in (c.bookmark_items + [None for i in range(10)])[:10]: | |
96 | <input type="hidden" name="__start__" value="bookmark:mapping"/> |
|
87 | <input type="hidden" name="__start__" value="bookmark:mapping"/> | |
97 | % if item is None: |
|
88 | % if item is None: | |
98 | ## empty placehodlder |
|
89 | ## empty placehodlder | |
99 | ${form_item()} |
|
90 | ${form_item()} | |
100 | % else: |
|
91 | % else: | |
101 | ## actual entry |
|
92 | ## actual entry | |
102 | ${form_item(position=item.position, title=item.title, redirect_url=item.redirect_url, repo=item.repository, repo_group=item.repository_group)} |
|
93 | ${form_item(position=item.position, title=item.title, redirect_url=item.redirect_url, repo=item.repository, repo_group=item.repository_group)} | |
103 | % endif |
|
94 | % endif | |
104 | <input type="hidden" name="__end__" value="bookmark:mapping"/> |
|
95 | <input type="hidden" name="__end__" value="bookmark:mapping"/> | |
105 | % endfor |
|
96 | % endfor | |
106 | <input type="hidden" name="__end__" value="bookmarks:sequence"/> |
|
97 | <input type="hidden" name="__end__" value="bookmarks:sequence"/> | |
107 | </table> |
|
98 | </table> | |
108 | <div class="buttons"> |
|
99 | <div class="buttons"> | |
109 | ${h.submit('save',_('Save'),class_="btn")} |
|
100 | ${h.submit('save',_('Save'),class_="btn")} | |
110 | </div> |
|
101 | </div> | |
111 | </div> |
|
102 | </div> | |
112 | ${h.end_form()} |
|
103 | ${h.end_form()} | |
113 | </div> |
|
104 | </div> | |
114 | </div> |
|
105 | </div> | |
115 |
|
106 | |||
116 | <script> |
|
107 | <script> | |
117 | $(document).ready(function(){ |
|
108 | $(document).ready(function(){ | |
118 |
|
109 | |||
119 |
|
110 | |||
120 | var repoFilter = function (data) { |
|
111 | var repoFilter = function (data) { | |
121 | var results = []; |
|
112 | var results = []; | |
122 |
|
113 | |||
123 | if (!data.results[0]) { |
|
114 | if (!data.results[0]) { | |
124 | return data |
|
115 | return data | |
125 | } |
|
116 | } | |
126 |
|
117 | |||
127 | $.each(data.results[0].children, function () { |
|
118 | $.each(data.results[0].children, function () { | |
128 | // replace name to ID for submision |
|
119 | // replace name to ID for submision | |
129 | this.id = this.repo_id; |
|
120 | this.id = this.repo_id; | |
130 | results.push(this); |
|
121 | results.push(this); | |
131 | }); |
|
122 | }); | |
132 |
|
123 | |||
133 | data.results[0].children = results; |
|
124 | data.results[0].children = results; | |
134 | return data; |
|
125 | return data; | |
135 | }; |
|
126 | }; | |
136 |
|
127 | |||
137 |
|
128 | |||
138 | $(".bookmark_repo").select2({ |
|
129 | $(".bookmark_repo").select2({ | |
139 | cachedDataSource: {}, |
|
130 | cachedDataSource: {}, | |
140 | minimumInputLength: 2, |
|
131 | minimumInputLength: 2, | |
141 | placeholder: "${_('repository')}", |
|
132 | placeholder: "${_('repository')}", | |
142 | dropdownAutoWidth: true, |
|
133 | dropdownAutoWidth: true, | |
143 | containerCssClass: "drop-menu", |
|
134 | containerCssClass: "drop-menu", | |
144 | dropdownCssClass: "drop-menu-dropdown", |
|
135 | dropdownCssClass: "drop-menu-dropdown", | |
145 | formatResult: formatRepoResult, |
|
136 | formatResult: formatRepoResult, | |
146 | query: $.debounce(250, function (query) { |
|
137 | query: $.debounce(250, function (query) { | |
147 | self = this; |
|
138 | self = this; | |
148 | var cacheKey = query.term; |
|
139 | var cacheKey = query.term; | |
149 | var cachedData = self.cachedDataSource[cacheKey]; |
|
140 | var cachedData = self.cachedDataSource[cacheKey]; | |
150 |
|
141 | |||
151 | if (cachedData) { |
|
142 | if (cachedData) { | |
152 | query.callback({results: cachedData.results}); |
|
143 | query.callback({results: cachedData.results}); | |
153 | } else { |
|
144 | } else { | |
154 | $.ajax({ |
|
145 | $.ajax({ | |
155 | url: pyroutes.url('repo_list_data'), |
|
146 | url: pyroutes.url('repo_list_data'), | |
156 | data: {'query': query.term}, |
|
147 | data: {'query': query.term}, | |
157 | dataType: 'json', |
|
148 | dataType: 'json', | |
158 | type: 'GET', |
|
149 | type: 'GET', | |
159 | success: function (data) { |
|
150 | success: function (data) { | |
160 | data = repoFilter(data); |
|
151 | data = repoFilter(data); | |
161 | self.cachedDataSource[cacheKey] = data; |
|
152 | self.cachedDataSource[cacheKey] = data; | |
162 | query.callback({results: data.results}); |
|
153 | query.callback({results: data.results}); | |
163 | }, |
|
154 | }, | |
164 | error: function (data, textStatus, errorThrown) { |
|
155 | error: function (data, textStatus, errorThrown) { | |
165 | alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText)); |
|
156 | alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText)); | |
166 | } |
|
157 | } | |
167 | }) |
|
158 | }) | |
168 | } |
|
159 | } | |
169 | }), |
|
160 | }), | |
170 | }); |
|
161 | }); | |
171 |
|
162 | |||
172 | var repoGroupFilter = function (data) { |
|
163 | var repoGroupFilter = function (data) { | |
173 | var results = []; |
|
164 | var results = []; | |
174 |
|
165 | |||
175 | if (!data.results[0]) { |
|
166 | if (!data.results[0]) { | |
176 | return data |
|
167 | return data | |
177 | } |
|
168 | } | |
178 |
|
169 | |||
179 | $.each(data.results[0].children, function () { |
|
170 | $.each(data.results[0].children, function () { | |
180 | // replace name to ID for submision |
|
171 | // replace name to ID for submision | |
181 | this.id = this.repo_group_id; |
|
172 | this.id = this.repo_group_id; | |
182 | results.push(this); |
|
173 | results.push(this); | |
183 | }); |
|
174 | }); | |
184 |
|
175 | |||
185 | data.results[0].children = results; |
|
176 | data.results[0].children = results; | |
186 | return data; |
|
177 | return data; | |
187 | }; |
|
178 | }; | |
188 |
|
179 | |||
189 | $(".bookmark_repo_group").select2({ |
|
180 | $(".bookmark_repo_group").select2({ | |
190 | cachedDataSource: {}, |
|
181 | cachedDataSource: {}, | |
191 | minimumInputLength: 2, |
|
182 | minimumInputLength: 2, | |
192 | placeholder: "${_('repository group')}", |
|
183 | placeholder: "${_('repository group')}", | |
193 | dropdownAutoWidth: true, |
|
184 | dropdownAutoWidth: true, | |
194 | containerCssClass: "drop-menu", |
|
185 | containerCssClass: "drop-menu", | |
195 | dropdownCssClass: "drop-menu-dropdown", |
|
186 | dropdownCssClass: "drop-menu-dropdown", | |
196 | formatResult: formatRepoGroupResult, |
|
187 | formatResult: formatRepoGroupResult, | |
197 | query: $.debounce(250, function (query) { |
|
188 | query: $.debounce(250, function (query) { | |
198 | self = this; |
|
189 | self = this; | |
199 | var cacheKey = query.term; |
|
190 | var cacheKey = query.term; | |
200 | var cachedData = self.cachedDataSource[cacheKey]; |
|
191 | var cachedData = self.cachedDataSource[cacheKey]; | |
201 |
|
192 | |||
202 | if (cachedData) { |
|
193 | if (cachedData) { | |
203 | query.callback({results: cachedData.results}); |
|
194 | query.callback({results: cachedData.results}); | |
204 | } else { |
|
195 | } else { | |
205 | $.ajax({ |
|
196 | $.ajax({ | |
206 | url: pyroutes.url('repo_group_list_data'), |
|
197 | url: pyroutes.url('repo_group_list_data'), | |
207 | data: {'query': query.term}, |
|
198 | data: {'query': query.term}, | |
208 | dataType: 'json', |
|
199 | dataType: 'json', | |
209 | type: 'GET', |
|
200 | type: 'GET', | |
210 | success: function (data) { |
|
201 | success: function (data) { | |
211 | data = repoGroupFilter(data); |
|
202 | data = repoGroupFilter(data); | |
212 | self.cachedDataSource[cacheKey] = data; |
|
203 | self.cachedDataSource[cacheKey] = data; | |
213 | query.callback({results: data.results}); |
|
204 | query.callback({results: data.results}); | |
214 | }, |
|
205 | }, | |
215 | error: function (data, textStatus, errorThrown) { |
|
206 | error: function (data, textStatus, errorThrown) { | |
216 | alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText)); |
|
207 | alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText)); | |
217 | } |
|
208 | } | |
218 | }) |
|
209 | }) | |
219 | } |
|
210 | } | |
220 | }) |
|
211 | }) | |
221 | }); |
|
212 | }); | |
222 |
|
213 | |||
223 |
|
214 | |||
224 | }); |
|
215 | }); | |
225 |
|
216 | |||
226 | </script> |
|
217 | </script> |
General Comments 1
You need to be logged in to leave comments.
Login now