Show More
@@ -1,92 +1,92 b'' | |||
|
1 | 1 | <%def name="render_line(line_num, tokens, |
|
2 | 2 | annotation=None, |
|
3 | 3 | bgcolor=None, show_annotation=None)"> |
|
4 | 4 | <% |
|
5 | 5 | from rhodecode.lib.codeblocks import render_tokenstream |
|
6 | 6 | # avoid module lookup for performance |
|
7 | 7 | html_escape = h.html_escape |
|
8 | 8 | tooltip = h.tooltip |
|
9 | 9 | %> |
|
10 | 10 | <tr class="cb-line cb-line-fresh ${'cb-annotate' if show_annotation else ''}" |
|
11 | 11 | %if annotation: |
|
12 |
data-revision="${annotation. |
|
|
12 | data-revision="${annotation.idx}" | |
|
13 | 13 | %endif |
|
14 | 14 | > |
|
15 | 15 | |
|
16 | 16 | % if annotation: |
|
17 | 17 | % if show_annotation: |
|
18 | 18 | <td class="cb-annotate-info tooltip" |
|
19 | 19 | title="Author: ${tooltip(annotation.author) | entity}<br>Date: ${annotation.date}<br>Message: ${annotation.message | entity}" |
|
20 | 20 | > |
|
21 | 21 | ${h.gravatar_with_user(request, annotation.author, 16) | n} |
|
22 | 22 | <div class="cb-annotate-message truncate-wrap">${h.chop_at_smart(annotation.message, '\n', suffix_if_chopped='...')}</div> |
|
23 | 23 | </td> |
|
24 | 24 | <td class="cb-annotate-message-spacer"> |
|
25 | 25 | <a class="tooltip" href="#show-previous-annotation" onclick="return annotationController.previousAnnotation('${annotation.raw_id}', '${c.f_path}', ${line_num})" title="${tooltip(_('view annotation from before this change'))}"> |
|
26 | 26 | <i class="icon-left"></i> |
|
27 | 27 | </a> |
|
28 | 28 | </td> |
|
29 | 29 | <td |
|
30 | 30 | class="cb-annotate-revision" |
|
31 |
data-revision="${annotation. |
|
|
32 |
onclick="$('[data-revision=${annotation. |
|
|
31 | data-revision="${annotation.idx}" | |
|
32 | onclick="$('[data-revision=${annotation.idx}]').toggleClass('cb-line-fresh')" | |
|
33 | 33 | style="background: ${bgcolor}"> |
|
34 | 34 | <a class="cb-annotate" href="${h.route_path('repo_commit',repo_name=c.repo_name,commit_id=annotation.raw_id)}"> |
|
35 |
r${annotation. |
|
|
35 | r${annotation.idx} | |
|
36 | 36 | </a> |
|
37 | 37 | </td> |
|
38 | 38 | % else: |
|
39 | 39 | <td></td> |
|
40 | 40 | <td class="cb-annotate-message-spacer"></td> |
|
41 | 41 | <td |
|
42 | 42 | class="cb-annotate-revision" |
|
43 |
data-revision="${annotation. |
|
|
44 |
onclick="$('[data-revision=${annotation. |
|
|
43 | data-revision="${annotation.idx}" | |
|
44 | onclick="$('[data-revision=${annotation.idx}]').toggleClass('cb-line-fresh')" | |
|
45 | 45 | style="background: ${bgcolor}"> |
|
46 | 46 | </td> |
|
47 | 47 | % endif |
|
48 | 48 | % else: |
|
49 | 49 | <td colspan="3"></td> |
|
50 | 50 | % endif |
|
51 | 51 | |
|
52 | 52 | |
|
53 | 53 | <td class="cb-lineno" id="L${line_num}"> |
|
54 | 54 | <a data-line-no="${line_num}" href="#L${line_num}"></a> |
|
55 | 55 | </td> |
|
56 | 56 | <td class="cb-content cb-content-fresh" |
|
57 | 57 | %if bgcolor: |
|
58 | 58 | style="background: ${bgcolor}" |
|
59 | 59 | %endif |
|
60 | 60 | > |
|
61 | 61 | ## newline at end is necessary for highlight to work when line is empty |
|
62 | 62 | ## and for copy pasting code to work as expected |
|
63 | 63 | <span class="cb-code">${render_tokenstream(tokens)|n}${'\n'}</span> |
|
64 | 64 | </td> |
|
65 | 65 | </tr> |
|
66 | 66 | </%def> |
|
67 | 67 | |
|
68 | 68 | <%def name="render_annotation_lines(annotation, lines, color_hasher)"> |
|
69 | 69 | % for line_num, tokens in lines: |
|
70 | 70 | ${render_line(line_num, tokens, |
|
71 | 71 | bgcolor=color_hasher(annotation and annotation.raw_id or ''), |
|
72 | 72 | annotation=annotation, show_annotation=loop.first |
|
73 | 73 | )} |
|
74 | 74 | % endfor |
|
75 | 75 | <script> |
|
76 | 76 | var AnnotationController = function() { |
|
77 | 77 | var self = this; |
|
78 | 78 | |
|
79 | 79 | this.previousAnnotation = function(commitId, fPath, lineNo) { |
|
80 | 80 | var params = { |
|
81 | 81 | 'repo_name': templateContext.repo_name, |
|
82 | 82 | 'commit_id': commitId, |
|
83 | 83 | 'f_path': fPath, |
|
84 | 84 | 'line_anchor': lineNo |
|
85 | 85 | }; |
|
86 | 86 | window.location = pyroutes.url('repo_files:annotated_previous', params); |
|
87 | 87 | return false; |
|
88 | 88 | }; |
|
89 | 89 | }; |
|
90 | 90 | var annotationController = new AnnotationController(); |
|
91 | 91 | </script> |
|
92 | 92 | </%def> |
@@ -1,333 +1,333 b'' | |||
|
1 | 1 | ## -*- coding: utf-8 -*- |
|
2 | 2 | <%inherit file="/base/base.mako"/> |
|
3 | 3 | <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> |
|
4 | 4 | |
|
5 | 5 | <%def name="title()"> |
|
6 | 6 | %if c.compare_home: |
|
7 | 7 | ${_('%s Compare') % c.repo_name} |
|
8 | 8 | %else: |
|
9 | 9 | ${_('%s Compare') % c.repo_name} - ${'%s@%s' % (c.source_repo.repo_name, c.source_ref)} > ${'%s@%s' % (c.target_repo.repo_name, c.target_ref)} |
|
10 | 10 | %endif |
|
11 | 11 | %if c.rhodecode_name: |
|
12 | 12 | · ${h.branding(c.rhodecode_name)} |
|
13 | 13 | %endif |
|
14 | 14 | </%def> |
|
15 | 15 | |
|
16 | 16 | <%def name="breadcrumbs_links()"> |
|
17 | 17 | ${_ungettext('%s commit','%s commits', len(c.commit_ranges)) % len(c.commit_ranges)} |
|
18 | 18 | </%def> |
|
19 | 19 | |
|
20 | 20 | <%def name="menu_bar_nav()"> |
|
21 | 21 | ${self.menu_items(active='repositories')} |
|
22 | 22 | </%def> |
|
23 | 23 | |
|
24 | 24 | <%def name="menu_bar_subnav()"> |
|
25 | 25 | ${self.repo_menu(active='compare')} |
|
26 | 26 | </%def> |
|
27 | 27 | |
|
28 | 28 | <%def name="main()"> |
|
29 | 29 | <script type="text/javascript"> |
|
30 | 30 | // set fake commitId on this commit-range page |
|
31 | 31 | templateContext.commit_data.commit_id = "${h.EmptyCommit().raw_id}"; |
|
32 | 32 | </script> |
|
33 | 33 | |
|
34 | 34 | <div class="box"> |
|
35 | 35 | <div class="title"> |
|
36 | 36 | ${self.repo_page_title(c.rhodecode_db_repo)} |
|
37 | 37 | </div> |
|
38 | 38 | |
|
39 | 39 | <div class="summary changeset"> |
|
40 | 40 | <div class="summary-detail"> |
|
41 | 41 | <div class="summary-detail-header"> |
|
42 | 42 | <span class="breadcrumbs files_location"> |
|
43 | 43 | <h4> |
|
44 | 44 | ${_('Compare Commits')} |
|
45 | 45 | % if c.file_path: |
|
46 | 46 | ${_('for file')} <a href="#${'a_' + h.FID('',c.file_path)}">${c.file_path}</a> |
|
47 | 47 | % endif |
|
48 | 48 | |
|
49 | 49 | % if c.commit_ranges: |
|
50 | 50 | <code> |
|
51 |
r${c.source_commit. |
|
|
51 | r${c.source_commit.idx}:${h.short_id(c.source_commit.raw_id)}...r${c.target_commit.idx}:${h.short_id(c.target_commit.raw_id)} | |
|
52 | 52 | </code> |
|
53 | 53 | % endif |
|
54 | 54 | </h4> |
|
55 | 55 | </span> |
|
56 | 56 | </div> |
|
57 | 57 | |
|
58 | 58 | <div class="fieldset"> |
|
59 | 59 | <div class="left-label"> |
|
60 | 60 | ${_('Target')}: |
|
61 | 61 | </div> |
|
62 | 62 | <div class="right-content"> |
|
63 | 63 | <div> |
|
64 | 64 | <div class="code-header" > |
|
65 | 65 | <div class="compare_header"> |
|
66 | 66 | ## The hidden elements are replaced with a select2 widget |
|
67 | 67 | ${h.hidden('compare_source')} |
|
68 | 68 | </div> |
|
69 | 69 | </div> |
|
70 | 70 | </div> |
|
71 | 71 | </div> |
|
72 | 72 | </div> |
|
73 | 73 | |
|
74 | 74 | <div class="fieldset"> |
|
75 | 75 | <div class="left-label"> |
|
76 | 76 | ${_('Source')}: |
|
77 | 77 | </div> |
|
78 | 78 | <div class="right-content"> |
|
79 | 79 | <div> |
|
80 | 80 | <div class="code-header" > |
|
81 | 81 | <div class="compare_header"> |
|
82 | 82 | ## The hidden elements are replaced with a select2 widget |
|
83 | 83 | ${h.hidden('compare_target')} |
|
84 | 84 | </div> |
|
85 | 85 | </div> |
|
86 | 86 | </div> |
|
87 | 87 | </div> |
|
88 | 88 | </div> |
|
89 | 89 | |
|
90 | 90 | <div class="fieldset"> |
|
91 | 91 | <div class="left-label"> |
|
92 | 92 | ${_('Actions')}: |
|
93 | 93 | </div> |
|
94 | 94 | <div class="right-content"> |
|
95 | 95 | <div> |
|
96 | 96 | <div class="code-header" > |
|
97 | 97 | <div class="compare_header"> |
|
98 | 98 | |
|
99 | 99 | <div class="compare-buttons"> |
|
100 | 100 | % if c.compare_home: |
|
101 | 101 | <a id="compare_revs" class="btn btn-primary"> ${_('Compare Commits')}</a> |
|
102 | 102 | |
|
103 | 103 | <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Swap')}</a> |
|
104 | 104 | <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a> |
|
105 | 105 | <div id="changeset_compare_view_content"> |
|
106 | 106 | <div class="help-block">${_('Compare commits, branches, bookmarks or tags.')}</div> |
|
107 | 107 | </div> |
|
108 | 108 | |
|
109 | 109 | % elif c.preview_mode: |
|
110 | 110 | <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Compare Commits')}</a> |
|
111 | 111 | <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Swap')}</a> |
|
112 | 112 | <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a> |
|
113 | 113 | |
|
114 | 114 | % else: |
|
115 | 115 | <a id="compare_revs" class="btn btn-primary"> ${_('Compare Commits')}</a> |
|
116 | 116 | <a id="btn-swap" class="btn btn-primary" href="${c.swap_url}">${_('Swap')}</a> |
|
117 | 117 | |
|
118 | 118 | ## allow comment only if there are commits to comment on |
|
119 | 119 | % if c.diffset and c.diffset.files and c.commit_ranges: |
|
120 | 120 | <a id="compare_changeset_status_toggle" class="btn btn-primary">${_('Comment')}</a> |
|
121 | 121 | % else: |
|
122 | 122 | <a class="btn disabled tooltip" disabled="disabled" title="${_('Action unavailable in current view')}">${_('Comment')}</a> |
|
123 | 123 | % endif |
|
124 | 124 | % endif |
|
125 | 125 | </div> |
|
126 | 126 | </div> |
|
127 | 127 | </div> |
|
128 | 128 | </div> |
|
129 | 129 | </div> |
|
130 | 130 | </div> |
|
131 | 131 | |
|
132 | 132 | <%doc> |
|
133 | 133 | ##TODO(marcink): implement this and diff menus |
|
134 | 134 | <div class="fieldset"> |
|
135 | 135 | <div class="left-label"> |
|
136 | 136 | ${_('Diff options')}: |
|
137 | 137 | </div> |
|
138 | 138 | <div class="right-content"> |
|
139 | 139 | <div class="diff-actions"> |
|
140 | 140 | <a href="${h.route_path('repo_commit_raw',repo_name=c.repo_name,commit_id='?')}" class="tooltip" title="${h.tooltip(_('Raw diff'))}"> |
|
141 | 141 | ${_('Raw Diff')} |
|
142 | 142 | </a> |
|
143 | 143 | | |
|
144 | 144 | <a href="${h.route_path('repo_commit_patch',repo_name=c.repo_name,commit_id='?')}" class="tooltip" title="${h.tooltip(_('Patch diff'))}"> |
|
145 | 145 | ${_('Patch Diff')} |
|
146 | 146 | </a> |
|
147 | 147 | | |
|
148 | 148 | <a href="${h.route_path('repo_commit_download',repo_name=c.repo_name,commit_id='?',_query=dict(diff='download'))}" class="tooltip" title="${h.tooltip(_('Download diff'))}"> |
|
149 | 149 | ${_('Download Diff')} |
|
150 | 150 | </a> |
|
151 | 151 | </div> |
|
152 | 152 | </div> |
|
153 | 153 | </div> |
|
154 | 154 | </%doc> |
|
155 | 155 | |
|
156 | 156 | ## commit status form |
|
157 | 157 | <div class="fieldset" id="compare_changeset_status" style="display: none; margin-bottom: -80px;"> |
|
158 | 158 | <div class="left-label"> |
|
159 | 159 | ${_('Commit status')}: |
|
160 | 160 | </div> |
|
161 | 161 | <div class="right-content"> |
|
162 | 162 | <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> |
|
163 | 163 | ## main comment form and it status |
|
164 | 164 | <% |
|
165 | 165 | def revs(_revs): |
|
166 | 166 | form_inputs = [] |
|
167 | 167 | for cs in _revs: |
|
168 | 168 | tmpl = '<input type="hidden" data-commit-id="%(cid)s" name="commit_ids" value="%(cid)s">' % {'cid': cs.raw_id} |
|
169 | 169 | form_inputs.append(tmpl) |
|
170 | 170 | return form_inputs |
|
171 | 171 | %> |
|
172 | 172 | <div> |
|
173 | 173 | ${comment.comments(h.route_path('repo_commit_comment_create', repo_name=c.repo_name, commit_id='0'*16), None, is_compare=True, form_extras=revs(c.commit_ranges))} |
|
174 | 174 | </div> |
|
175 | 175 | </div> |
|
176 | 176 | </div> |
|
177 | 177 | |
|
178 | 178 | </div> <!-- end summary-detail --> |
|
179 | 179 | </div> <!-- end summary --> |
|
180 | 180 | |
|
181 | 181 | ## use JS script to load it quickly before potentially large diffs render long time |
|
182 | 182 | ## this prevents from situation when large diffs block rendering of select2 fields |
|
183 | 183 | <script type="text/javascript"> |
|
184 | 184 | |
|
185 | 185 | var cache = {}; |
|
186 | 186 | |
|
187 | 187 | var formatSelection = function(repoName){ |
|
188 | 188 | return function(data, container, escapeMarkup) { |
|
189 | 189 | var selection = data ? this.text(data) : ""; |
|
190 | 190 | return escapeMarkup('{0}@{1}'.format(repoName, selection)); |
|
191 | 191 | } |
|
192 | 192 | }; |
|
193 | 193 | |
|
194 | 194 | var feedCompareData = function(query, cachedValue){ |
|
195 | 195 | var data = {results: []}; |
|
196 | 196 | //filter results |
|
197 | 197 | $.each(cachedValue.results, function() { |
|
198 | 198 | var section = this.text; |
|
199 | 199 | var children = []; |
|
200 | 200 | $.each(this.children, function() { |
|
201 | 201 | if (query.term.length === 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0) { |
|
202 | 202 | children.push({ |
|
203 | 203 | 'id': this.id, |
|
204 | 204 | 'text': this.text, |
|
205 | 205 | 'type': this.type |
|
206 | 206 | }) |
|
207 | 207 | } |
|
208 | 208 | }); |
|
209 | 209 | data.results.push({ |
|
210 | 210 | 'text': section, |
|
211 | 211 | 'children': children |
|
212 | 212 | }) |
|
213 | 213 | }); |
|
214 | 214 | //push the typed in changeset |
|
215 | 215 | data.results.push({ |
|
216 | 216 | 'text': _gettext('specify commit'), |
|
217 | 217 | 'children': [{ |
|
218 | 218 | 'id': query.term, |
|
219 | 219 | 'text': query.term, |
|
220 | 220 | 'type': 'rev' |
|
221 | 221 | }] |
|
222 | 222 | }); |
|
223 | 223 | query.callback(data); |
|
224 | 224 | }; |
|
225 | 225 | |
|
226 | 226 | var loadCompareData = function(repoName, query, cache){ |
|
227 | 227 | $.ajax({ |
|
228 | 228 | url: pyroutes.url('repo_refs_data', {'repo_name': repoName}), |
|
229 | 229 | data: {}, |
|
230 | 230 | dataType: 'json', |
|
231 | 231 | type: 'GET', |
|
232 | 232 | success: function(data) { |
|
233 | 233 | cache[repoName] = data; |
|
234 | 234 | query.callback({results: data.results}); |
|
235 | 235 | } |
|
236 | 236 | }) |
|
237 | 237 | }; |
|
238 | 238 | |
|
239 | 239 | var enable_fields = ${"false" if c.preview_mode else "true"}; |
|
240 | 240 | $("#compare_source").select2({ |
|
241 | 241 | placeholder: "${'%s@%s' % (c.source_repo.repo_name, c.source_ref)}", |
|
242 | 242 | containerCssClass: "drop-menu", |
|
243 | 243 | dropdownCssClass: "drop-menu-dropdown", |
|
244 | 244 | formatSelection: formatSelection("${c.source_repo.repo_name}"), |
|
245 | 245 | dropdownAutoWidth: true, |
|
246 | 246 | query: function(query) { |
|
247 | 247 | var repoName = '${c.source_repo.repo_name}'; |
|
248 | 248 | var cachedValue = cache[repoName]; |
|
249 | 249 | |
|
250 | 250 | if (cachedValue){ |
|
251 | 251 | feedCompareData(query, cachedValue); |
|
252 | 252 | } |
|
253 | 253 | else { |
|
254 | 254 | loadCompareData(repoName, query, cache); |
|
255 | 255 | } |
|
256 | 256 | } |
|
257 | 257 | }).select2("enable", enable_fields); |
|
258 | 258 | |
|
259 | 259 | $("#compare_target").select2({ |
|
260 | 260 | placeholder: "${'%s@%s' % (c.target_repo.repo_name, c.target_ref)}", |
|
261 | 261 | dropdownAutoWidth: true, |
|
262 | 262 | containerCssClass: "drop-menu", |
|
263 | 263 | dropdownCssClass: "drop-menu-dropdown", |
|
264 | 264 | formatSelection: formatSelection("${c.target_repo.repo_name}"), |
|
265 | 265 | query: function(query) { |
|
266 | 266 | var repoName = '${c.target_repo.repo_name}'; |
|
267 | 267 | var cachedValue = cache[repoName]; |
|
268 | 268 | |
|
269 | 269 | if (cachedValue){ |
|
270 | 270 | feedCompareData(query, cachedValue); |
|
271 | 271 | } |
|
272 | 272 | else { |
|
273 | 273 | loadCompareData(repoName, query, cache); |
|
274 | 274 | } |
|
275 | 275 | } |
|
276 | 276 | }).select2("enable", enable_fields); |
|
277 | 277 | var initial_compare_source = {id: "${c.source_ref}", type:"${c.source_ref_type}"}; |
|
278 | 278 | var initial_compare_target = {id: "${c.target_ref}", type:"${c.target_ref_type}"}; |
|
279 | 279 | |
|
280 | 280 | $('#compare_revs').on('click', function(e) { |
|
281 | 281 | var source = $('#compare_source').select2('data') || initial_compare_source; |
|
282 | 282 | var target = $('#compare_target').select2('data') || initial_compare_target; |
|
283 | 283 | if (source && target) { |
|
284 | 284 | var url_data = { |
|
285 | 285 | repo_name: "${c.repo_name}", |
|
286 | 286 | source_ref: source.id, |
|
287 | 287 | source_ref_type: source.type, |
|
288 | 288 | target_ref: target.id, |
|
289 | 289 | target_ref_type: target.type |
|
290 | 290 | }; |
|
291 | 291 | window.location = pyroutes.url('repo_compare', url_data); |
|
292 | 292 | } |
|
293 | 293 | }); |
|
294 | 294 | $('#compare_changeset_status_toggle').on('click', function(e) { |
|
295 | 295 | $('#compare_changeset_status').toggle(); |
|
296 | 296 | }); |
|
297 | 297 | |
|
298 | 298 | </script> |
|
299 | 299 | |
|
300 | 300 | ## table diff data |
|
301 | 301 | <div class="table"> |
|
302 | 302 | |
|
303 | 303 | |
|
304 | 304 | % if not c.compare_home: |
|
305 | 305 | <div id="changeset_compare_view_content"> |
|
306 | 306 | <div class="pull-left"> |
|
307 | 307 | <div class="btn-group"> |
|
308 | 308 | <a |
|
309 | 309 | class="btn" |
|
310 | 310 | href="#" |
|
311 | 311 | onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false"> |
|
312 | 312 | ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)} |
|
313 | 313 | </a> |
|
314 | 314 | <a |
|
315 | 315 | class="btn" |
|
316 | 316 | href="#" |
|
317 | 317 | onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false"> |
|
318 | 318 | ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)} |
|
319 | 319 | </a> |
|
320 | 320 | </div> |
|
321 | 321 | </div> |
|
322 | 322 | <div style="padding:0 10px 10px 0px" class="pull-left"></div> |
|
323 | 323 | ## commit compare generated below |
|
324 | 324 | <%include file="compare_commits.mako"/> |
|
325 | 325 | ${cbdiffs.render_diffset_menu(c.diffset)} |
|
326 | 326 | ${cbdiffs.render_diffset(c.diffset)} |
|
327 | 327 | </div> |
|
328 | 328 | % endif |
|
329 | 329 | |
|
330 | 330 | </div> |
|
331 | 331 | </div> |
|
332 | 332 | |
|
333 | 333 | </%def> |
@@ -1,49 +1,49 b'' | |||
|
1 | 1 | |
|
2 | 2 | <div id="codeblock" class="browserblock"> |
|
3 | 3 | <div class="browser-header"> |
|
4 | 4 | <div class="browser-nav"> |
|
5 | 5 | ${h.form(h.current_route_path(request), method='GET', id='at_rev_form')} |
|
6 | 6 | <div class="info_box"> |
|
7 | 7 | ${h.hidden('refs_filter')} |
|
8 | 8 | <div class="info_box_elem previous"> |
|
9 | 9 | <a id="prev_commit_link" data-commit-id="${c.prev_commit.raw_id}" class="pjax-link ${'disabled' if c.url_prev == '#' else ''}" href="${c.url_prev}" title="${_('Previous commit')}"><i class="icon-left"></i></a> |
|
10 | 10 | </div> |
|
11 |
<div class="info_box_elem">${h.text('at_rev',value=c.commit. |
|
|
11 | <div class="info_box_elem">${h.text('at_rev',value=c.commit.idx)}</div> | |
|
12 | 12 | <div class="info_box_elem next"> |
|
13 | 13 | <a id="next_commit_link" data-commit-id="${c.next_commit.raw_id}" class="pjax-link ${'disabled' if c.url_next == '#' else ''}" href="${c.url_next}" title="${_('Next commit')}"><i class="icon-right"></i></a> |
|
14 | 14 | </div> |
|
15 | 15 | </div> |
|
16 | 16 | ${h.end_form()} |
|
17 | 17 | |
|
18 | 18 | <div id="search_activate_id" class="search_activate"> |
|
19 | 19 | <a class="btn btn-default" id="filter_activate" href="javascript:void(0)">${_('Search File List')}</a> |
|
20 | 20 | </div> |
|
21 | 21 | <div id="search_deactivate_id" class="search_activate hidden"> |
|
22 | 22 | <a class="btn btn-default" id="filter_deactivate" href="javascript:void(0)">${_('Close File List')}</a> |
|
23 | 23 | </div> |
|
24 | 24 | % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): |
|
25 | 25 | <div title="${_('Add New File')}" class="btn btn-primary new-file"> |
|
26 | 26 | <a href="${h.route_path('repo_files_add_file',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path, _anchor='edit')}"> |
|
27 | 27 | ${_('Add File')}</a> |
|
28 | 28 | </div> |
|
29 | 29 | % endif |
|
30 | 30 | </div> |
|
31 | 31 | |
|
32 | 32 | <div class="browser-search"> |
|
33 | 33 | <div class="node-filter"> |
|
34 | 34 | <div class="node_filter_box hidden" id="node_filter_box_loading" >${_('Loading file list...')}</div> |
|
35 | 35 | <div class="node_filter_box hidden" id="node_filter_box" > |
|
36 | 36 | <div class="node-filter-path">${h.get_last_path_part(c.file)}/</div> |
|
37 | 37 | <div class="node-filter-input"> |
|
38 | 38 | <input class="init" type="text" name="filter" size="25" id="node_filter" autocomplete="off"> |
|
39 | 39 | </div> |
|
40 | 40 | </div> |
|
41 | 41 | </div> |
|
42 | 42 | </div> |
|
43 | 43 | </div> |
|
44 | 44 | ## file tree is computed from caches, and filled in |
|
45 | 45 | <div id="file-tree"> |
|
46 | 46 | ${c.file_tree |n} |
|
47 | 47 | </div> |
|
48 | 48 | |
|
49 | 49 | </div> |
@@ -1,82 +1,82 b'' | |||
|
1 | 1 | <div id="file-tree-wrapper" class="browser-body ${'full-load' if c.full_load else ''}"> |
|
2 | 2 | <table class="code-browser rctable"> |
|
3 | 3 | <thead> |
|
4 | 4 | <tr> |
|
5 | 5 | <th>${_('Name')}</th> |
|
6 | 6 | <th>${_('Size')}</th> |
|
7 | 7 | <th>${_('Modified')}</th> |
|
8 | 8 | <th>${_('Last Commit')}</th> |
|
9 | 9 | <th>${_('Author')}</th> |
|
10 | 10 | </tr> |
|
11 | 11 | </thead> |
|
12 | 12 | |
|
13 | 13 | <tbody id="tbody"> |
|
14 | 14 | %if c.file.parent: |
|
15 | 15 | <tr class="parity0"> |
|
16 | 16 | <td class="td-componentname"> |
|
17 | 17 | <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.file.parent.path)}" class="pjax-link"> |
|
18 | 18 | <i class="icon-directory"></i>.. |
|
19 | 19 | </a> |
|
20 | 20 | </td> |
|
21 | 21 | <td></td> |
|
22 | 22 | <td></td> |
|
23 | 23 | <td></td> |
|
24 | 24 | <td></td> |
|
25 | 25 | </tr> |
|
26 | 26 | %endif |
|
27 | 27 | %for cnt,node in enumerate(c.file): |
|
28 | 28 | <tr class="parity${cnt%2}"> |
|
29 | 29 | <td class="td-componentname"> |
|
30 | 30 | % if node.is_submodule(): |
|
31 | 31 | <span class="submodule-dir"> |
|
32 | 32 | % if node.url.startswith('http://') or node.url.startswith('https://'): |
|
33 | 33 | <a href="${node.url}"> |
|
34 | 34 | <i class="icon-directory browser-dir"></i>${node.name} |
|
35 | 35 | </a> |
|
36 | 36 | % else: |
|
37 | 37 | <i class="icon-directory browser-dir"></i>${node.name} |
|
38 | 38 | % endif |
|
39 | 39 | </span> |
|
40 | 40 | % else: |
|
41 | 41 | <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=h.safe_unicode(node.path))}" class="pjax-link"> |
|
42 | 42 | <i class="${'icon-file-text browser-file' if node.is_file() else 'icon-directory browser-dir'}"></i>${node.name} |
|
43 | 43 | </a> |
|
44 | 44 | % endif |
|
45 | 45 | </td> |
|
46 | 46 | %if node.is_file(): |
|
47 | 47 | <td class="td-size" data-attr-name="size"> |
|
48 | 48 | % if c.full_load: |
|
49 | 49 | <span data-size="${node.size}">${h.format_byte_size_binary(node.size)}</span> |
|
50 | 50 | % else: |
|
51 | 51 | ${_('Loading ...')} |
|
52 | 52 | % endif |
|
53 | 53 | </td> |
|
54 | 54 | <td class="td-time" data-attr-name="modified_at"> |
|
55 | 55 | % if c.full_load: |
|
56 | 56 | <span data-date="${node.last_commit.date}">${h.age_component(node.last_commit.date)}</span> |
|
57 | 57 | % endif |
|
58 | 58 | </td> |
|
59 | 59 | <td class="td-hash" data-attr-name="commit_id"> |
|
60 | 60 | % if c.full_load: |
|
61 | 61 | <div class="tooltip" title="${h.tooltip(node.last_commit.message)}"> |
|
62 |
<pre data-commit-id="${node.last_commit.raw_id}">r${node.last_commit. |
|
|
62 | <pre data-commit-id="${node.last_commit.raw_id}">r${node.last_commit.idx}:${node.last_commit.short_id}</pre> | |
|
63 | 63 | </div> |
|
64 | 64 | % endif |
|
65 | 65 | </td> |
|
66 | 66 | <td class="td-user" data-attr-name="author"> |
|
67 | 67 | % if c.full_load: |
|
68 | 68 | <span data-author="${node.last_commit.author}" title="${h.tooltip(node.last_commit.author)}">${h.gravatar_with_user(request, node.last_commit.author)|n}</span> |
|
69 | 69 | % endif |
|
70 | 70 | </td> |
|
71 | 71 | %else: |
|
72 | 72 | <td></td> |
|
73 | 73 | <td></td> |
|
74 | 74 | <td></td> |
|
75 | 75 | <td></td> |
|
76 | 76 | %endif |
|
77 | 77 | </tr> |
|
78 | 78 | %endfor |
|
79 | 79 | </tbody> |
|
80 | 80 | <tbody id="tbody_filtered"></tbody> |
|
81 | 81 | </table> |
|
82 | 82 | </div> |
@@ -1,859 +1,859 b'' | |||
|
1 | 1 | <%inherit file="/base/base.mako"/> |
|
2 | 2 | <%namespace name="base" file="/base/base.mako"/> |
|
3 | 3 | <%namespace name="dt" file="/data_table/_dt_elements.mako"/> |
|
4 | 4 | |
|
5 | 5 | <%def name="title()"> |
|
6 | 6 | ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)} |
|
7 | 7 | %if c.rhodecode_name: |
|
8 | 8 | · ${h.branding(c.rhodecode_name)} |
|
9 | 9 | %endif |
|
10 | 10 | </%def> |
|
11 | 11 | |
|
12 | 12 | <%def name="breadcrumbs_links()"> |
|
13 | 13 | <span id="pr-title"> |
|
14 | 14 | ${c.pull_request.title} |
|
15 | 15 | %if c.pull_request.is_closed(): |
|
16 | 16 | (${_('Closed')}) |
|
17 | 17 | %endif |
|
18 | 18 | </span> |
|
19 | 19 | <div id="pr-title-edit" class="input" style="display: none;"> |
|
20 | 20 | ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)} |
|
21 | 21 | </div> |
|
22 | 22 | </%def> |
|
23 | 23 | |
|
24 | 24 | <%def name="menu_bar_nav()"> |
|
25 | 25 | ${self.menu_items(active='repositories')} |
|
26 | 26 | </%def> |
|
27 | 27 | |
|
28 | 28 | <%def name="menu_bar_subnav()"> |
|
29 | 29 | ${self.repo_menu(active='showpullrequest')} |
|
30 | 30 | </%def> |
|
31 | 31 | |
|
32 | 32 | <%def name="main()"> |
|
33 | 33 | |
|
34 | 34 | <script type="text/javascript"> |
|
35 | 35 | // TODO: marcink switch this to pyroutes |
|
36 | 36 | AJAX_COMMENT_DELETE_URL = "${h.route_path('pullrequest_comment_delete',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id,comment_id='__COMMENT_ID__')}"; |
|
37 | 37 | templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id}; |
|
38 | 38 | </script> |
|
39 | 39 | <div class="box"> |
|
40 | 40 | |
|
41 | 41 | <div class="title"> |
|
42 | 42 | ${self.repo_page_title(c.rhodecode_db_repo)} |
|
43 | 43 | </div> |
|
44 | 44 | |
|
45 | 45 | ${self.breadcrumbs()} |
|
46 | 46 | |
|
47 | 47 | <div class="box pr-summary"> |
|
48 | 48 | |
|
49 | 49 | <div class="summary-details block-left"> |
|
50 | 50 | <% summary = lambda n:{False:'summary-short'}.get(n) %> |
|
51 | 51 | <div class="pr-details-title"> |
|
52 | 52 | <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request #%s') % c.pull_request.pull_request_id}</a> ${_('From')} ${h.format_date(c.pull_request.created_on)} |
|
53 | 53 | %if c.allowed_to_update: |
|
54 | 54 | <div id="delete_pullrequest" class="pull-right action_button ${'' if c.allowed_to_delete else 'disabled' }" style="clear:inherit;padding: 0"> |
|
55 | 55 | % if c.allowed_to_delete: |
|
56 | 56 | ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), request=request)} |
|
57 | 57 | ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'), |
|
58 | 58 | class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")} |
|
59 | 59 | ${h.end_form()} |
|
60 | 60 | % else: |
|
61 | 61 | ${_('Delete')} |
|
62 | 62 | % endif |
|
63 | 63 | </div> |
|
64 | 64 | <div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div> |
|
65 | 65 | <div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel')}</div> |
|
66 | 66 | %endif |
|
67 | 67 | </div> |
|
68 | 68 | |
|
69 | 69 | <div id="summary" class="fields pr-details-content"> |
|
70 | 70 | <div class="field"> |
|
71 | 71 | <div class="label-summary"> |
|
72 | 72 | <label>${_('Source')}:</label> |
|
73 | 73 | </div> |
|
74 | 74 | <div class="input"> |
|
75 | 75 | <div class="pr-origininfo"> |
|
76 | 76 | ## branch link is only valid if it is a branch |
|
77 | 77 | <span class="tag"> |
|
78 | 78 | %if c.pull_request.source_ref_parts.type == 'branch': |
|
79 | 79 | <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a> |
|
80 | 80 | %else: |
|
81 | 81 | ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name} |
|
82 | 82 | %endif |
|
83 | 83 | </span> |
|
84 | 84 | <span class="clone-url"> |
|
85 | 85 | <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.clone_url()}</a> |
|
86 | 86 | </span> |
|
87 | 87 | <br/> |
|
88 | 88 | % if c.ancestor_commit: |
|
89 | 89 | ${_('Common ancestor')}: |
|
90 | 90 | <code><a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=c.ancestor_commit.raw_id)}">${h.show_id(c.ancestor_commit)}</a></code> |
|
91 | 91 | % endif |
|
92 | 92 | </div> |
|
93 | 93 | %if h.is_hg(c.pull_request.source_repo): |
|
94 | 94 | <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %> |
|
95 | 95 | %elif h.is_git(c.pull_request.source_repo): |
|
96 | 96 | <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %> |
|
97 | 97 | %endif |
|
98 | 98 | |
|
99 | 99 | <div class=""> |
|
100 | 100 | <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly"> |
|
101 | 101 | <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i> |
|
102 | 102 | </div> |
|
103 | 103 | |
|
104 | 104 | </div> |
|
105 | 105 | </div> |
|
106 | 106 | <div class="field"> |
|
107 | 107 | <div class="label-summary"> |
|
108 | 108 | <label>${_('Target')}:</label> |
|
109 | 109 | </div> |
|
110 | 110 | <div class="input"> |
|
111 | 111 | <div class="pr-targetinfo"> |
|
112 | 112 | ## branch link is only valid if it is a branch |
|
113 | 113 | <span class="tag"> |
|
114 | 114 | %if c.pull_request.target_ref_parts.type == 'branch': |
|
115 | 115 | <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a> |
|
116 | 116 | %else: |
|
117 | 117 | ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name} |
|
118 | 118 | %endif |
|
119 | 119 | </span> |
|
120 | 120 | <span class="clone-url"> |
|
121 | 121 | <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.clone_url()}</a> |
|
122 | 122 | </span> |
|
123 | 123 | </div> |
|
124 | 124 | </div> |
|
125 | 125 | </div> |
|
126 | 126 | |
|
127 | 127 | ## Link to the shadow repository. |
|
128 | 128 | <div class="field"> |
|
129 | 129 | <div class="label-summary"> |
|
130 | 130 | <label>${_('Merge')}:</label> |
|
131 | 131 | </div> |
|
132 | 132 | <div class="input"> |
|
133 | 133 | % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref: |
|
134 | 134 | %if h.is_hg(c.pull_request.target_repo): |
|
135 | 135 | <% clone_url = 'hg clone --update {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %> |
|
136 | 136 | %elif h.is_git(c.pull_request.target_repo): |
|
137 | 137 | <% clone_url = 'git clone --branch {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %> |
|
138 | 138 | %endif |
|
139 | 139 | <div class=""> |
|
140 | 140 | <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly"> |
|
141 | 141 | <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i> |
|
142 | 142 | </div> |
|
143 | 143 | % else: |
|
144 | 144 | <div class=""> |
|
145 | 145 | ${_('Shadow repository data not available')}. |
|
146 | 146 | </div> |
|
147 | 147 | % endif |
|
148 | 148 | </div> |
|
149 | 149 | </div> |
|
150 | 150 | |
|
151 | 151 | <div class="field"> |
|
152 | 152 | <div class="label-summary"> |
|
153 | 153 | <label>${_('Review')}:</label> |
|
154 | 154 | </div> |
|
155 | 155 | <div class="input"> |
|
156 | 156 | %if c.pull_request_review_status: |
|
157 | 157 | <div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div> |
|
158 | 158 | <span class="changeset-status-lbl tooltip"> |
|
159 | 159 | %if c.pull_request.is_closed(): |
|
160 | 160 | ${_('Closed')}, |
|
161 | 161 | %endif |
|
162 | 162 | ${h.commit_status_lbl(c.pull_request_review_status)} |
|
163 | 163 | </span> |
|
164 | 164 | - ${_ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)} |
|
165 | 165 | %endif |
|
166 | 166 | </div> |
|
167 | 167 | </div> |
|
168 | 168 | <div class="field"> |
|
169 | 169 | <div class="pr-description-label label-summary" title="${_('Rendered using {} renderer').format(c.renderer)}"> |
|
170 | 170 | <label>${_('Description')}:</label> |
|
171 | 171 | </div> |
|
172 | 172 | <div id="pr-desc" class="input"> |
|
173 | 173 | <div class="pr-description">${h.render(c.pull_request.description, renderer=c.renderer)}</div> |
|
174 | 174 | </div> |
|
175 | 175 | <div id="pr-desc-edit" class="input textarea editor" style="display: none;"> |
|
176 | 176 | <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}"> |
|
177 | 177 | ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)} |
|
178 | 178 | </div> |
|
179 | 179 | </div> |
|
180 | 180 | |
|
181 | 181 | <div class="field"> |
|
182 | 182 | <div class="label-summary"> |
|
183 | 183 | <label>${_('Versions')}:</label> |
|
184 | 184 | </div> |
|
185 | 185 | |
|
186 | 186 | <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %> |
|
187 | 187 | <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %> |
|
188 | 188 | |
|
189 | 189 | <div class="pr-versions"> |
|
190 | 190 | % if c.show_version_changes: |
|
191 | 191 | <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %> |
|
192 | 192 | <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %> |
|
193 | 193 | <a id="show-pr-versions" class="input" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions" |
|
194 | 194 | data-toggle-on="${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}" |
|
195 | 195 | data-toggle-off="${_('Hide all versions of this pull request')}"> |
|
196 | 196 | ${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))} |
|
197 | 197 | </a> |
|
198 | 198 | <table> |
|
199 | 199 | ## SHOW ALL VERSIONS OF PR |
|
200 | 200 | <% ver_pr = None %> |
|
201 | 201 | |
|
202 | 202 | % for data in reversed(list(enumerate(c.versions, 1))): |
|
203 | 203 | <% ver_pos = data[0] %> |
|
204 | 204 | <% ver = data[1] %> |
|
205 | 205 | <% ver_pr = ver.pull_request_version_id %> |
|
206 | 206 | <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %> |
|
207 | 207 | |
|
208 | 208 | <tr class="version-pr" style="display: ${display_row}"> |
|
209 | 209 | <td> |
|
210 | 210 | <code> |
|
211 | 211 | <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a> |
|
212 | 212 | </code> |
|
213 | 213 | </td> |
|
214 | 214 | <td> |
|
215 | 215 | <input ${'checked="checked"' if c.from_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/> |
|
216 | 216 | <input ${'checked="checked"' if c.at_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/> |
|
217 | 217 | </td> |
|
218 | 218 | <td> |
|
219 | 219 | <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %> |
|
220 | 220 | <div class="${'flag_status %s' % review_status} tooltip pull-left" title="${_('Your review status at this version')}"> |
|
221 | 221 | </div> |
|
222 | 222 | </td> |
|
223 | 223 | <td> |
|
224 | 224 | % if c.at_version_num != ver_pr: |
|
225 | 225 | <i class="icon-comment"></i> |
|
226 | 226 | <code class="tooltip" title="${_('Comment from pull request version v{0}, general:{1} inline:{2}').format(ver_pos, len(c.comment_versions[ver_pr]['at']), len(c.inline_versions[ver_pr]['at']))}"> |
|
227 | 227 | G:${len(c.comment_versions[ver_pr]['at'])} / I:${len(c.inline_versions[ver_pr]['at'])} |
|
228 | 228 | </code> |
|
229 | 229 | % endif |
|
230 | 230 | </td> |
|
231 | 231 | <td> |
|
232 | 232 | ##<code>${ver.source_ref_parts.commit_id[:6]}</code> |
|
233 | 233 | </td> |
|
234 | 234 | <td> |
|
235 | 235 | ${h.age_component(ver.updated_on, time_is_local=True)} |
|
236 | 236 | </td> |
|
237 | 237 | </tr> |
|
238 | 238 | % endfor |
|
239 | 239 | |
|
240 | 240 | <tr> |
|
241 | 241 | <td colspan="6"> |
|
242 | 242 | <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none" |
|
243 | 243 | data-label-text-locked="${_('select versions to show changes')}" |
|
244 | 244 | data-label-text-diff="${_('show changes between versions')}" |
|
245 | 245 | data-label-text-show="${_('show pull request for this version')}" |
|
246 | 246 | > |
|
247 | 247 | ${_('select versions to show changes')} |
|
248 | 248 | </button> |
|
249 | 249 | </td> |
|
250 | 250 | </tr> |
|
251 | 251 | |
|
252 | 252 | ## show comment/inline comments summary |
|
253 | 253 | <%def name="comments_summary()"> |
|
254 | 254 | <tr> |
|
255 | 255 | <td colspan="6" class="comments-summary-td"> |
|
256 | 256 | |
|
257 | 257 | % if c.at_version: |
|
258 | 258 | <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['display']) %> |
|
259 | 259 | <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['display']) %> |
|
260 | 260 | ${_('Comments at this version')}: |
|
261 | 261 | % else: |
|
262 | 262 | <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['until']) %> |
|
263 | 263 | <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['until']) %> |
|
264 | 264 | ${_('Comments for this pull request')}: |
|
265 | 265 | % endif |
|
266 | 266 | |
|
267 | 267 | |
|
268 | 268 | %if general_comm_count_ver: |
|
269 | 269 | <a href="#comments">${_("%d General ") % general_comm_count_ver}</a> |
|
270 | 270 | %else: |
|
271 | 271 | ${_("%d General ") % general_comm_count_ver} |
|
272 | 272 | %endif |
|
273 | 273 | |
|
274 | 274 | %if inline_comm_count_ver: |
|
275 | 275 | , <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_("%d Inline") % inline_comm_count_ver}</a> |
|
276 | 276 | %else: |
|
277 | 277 | , ${_("%d Inline") % inline_comm_count_ver} |
|
278 | 278 | %endif |
|
279 | 279 | |
|
280 | 280 | %if outdated_comm_count_ver: |
|
281 | 281 | , <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">${_("%d Outdated") % outdated_comm_count_ver}</a> |
|
282 | 282 | <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated comments')}</a> |
|
283 | 283 | <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated comments')}</a> |
|
284 | 284 | %else: |
|
285 | 285 | , ${_("%d Outdated") % outdated_comm_count_ver} |
|
286 | 286 | %endif |
|
287 | 287 | </td> |
|
288 | 288 | </tr> |
|
289 | 289 | </%def> |
|
290 | 290 | ${comments_summary()} |
|
291 | 291 | </table> |
|
292 | 292 | % else: |
|
293 | 293 | <div class="input"> |
|
294 | 294 | ${_('Pull request versions not available')}. |
|
295 | 295 | </div> |
|
296 | 296 | <div> |
|
297 | 297 | <table> |
|
298 | 298 | ${comments_summary()} |
|
299 | 299 | </table> |
|
300 | 300 | </div> |
|
301 | 301 | % endif |
|
302 | 302 | </div> |
|
303 | 303 | </div> |
|
304 | 304 | |
|
305 | 305 | <div id="pr-save" class="field" style="display: none;"> |
|
306 | 306 | <div class="label-summary"></div> |
|
307 | 307 | <div class="input"> |
|
308 | 308 | <span id="edit_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</span> |
|
309 | 309 | </div> |
|
310 | 310 | </div> |
|
311 | 311 | </div> |
|
312 | 312 | </div> |
|
313 | 313 | <div> |
|
314 | 314 | ## AUTHOR |
|
315 | 315 | <div class="reviewers-title block-right"> |
|
316 | 316 | <div class="pr-details-title"> |
|
317 | 317 | ${_('Author of this pull request')} |
|
318 | 318 | </div> |
|
319 | 319 | </div> |
|
320 | 320 | <div class="block-right pr-details-content reviewers"> |
|
321 | 321 | <ul class="group_members"> |
|
322 | 322 | <li> |
|
323 | 323 | ${self.gravatar_with_user(c.pull_request.author.email, 16)} |
|
324 | 324 | </li> |
|
325 | 325 | </ul> |
|
326 | 326 | </div> |
|
327 | 327 | |
|
328 | 328 | ## REVIEW RULES |
|
329 | 329 | <div id="review_rules" style="display: none" class="reviewers-title block-right"> |
|
330 | 330 | <div class="pr-details-title"> |
|
331 | 331 | ${_('Reviewer rules')} |
|
332 | 332 | %if c.allowed_to_update: |
|
333 | 333 | <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span> |
|
334 | 334 | %endif |
|
335 | 335 | </div> |
|
336 | 336 | <div class="pr-reviewer-rules"> |
|
337 | 337 | ## review rules will be appended here, by default reviewers logic |
|
338 | 338 | </div> |
|
339 | 339 | <input id="review_data" type="hidden" name="review_data" value=""> |
|
340 | 340 | </div> |
|
341 | 341 | |
|
342 | 342 | ## REVIEWERS |
|
343 | 343 | <div class="reviewers-title block-right"> |
|
344 | 344 | <div class="pr-details-title"> |
|
345 | 345 | ${_('Pull request reviewers')} |
|
346 | 346 | %if c.allowed_to_update: |
|
347 | 347 | <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span> |
|
348 | 348 | %endif |
|
349 | 349 | </div> |
|
350 | 350 | </div> |
|
351 | 351 | <div id="reviewers" class="block-right pr-details-content reviewers"> |
|
352 | 352 | |
|
353 | 353 | ## members redering block |
|
354 | 354 | <input type="hidden" name="__start__" value="review_members:sequence"> |
|
355 | 355 | <ul id="review_members" class="group_members"> |
|
356 | 356 | |
|
357 | 357 | % for review_obj, member, reasons, mandatory, status in c.pull_request_reviewers: |
|
358 | 358 | <script> |
|
359 | 359 | var member = ${h.json.dumps(h.reviewer_as_json(member, reasons=reasons, mandatory=mandatory, user_group=review_obj.rule_user_group_data()))|n}; |
|
360 | 360 | var status = "${(status[0][1].status if status else 'not_reviewed')}"; |
|
361 | 361 | var status_lbl = "${h.commit_status_lbl(status[0][1].status if status else 'not_reviewed')}"; |
|
362 | 362 | var allowed_to_update = ${h.json.dumps(c.allowed_to_update)}; |
|
363 | 363 | |
|
364 | 364 | var entry = renderTemplate('reviewMemberEntry', { |
|
365 | 365 | 'member': member, |
|
366 | 366 | 'mandatory': member.mandatory, |
|
367 | 367 | 'reasons': member.reasons, |
|
368 | 368 | 'allowed_to_update': allowed_to_update, |
|
369 | 369 | 'review_status': status, |
|
370 | 370 | 'review_status_label': status_lbl, |
|
371 | 371 | 'user_group': member.user_group, |
|
372 | 372 | 'create': false |
|
373 | 373 | }); |
|
374 | 374 | $('#review_members').append(entry) |
|
375 | 375 | </script> |
|
376 | 376 | |
|
377 | 377 | % endfor |
|
378 | 378 | |
|
379 | 379 | </ul> |
|
380 | 380 | <input type="hidden" name="__end__" value="review_members:sequence"> |
|
381 | 381 | ## end members redering block |
|
382 | 382 | |
|
383 | 383 | %if not c.pull_request.is_closed(): |
|
384 | 384 | <div id="add_reviewer" class="ac" style="display: none;"> |
|
385 | 385 | %if c.allowed_to_update: |
|
386 | 386 | % if not c.forbid_adding_reviewers: |
|
387 | 387 | <div id="add_reviewer_input" class="reviewer_ac"> |
|
388 | 388 | ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))} |
|
389 | 389 | <div id="reviewers_container"></div> |
|
390 | 390 | </div> |
|
391 | 391 | % endif |
|
392 | 392 | <div class="pull-right"> |
|
393 | 393 | <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button> |
|
394 | 394 | </div> |
|
395 | 395 | %endif |
|
396 | 396 | </div> |
|
397 | 397 | %endif |
|
398 | 398 | </div> |
|
399 | 399 | </div> |
|
400 | 400 | </div> |
|
401 | 401 | <div class="box"> |
|
402 | 402 | ##DIFF |
|
403 | 403 | <div class="table" > |
|
404 | 404 | <div id="changeset_compare_view_content"> |
|
405 | 405 | ##CS |
|
406 | 406 | % if c.missing_requirements: |
|
407 | 407 | <div class="box"> |
|
408 | 408 | <div class="alert alert-warning"> |
|
409 | 409 | <div> |
|
410 | 410 | <strong>${_('Missing requirements:')}</strong> |
|
411 | 411 | ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')} |
|
412 | 412 | </div> |
|
413 | 413 | </div> |
|
414 | 414 | </div> |
|
415 | 415 | % elif c.missing_commits: |
|
416 | 416 | <div class="box"> |
|
417 | 417 | <div class="alert alert-warning"> |
|
418 | 418 | <div> |
|
419 | 419 | <strong>${_('Missing commits')}:</strong> |
|
420 | 420 | ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')} |
|
421 | 421 | ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')} |
|
422 | 422 | ${_('Consider doing a {force_refresh_url} in case you think this is an error.').format(force_refresh_url=h.link_to('force refresh', h.current_route_path(request, force_refresh='1')))|n} |
|
423 | 423 | </div> |
|
424 | 424 | </div> |
|
425 | 425 | </div> |
|
426 | 426 | % endif |
|
427 | 427 | |
|
428 | 428 | <div class="compare_view_commits_title"> |
|
429 | 429 | % if not c.compare_mode: |
|
430 | 430 | |
|
431 | 431 | % if c.at_version_pos: |
|
432 | 432 | <h4> |
|
433 | 433 | ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos} |
|
434 | 434 | </h4> |
|
435 | 435 | % endif |
|
436 | 436 | |
|
437 | 437 | <div class="pull-left"> |
|
438 | 438 | <div class="btn-group"> |
|
439 | 439 | <a |
|
440 | 440 | class="btn" |
|
441 | 441 | href="#" |
|
442 | 442 | onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false"> |
|
443 | 443 | ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)} |
|
444 | 444 | </a> |
|
445 | 445 | <a |
|
446 | 446 | class="btn" |
|
447 | 447 | href="#" |
|
448 | 448 | onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false"> |
|
449 | 449 | ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)} |
|
450 | 450 | </a> |
|
451 | 451 | </div> |
|
452 | 452 | </div> |
|
453 | 453 | |
|
454 | 454 | <div class="pull-right"> |
|
455 | 455 | % if c.allowed_to_update and not c.pull_request.is_closed(): |
|
456 | 456 | <a id="update_commits" class="btn btn-primary no-margin pull-right">${_('Update commits')}</a> |
|
457 | 457 | % else: |
|
458 | 458 | <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a> |
|
459 | 459 | % endif |
|
460 | 460 | |
|
461 | 461 | </div> |
|
462 | 462 | % endif |
|
463 | 463 | </div> |
|
464 | 464 | |
|
465 | 465 | % if not c.missing_commits: |
|
466 | 466 | % if c.compare_mode: |
|
467 | 467 | % if c.at_version: |
|
468 | 468 | <h4> |
|
469 | 469 | ${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_pos, ver_to=c.at_version_pos if c.at_version_pos else 'latest')}: |
|
470 | 470 | </h4> |
|
471 | 471 | |
|
472 | 472 | <div class="subtitle-compare"> |
|
473 | 473 | ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))} |
|
474 | 474 | </div> |
|
475 | 475 | |
|
476 | 476 | <div class="container"> |
|
477 | 477 | <table class="rctable compare_view_commits"> |
|
478 | 478 | <tr> |
|
479 | 479 | <th></th> |
|
480 | 480 | <th>${_('Time')}</th> |
|
481 | 481 | <th>${_('Author')}</th> |
|
482 | 482 | <th>${_('Commit')}</th> |
|
483 | 483 | <th></th> |
|
484 | 484 | <th>${_('Description')}</th> |
|
485 | 485 | </tr> |
|
486 | 486 | |
|
487 | 487 | % for c_type, commit in c.commit_changes: |
|
488 | 488 | % if c_type in ['a', 'r']: |
|
489 | 489 | <% |
|
490 | 490 | if c_type == 'a': |
|
491 | 491 | cc_title = _('Commit added in displayed changes') |
|
492 | 492 | elif c_type == 'r': |
|
493 | 493 | cc_title = _('Commit removed in displayed changes') |
|
494 | 494 | else: |
|
495 | 495 | cc_title = '' |
|
496 | 496 | %> |
|
497 | 497 | <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select"> |
|
498 | 498 | <td> |
|
499 | 499 | <div class="commit-change-indicator color-${c_type}-border"> |
|
500 | 500 | <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}"> |
|
501 | 501 | ${c_type.upper()} |
|
502 | 502 | </div> |
|
503 | 503 | </div> |
|
504 | 504 | </td> |
|
505 | 505 | <td class="td-time"> |
|
506 | 506 | ${h.age_component(commit.date)} |
|
507 | 507 | </td> |
|
508 | 508 | <td class="td-user"> |
|
509 | 509 | ${base.gravatar_with_user(commit.author, 16)} |
|
510 | 510 | </td> |
|
511 | 511 | <td class="td-hash"> |
|
512 | 512 | <code> |
|
513 | 513 | <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}"> |
|
514 |
r${commit. |
|
|
514 | r${commit.idx}:${h.short_id(commit.raw_id)} | |
|
515 | 515 | </a> |
|
516 | 516 | ${h.hidden('revisions', commit.raw_id)} |
|
517 | 517 | </code> |
|
518 | 518 | </td> |
|
519 | 519 | <td class="expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}"> |
|
520 | 520 | <div class="show_more_col"> |
|
521 | 521 | <i class="show_more"></i> |
|
522 | 522 | </div> |
|
523 | 523 | </td> |
|
524 | 524 | <td class="mid td-description"> |
|
525 | 525 | <div class="log-container truncate-wrap"> |
|
526 | 526 | <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}"> |
|
527 | 527 | ${h.urlify_commit_message(commit.message, c.repo_name)} |
|
528 | 528 | </div> |
|
529 | 529 | </div> |
|
530 | 530 | </td> |
|
531 | 531 | </tr> |
|
532 | 532 | % endif |
|
533 | 533 | % endfor |
|
534 | 534 | </table> |
|
535 | 535 | </div> |
|
536 | 536 | |
|
537 | 537 | <script> |
|
538 | 538 | $('.expand_commit').on('click',function(e){ |
|
539 | 539 | var target_expand = $(this); |
|
540 | 540 | var cid = target_expand.data('commitId'); |
|
541 | 541 | |
|
542 | 542 | if (target_expand.hasClass('open')){ |
|
543 | 543 | $('#c-'+cid).css({ |
|
544 | 544 | 'height': '1.5em', |
|
545 | 545 | 'white-space': 'nowrap', |
|
546 | 546 | 'text-overflow': 'ellipsis', |
|
547 | 547 | 'overflow':'hidden' |
|
548 | 548 | }); |
|
549 | 549 | target_expand.removeClass('open'); |
|
550 | 550 | } |
|
551 | 551 | else { |
|
552 | 552 | $('#c-'+cid).css({ |
|
553 | 553 | 'height': 'auto', |
|
554 | 554 | 'white-space': 'pre-line', |
|
555 | 555 | 'text-overflow': 'initial', |
|
556 | 556 | 'overflow':'visible' |
|
557 | 557 | }); |
|
558 | 558 | target_expand.addClass('open'); |
|
559 | 559 | } |
|
560 | 560 | }); |
|
561 | 561 | </script> |
|
562 | 562 | |
|
563 | 563 | % endif |
|
564 | 564 | |
|
565 | 565 | % else: |
|
566 | 566 | <%include file="/compare/compare_commits.mako" /> |
|
567 | 567 | % endif |
|
568 | 568 | |
|
569 | 569 | <div class="cs_files"> |
|
570 | 570 | <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> |
|
571 | 571 | ${cbdiffs.render_diffset_menu(c.diffset)} |
|
572 | 572 | ${cbdiffs.render_diffset( |
|
573 | 573 | c.diffset, use_comments=True, |
|
574 | 574 | collapse_when_files_over=30, |
|
575 | 575 | disable_new_comments=not c.allowed_to_comment, |
|
576 | 576 | deleted_files_comments=c.deleted_files_comments, |
|
577 | 577 | inline_comments=c.inline_comments)} |
|
578 | 578 | </div> |
|
579 | 579 | % else: |
|
580 | 580 | ## skipping commits we need to clear the view for missing commits |
|
581 | 581 | <div style="clear:both;"></div> |
|
582 | 582 | % endif |
|
583 | 583 | |
|
584 | 584 | </div> |
|
585 | 585 | </div> |
|
586 | 586 | |
|
587 | 587 | ## template for inline comment form |
|
588 | 588 | <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> |
|
589 | 589 | |
|
590 | 590 | ## render general comments |
|
591 | 591 | |
|
592 | 592 | <div id="comment-tr-show"> |
|
593 | 593 | <div class="comment"> |
|
594 | 594 | % if general_outdated_comm_count_ver: |
|
595 | 595 | <div class="meta"> |
|
596 | 596 | % if general_outdated_comm_count_ver == 1: |
|
597 | 597 | ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)}, |
|
598 | 598 | <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a> |
|
599 | 599 | % else: |
|
600 | 600 | ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)}, |
|
601 | 601 | <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a> |
|
602 | 602 | % endif |
|
603 | 603 | </div> |
|
604 | 604 | % endif |
|
605 | 605 | </div> |
|
606 | 606 | </div> |
|
607 | 607 | |
|
608 | 608 | ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)} |
|
609 | 609 | |
|
610 | 610 | % if not c.pull_request.is_closed(): |
|
611 | 611 | ## merge status, and merge action |
|
612 | 612 | <div class="pull-request-merge"> |
|
613 | 613 | <%include file="/pullrequests/pullrequest_merge_checks.mako"/> |
|
614 | 614 | </div> |
|
615 | 615 | |
|
616 | 616 | ## main comment form and it status |
|
617 | 617 | ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name, |
|
618 | 618 | pull_request_id=c.pull_request.pull_request_id), |
|
619 | 619 | c.pull_request_review_status, |
|
620 | 620 | is_pull_request=True, change_status=c.allowed_to_change_status)} |
|
621 | 621 | %endif |
|
622 | 622 | |
|
623 | 623 | <script type="text/javascript"> |
|
624 | 624 | if (location.hash) { |
|
625 | 625 | var result = splitDelimitedHash(location.hash); |
|
626 | 626 | var line = $('html').find(result.loc); |
|
627 | 627 | // show hidden comments if we use location.hash |
|
628 | 628 | if (line.hasClass('comment-general')) { |
|
629 | 629 | $(line).show(); |
|
630 | 630 | } else if (line.hasClass('comment-inline')) { |
|
631 | 631 | $(line).show(); |
|
632 | 632 | var $cb = $(line).closest('.cb'); |
|
633 | 633 | $cb.removeClass('cb-collapsed') |
|
634 | 634 | } |
|
635 | 635 | if (line.length > 0){ |
|
636 | 636 | offsetScroll(line, 70); |
|
637 | 637 | } |
|
638 | 638 | } |
|
639 | 639 | |
|
640 | 640 | versionController = new VersionController(); |
|
641 | 641 | versionController.init(); |
|
642 | 642 | |
|
643 | 643 | reviewersController = new ReviewersController(); |
|
644 | 644 | |
|
645 | 645 | $(function(){ |
|
646 | 646 | |
|
647 | 647 | // custom code mirror |
|
648 | 648 | var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm; |
|
649 | 649 | |
|
650 | 650 | var PRDetails = { |
|
651 | 651 | editButton: $('#open_edit_pullrequest'), |
|
652 | 652 | closeButton: $('#close_edit_pullrequest'), |
|
653 | 653 | deleteButton: $('#delete_pullrequest'), |
|
654 | 654 | viewFields: $('#pr-desc, #pr-title'), |
|
655 | 655 | editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'), |
|
656 | 656 | |
|
657 | 657 | init: function() { |
|
658 | 658 | var that = this; |
|
659 | 659 | this.editButton.on('click', function(e) { that.edit(); }); |
|
660 | 660 | this.closeButton.on('click', function(e) { that.view(); }); |
|
661 | 661 | }, |
|
662 | 662 | |
|
663 | 663 | edit: function(event) { |
|
664 | 664 | this.viewFields.hide(); |
|
665 | 665 | this.editButton.hide(); |
|
666 | 666 | this.deleteButton.hide(); |
|
667 | 667 | this.closeButton.show(); |
|
668 | 668 | this.editFields.show(); |
|
669 | 669 | codeMirrorInstance.refresh(); |
|
670 | 670 | }, |
|
671 | 671 | |
|
672 | 672 | view: function(event) { |
|
673 | 673 | this.editButton.show(); |
|
674 | 674 | this.deleteButton.show(); |
|
675 | 675 | this.editFields.hide(); |
|
676 | 676 | this.closeButton.hide(); |
|
677 | 677 | this.viewFields.show(); |
|
678 | 678 | } |
|
679 | 679 | }; |
|
680 | 680 | |
|
681 | 681 | var ReviewersPanel = { |
|
682 | 682 | editButton: $('#open_edit_reviewers'), |
|
683 | 683 | closeButton: $('#close_edit_reviewers'), |
|
684 | 684 | addButton: $('#add_reviewer'), |
|
685 | 685 | removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove'), |
|
686 | 686 | |
|
687 | 687 | init: function() { |
|
688 | 688 | var self = this; |
|
689 | 689 | this.editButton.on('click', function(e) { self.edit(); }); |
|
690 | 690 | this.closeButton.on('click', function(e) { self.close(); }); |
|
691 | 691 | }, |
|
692 | 692 | |
|
693 | 693 | edit: function(event) { |
|
694 | 694 | this.editButton.hide(); |
|
695 | 695 | this.closeButton.show(); |
|
696 | 696 | this.addButton.show(); |
|
697 | 697 | this.removeButtons.css('visibility', 'visible'); |
|
698 | 698 | // review rules |
|
699 | 699 | reviewersController.loadReviewRules( |
|
700 | 700 | ${c.pull_request.reviewer_data_json | n}); |
|
701 | 701 | }, |
|
702 | 702 | |
|
703 | 703 | close: function(event) { |
|
704 | 704 | this.editButton.show(); |
|
705 | 705 | this.closeButton.hide(); |
|
706 | 706 | this.addButton.hide(); |
|
707 | 707 | this.removeButtons.css('visibility', 'hidden'); |
|
708 | 708 | // hide review rules |
|
709 | 709 | reviewersController.hideReviewRules() |
|
710 | 710 | } |
|
711 | 711 | }; |
|
712 | 712 | |
|
713 | 713 | PRDetails.init(); |
|
714 | 714 | ReviewersPanel.init(); |
|
715 | 715 | |
|
716 | 716 | showOutdated = function(self){ |
|
717 | 717 | $('.comment-inline.comment-outdated').show(); |
|
718 | 718 | $('.filediff-outdated').show(); |
|
719 | 719 | $('.showOutdatedComments').hide(); |
|
720 | 720 | $('.hideOutdatedComments').show(); |
|
721 | 721 | }; |
|
722 | 722 | |
|
723 | 723 | hideOutdated = function(self){ |
|
724 | 724 | $('.comment-inline.comment-outdated').hide(); |
|
725 | 725 | $('.filediff-outdated').hide(); |
|
726 | 726 | $('.hideOutdatedComments').hide(); |
|
727 | 727 | $('.showOutdatedComments').show(); |
|
728 | 728 | }; |
|
729 | 729 | |
|
730 | 730 | refreshMergeChecks = function(){ |
|
731 | 731 | var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}"; |
|
732 | 732 | $('.pull-request-merge').css('opacity', 0.3); |
|
733 | 733 | $('.action-buttons-extra').css('opacity', 0.3); |
|
734 | 734 | |
|
735 | 735 | $('.pull-request-merge').load( |
|
736 | 736 | loadUrl, function() { |
|
737 | 737 | $('.pull-request-merge').css('opacity', 1); |
|
738 | 738 | |
|
739 | 739 | $('.action-buttons-extra').css('opacity', 1); |
|
740 | 740 | injectCloseAction(); |
|
741 | 741 | } |
|
742 | 742 | ); |
|
743 | 743 | }; |
|
744 | 744 | |
|
745 | 745 | injectCloseAction = function() { |
|
746 | 746 | var closeAction = $('#close-pull-request-action').html(); |
|
747 | 747 | var $actionButtons = $('.action-buttons-extra'); |
|
748 | 748 | // clear the action before |
|
749 | 749 | $actionButtons.html(""); |
|
750 | 750 | $actionButtons.html(closeAction); |
|
751 | 751 | }; |
|
752 | 752 | |
|
753 | 753 | closePullRequest = function (status) { |
|
754 | 754 | // inject closing flag |
|
755 | 755 | $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">'); |
|
756 | 756 | $(generalCommentForm.statusChange).select2("val", status).trigger('change'); |
|
757 | 757 | $(generalCommentForm.submitForm).submit(); |
|
758 | 758 | }; |
|
759 | 759 | |
|
760 | 760 | $('#show-outdated-comments').on('click', function(e){ |
|
761 | 761 | var button = $(this); |
|
762 | 762 | var outdated = $('.comment-outdated'); |
|
763 | 763 | |
|
764 | 764 | if (button.html() === "(Show)") { |
|
765 | 765 | button.html("(Hide)"); |
|
766 | 766 | outdated.show(); |
|
767 | 767 | } else { |
|
768 | 768 | button.html("(Show)"); |
|
769 | 769 | outdated.hide(); |
|
770 | 770 | } |
|
771 | 771 | }); |
|
772 | 772 | |
|
773 | 773 | $('.show-inline-comments').on('change', function(e){ |
|
774 | 774 | var show = 'none'; |
|
775 | 775 | var target = e.currentTarget; |
|
776 | 776 | if(target.checked){ |
|
777 | 777 | show = '' |
|
778 | 778 | } |
|
779 | 779 | var boxid = $(target).attr('id_for'); |
|
780 | 780 | var comments = $('#{0} .inline-comments'.format(boxid)); |
|
781 | 781 | var fn_display = function(idx){ |
|
782 | 782 | $(this).css('display', show); |
|
783 | 783 | }; |
|
784 | 784 | $(comments).each(fn_display); |
|
785 | 785 | var btns = $('#{0} .inline-comments-button'.format(boxid)); |
|
786 | 786 | $(btns).each(fn_display); |
|
787 | 787 | }); |
|
788 | 788 | |
|
789 | 789 | $('#merge_pull_request_form').submit(function() { |
|
790 | 790 | if (!$('#merge_pull_request').attr('disabled')) { |
|
791 | 791 | $('#merge_pull_request').attr('disabled', 'disabled'); |
|
792 | 792 | } |
|
793 | 793 | return true; |
|
794 | 794 | }); |
|
795 | 795 | |
|
796 | 796 | $('#edit_pull_request').on('click', function(e){ |
|
797 | 797 | var title = $('#pr-title-input').val(); |
|
798 | 798 | var description = codeMirrorInstance.getValue(); |
|
799 | 799 | var renderer = $('#pr-renderer-input').val(); |
|
800 | 800 | editPullRequest( |
|
801 | 801 | "${c.repo_name}", "${c.pull_request.pull_request_id}", |
|
802 | 802 | title, description, renderer); |
|
803 | 803 | }); |
|
804 | 804 | |
|
805 | 805 | $('#update_pull_request').on('click', function(e){ |
|
806 | 806 | $(this).attr('disabled', 'disabled'); |
|
807 | 807 | $(this).addClass('disabled'); |
|
808 | 808 | $(this).html(_gettext('Saving...')); |
|
809 | 809 | reviewersController.updateReviewers( |
|
810 | 810 | "${c.repo_name}", "${c.pull_request.pull_request_id}"); |
|
811 | 811 | }); |
|
812 | 812 | |
|
813 | 813 | $('#update_commits').on('click', function(e){ |
|
814 | 814 | var isDisabled = !$(e.currentTarget).attr('disabled'); |
|
815 | 815 | $(e.currentTarget).attr('disabled', 'disabled'); |
|
816 | 816 | $(e.currentTarget).addClass('disabled'); |
|
817 | 817 | $(e.currentTarget).removeClass('btn-primary'); |
|
818 | 818 | $(e.currentTarget).text(_gettext('Updating...')); |
|
819 | 819 | if(isDisabled){ |
|
820 | 820 | updateCommits( |
|
821 | 821 | "${c.repo_name}", "${c.pull_request.pull_request_id}"); |
|
822 | 822 | } |
|
823 | 823 | }); |
|
824 | 824 | // fixing issue with caches on firefox |
|
825 | 825 | $('#update_commits').removeAttr("disabled"); |
|
826 | 826 | |
|
827 | 827 | $('.show-inline-comments').on('click', function(e){ |
|
828 | 828 | var boxid = $(this).attr('data-comment-id'); |
|
829 | 829 | var button = $(this); |
|
830 | 830 | |
|
831 | 831 | if(button.hasClass("comments-visible")) { |
|
832 | 832 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ |
|
833 | 833 | $(this).hide(); |
|
834 | 834 | }); |
|
835 | 835 | button.removeClass("comments-visible"); |
|
836 | 836 | } else { |
|
837 | 837 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ |
|
838 | 838 | $(this).show(); |
|
839 | 839 | }); |
|
840 | 840 | button.addClass("comments-visible"); |
|
841 | 841 | } |
|
842 | 842 | }); |
|
843 | 843 | |
|
844 | 844 | // register submit callback on commentForm form to track TODOs |
|
845 | 845 | window.commentFormGlobalSubmitSuccessCallback = function(){ |
|
846 | 846 | refreshMergeChecks(); |
|
847 | 847 | }; |
|
848 | 848 | // initial injection |
|
849 | 849 | injectCloseAction(); |
|
850 | 850 | |
|
851 | 851 | ReviewerAutoComplete('#user'); |
|
852 | 852 | |
|
853 | 853 | }) |
|
854 | 854 | </script> |
|
855 | 855 | |
|
856 | 856 | </div> |
|
857 | 857 | </div> |
|
858 | 858 | |
|
859 | 859 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now