Show More
@@ -1,581 +1,609 b'' | |||
|
1 | 1 | <%def name="diff_line_anchor(filename, line, type)"><% |
|
2 | 2 | return '%s_%s_%i' % (h.safeid(filename), type, line) |
|
3 | 3 | %></%def> |
|
4 | 4 | |
|
5 | 5 | <%def name="action_class(action)"><% |
|
6 | 6 | return { |
|
7 | 7 | '-': 'cb-deletion', |
|
8 | 8 | '+': 'cb-addition', |
|
9 | 9 | ' ': 'cb-context', |
|
10 | 10 | }.get(action, 'cb-empty') |
|
11 | 11 | %></%def> |
|
12 | 12 | |
|
13 | 13 | <%def name="op_class(op_id)"><% |
|
14 | 14 | return { |
|
15 | 15 | DEL_FILENODE: 'deletion', # file deleted |
|
16 | 16 | BIN_FILENODE: 'warning' # binary diff hidden |
|
17 | 17 | }.get(op_id, 'addition') |
|
18 | 18 | %></%def> |
|
19 | 19 | |
|
20 | 20 | <%def name="link_for(**kw)"><% |
|
21 | 21 | new_args = request.GET.mixed() |
|
22 | 22 | new_args.update(kw) |
|
23 | 23 | return h.url('', **new_args) |
|
24 | 24 | %></%def> |
|
25 | 25 | |
|
26 | 26 | <%def name="render_diffset(diffset, commit=None, |
|
27 | 27 | |
|
28 | 28 | # collapse all file diff entries when there are more than this amount of files in the diff |
|
29 | 29 | collapse_when_files_over=20, |
|
30 | 30 | |
|
31 | 31 | # collapse lines in the diff when more than this amount of lines changed in the file diff |
|
32 | 32 | lines_changed_limit=500, |
|
33 | 33 | |
|
34 | 34 | # add a ruler at to the output |
|
35 | 35 | ruler_at_chars=0, |
|
36 | 36 | |
|
37 | 37 | # show inline comments |
|
38 | 38 | use_comments=False, |
|
39 | 39 | |
|
40 | 40 | # disable new comments |
|
41 | 41 | disable_new_comments=False, |
|
42 | 42 | |
|
43 | 43 | )"> |
|
44 | 44 | |
|
45 | 45 | %if use_comments: |
|
46 | 46 | <div id="cb-comments-inline-container-template" class="js-template"> |
|
47 | 47 | ${inline_comments_container([])} |
|
48 | 48 | </div> |
|
49 | 49 | <div class="js-template" id="cb-comment-inline-form-template"> |
|
50 | 50 | <div class="comment-inline-form ac"> |
|
51 | 51 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
52 | 52 | ${h.form('#', method='get')} |
|
53 | 53 | <div id="edit-container_{1}" class="clearfix"> |
|
54 | 54 | <div class="comment-title pull-left"> |
|
55 | 55 | ${_('Create a comment on line {1}.')} |
|
56 | 56 | </div> |
|
57 | 57 | <div class="comment-help pull-right"> |
|
58 | 58 | ${(_('Comments parsed using %s syntax with %s support.') % ( |
|
59 | 59 | ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())), |
|
60 | 60 | ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user')) |
|
61 | 61 | ) |
|
62 | 62 | )|n |
|
63 | 63 | } |
|
64 | 64 | </div> |
|
65 | 65 | <div style="clear: both"></div> |
|
66 | 66 | <textarea id="text_{1}" name="text" class="comment-block-ta ac-input"></textarea> |
|
67 | 67 | </div> |
|
68 | 68 | <div id="preview-container_{1}" class="clearfix" style="display: none;"> |
|
69 | 69 | <div class="comment-help"> |
|
70 | 70 | ${_('Comment preview')} |
|
71 | 71 | </div> |
|
72 | 72 | <div id="preview-box_{1}" class="preview-box"></div> |
|
73 | 73 | </div> |
|
74 | 74 | <div class="comment-footer"> |
|
75 | 75 | <div class="action-buttons"> |
|
76 | 76 | <input type="hidden" name="f_path" value="{0}"> |
|
77 | 77 | <input type="hidden" name="line" value="{1}"> |
|
78 | 78 | <button id="preview-btn_{1}" class="btn btn-secondary">${_('Preview')}</button> |
|
79 | 79 | <button id="edit-btn_{1}" class="btn btn-secondary" style="display: none;">${_('Edit')}</button> |
|
80 | 80 | ${h.submit('save', _('Comment'), class_='btn btn-success save-inline-form')} |
|
81 | 81 | </div> |
|
82 | 82 | <div class="comment-button"> |
|
83 | 83 | <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);"> |
|
84 | 84 | ${_('Cancel')} |
|
85 | 85 | </button> |
|
86 | 86 | </div> |
|
87 | 87 | ${h.end_form()} |
|
88 | 88 | </div> |
|
89 | 89 | %else: |
|
90 | 90 | ${h.form('', class_='inline-form comment-form-login', method='get')} |
|
91 | 91 | <div class="pull-left"> |
|
92 | 92 | <div class="comment-help pull-right"> |
|
93 | 93 | ${_('You need to be logged in to comment.')} <a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a> |
|
94 | 94 | </div> |
|
95 | 95 | </div> |
|
96 | 96 | <div class="comment-button pull-right"> |
|
97 | 97 | <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);"> |
|
98 | 98 | ${_('Cancel')} |
|
99 | 99 | </button> |
|
100 | 100 | </div> |
|
101 | 101 | <div class="clearfix"></div> |
|
102 | 102 | ${h.end_form()} |
|
103 | 103 | %endif |
|
104 | 104 | </div> |
|
105 | 105 | </div> |
|
106 | 106 | |
|
107 | 107 | %endif |
|
108 | 108 | <% |
|
109 | 109 | collapse_all = len(diffset.files) > collapse_when_files_over |
|
110 | 110 | %> |
|
111 | 111 | |
|
112 | 112 | %if c.diffmode == 'sideside': |
|
113 | 113 | <style> |
|
114 | 114 | .wrapper { |
|
115 | 115 | max-width: 1600px !important; |
|
116 | 116 | } |
|
117 | 117 | </style> |
|
118 | 118 | %endif |
|
119 | 119 | %if ruler_at_chars: |
|
120 | 120 | <style> |
|
121 | 121 | .diff table.cb .cb-content:after { |
|
122 | 122 | content: ""; |
|
123 | 123 | border-left: 1px solid blue; |
|
124 | 124 | position: absolute; |
|
125 | 125 | top: 0; |
|
126 | 126 | height: 18px; |
|
127 | 127 | opacity: .2; |
|
128 | 128 | z-index: 10; |
|
129 | 129 | ## +5 to account for diff action (+/-) |
|
130 | 130 | left: ${ruler_at_chars + 5}ch; |
|
131 | 131 | </style> |
|
132 | 132 | %endif |
|
133 | 133 | <div class="diffset ${disable_new_comments and 'diffset-comments-disabled'}"> |
|
134 | 134 | <div class="diffset-heading ${diffset.limited_diff and 'diffset-heading-warning' or ''}"> |
|
135 | 135 | %if commit: |
|
136 | 136 | <div class="pull-right"> |
|
137 | 137 | <a class="btn tooltip" title="${_('Browse Files at revision {}').format(commit.raw_id)}" href="${h.url('files_home',repo_name=diffset.repo_name, revision=commit.raw_id, f_path='')}"> |
|
138 | 138 | ${_('Browse Files')} |
|
139 | 139 | </a> |
|
140 | 140 | </div> |
|
141 | 141 | %endif |
|
142 | 142 | <h2 class="clearinner"> |
|
143 | 143 | %if commit: |
|
144 | 144 | <a class="tooltip revision" title="${h.tooltip(commit.message)}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id)}">${'r%s:%s' % (commit.revision,h.short_id(commit.raw_id))}</a> - |
|
145 | 145 | ${h.age_component(commit.date)} - |
|
146 | 146 | %endif |
|
147 | 147 | %if diffset.limited_diff: |
|
148 | 148 | ${_('The requested commit is too big and content was truncated.')} |
|
149 | 149 | |
|
150 | 150 | ${ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}} |
|
151 | 151 | <a href="${link_for(fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a> |
|
152 | 152 | %else: |
|
153 | 153 | ${ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted', |
|
154 | 154 | '%(num)s files changed: %(linesadd)s inserted, %(linesdel)s deleted', diffset.changed_files) % {'num': diffset.changed_files, 'linesadd': diffset.lines_added, 'linesdel': diffset.lines_deleted}} |
|
155 | 155 | %endif |
|
156 | 156 | </h2> |
|
157 | 157 | </div> |
|
158 | 158 | |
|
159 | 159 | %if not diffset.files: |
|
160 | 160 | <p class="empty_data">${_('No files')}</p> |
|
161 | 161 | %endif |
|
162 | 162 | |
|
163 | 163 | <div class="filediffs"> |
|
164 | 164 | %for i, filediff in enumerate(diffset.files): |
|
165 | 165 | |
|
166 | 166 | <% |
|
167 | 167 | lines_changed = filediff['patch']['stats']['added'] + filediff['patch']['stats']['deleted'] |
|
168 | 168 | over_lines_changed_limit = lines_changed > lines_changed_limit |
|
169 | 169 | %> |
|
170 | 170 | <input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filediff)}" type="checkbox"> |
|
171 | 171 | <div |
|
172 | 172 | class="filediff" |
|
173 | 173 | data-f-path="${filediff['patch']['filename']}" |
|
174 | 174 | id="a_${h.FID('', filediff['patch']['filename'])}"> |
|
175 | 175 | <label for="filediff-collapse-${id(filediff)}" class="filediff-heading"> |
|
176 | 176 | <div class="filediff-collapse-indicator"></div> |
|
177 | 177 | ${diff_ops(filediff)} |
|
178 | 178 | </label> |
|
179 | 179 | ${diff_menu(filediff, use_comments=use_comments)} |
|
180 | 180 | <table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}"> |
|
181 | 181 | %if not filediff.hunks: |
|
182 | 182 | %for op_id, op_text in filediff['patch']['stats']['ops'].items(): |
|
183 | 183 | <tr> |
|
184 | 184 | <td class="cb-text cb-${op_class(op_id)}" ${c.diffmode == 'unified' and 'colspan=3' or 'colspan=4'}> |
|
185 | 185 | %if op_id == DEL_FILENODE: |
|
186 | 186 | ${_('File was deleted')} |
|
187 | 187 | %elif op_id == BIN_FILENODE: |
|
188 | 188 | ${_('Binary file hidden')} |
|
189 | 189 | %else: |
|
190 | 190 | ${op_text} |
|
191 | 191 | %endif |
|
192 | 192 | </td> |
|
193 | 193 | </tr> |
|
194 | 194 | %endfor |
|
195 | 195 | %endif |
|
196 | 196 | %if over_lines_changed_limit: |
|
197 | 197 | <tr class="cb-warning cb-collapser"> |
|
198 | 198 | <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}> |
|
199 | 199 | ${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)} |
|
200 | 200 | <a href="#" class="cb-expand" |
|
201 | 201 | onclick="$(this).closest('table').removeClass('cb-collapsed'); return false;">${_('Show them')} |
|
202 | 202 | </a> |
|
203 | 203 | <a href="#" class="cb-collapse" |
|
204 | 204 | onclick="$(this).closest('table').addClass('cb-collapsed'); return false;">${_('Hide them')} |
|
205 | 205 | </a> |
|
206 | 206 | </td> |
|
207 | 207 | </tr> |
|
208 | 208 | %endif |
|
209 | 209 | %if filediff.patch['is_limited_diff']: |
|
210 | 210 | <tr class="cb-warning cb-collapser"> |
|
211 | 211 | <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}> |
|
212 | 212 | ${_('The requested commit is too big and content was truncated.')} <a href="${link_for(fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a> |
|
213 | 213 | </td> |
|
214 | 214 | </tr> |
|
215 | 215 | %endif |
|
216 | 216 | %for hunk in filediff.hunks: |
|
217 | 217 | <tr class="cb-hunk"> |
|
218 | 218 | <td ${c.diffmode == 'unified' and 'colspan=3' or ''}> |
|
219 | 219 | ## TODO: dan: add ajax loading of more context here |
|
220 | 220 | ## <a href="#"> |
|
221 | 221 | <i class="icon-more"></i> |
|
222 | 222 | ## </a> |
|
223 | 223 | </td> |
|
224 | 224 | <td ${c.diffmode == 'sideside' and 'colspan=5' or ''}> |
|
225 | 225 | @@ |
|
226 | 226 | -${hunk.source_start},${hunk.source_length} |
|
227 | 227 | +${hunk.target_start},${hunk.target_length} |
|
228 | 228 | ${hunk.section_header} |
|
229 | 229 | </td> |
|
230 | 230 | </tr> |
|
231 | 231 | %if c.diffmode == 'unified': |
|
232 | 232 | ${render_hunk_lines_unified(hunk, use_comments=use_comments)} |
|
233 | 233 | %elif c.diffmode == 'sideside': |
|
234 | 234 | ${render_hunk_lines_sideside(hunk, use_comments=use_comments)} |
|
235 | 235 | %else: |
|
236 | 236 | <tr class="cb-line"> |
|
237 | 237 | <td>unknown diff mode</td> |
|
238 | 238 | </tr> |
|
239 | 239 | %endif |
|
240 | 240 | %endfor |
|
241 | ||
|
242 | % for lineno, comments in filediff.left_comments.items(): | |
|
243 | ||
|
244 | %if c.diffmode == 'unified': | |
|
245 | <tr class="cb-line"> | |
|
246 | <td class="cb-data cb-context"></td> | |
|
247 | <td class="cb-lineno cb-context"></td> | |
|
248 | <td class="cb-lineno cb-context"></td> | |
|
249 | <td class="cb-content cb-context"> | |
|
250 | ${inline_comments_container(comments)} | |
|
251 | </td> | |
|
252 | </tr> | |
|
253 | %elif c.diffmode == 'sideside': | |
|
254 | <tr class="cb-line"> | |
|
255 | <td class="cb-data cb-context"></td> | |
|
256 | <td class="cb-lineno cb-context"></td> | |
|
257 | <td class="cb-content cb-context"></td> | |
|
258 | ||
|
259 | <td class="cb-data cb-context"></td> | |
|
260 | <td class="cb-lineno cb-context"></td> | |
|
261 | <td class="cb-content cb-context"> | |
|
262 | ${inline_comments_container(comments)} | |
|
263 | </td> | |
|
264 | </tr> | |
|
265 | %endif | |
|
266 | ||
|
267 | % endfor | |
|
268 | ||
|
241 | 269 | </table> |
|
242 | 270 | </div> |
|
243 | 271 | %endfor |
|
244 | 272 | </div> |
|
245 | 273 | </div> |
|
246 | 274 | </%def> |
|
247 | 275 | |
|
248 | 276 | <%def name="diff_ops(filediff)"> |
|
249 | 277 | <% |
|
250 | 278 | stats = filediff['patch']['stats'] |
|
251 | 279 | from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \ |
|
252 | 280 | MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE |
|
253 | 281 | %> |
|
254 | 282 | <span class="pill"> |
|
255 | 283 | %if filediff.source_file_path and filediff.target_file_path: |
|
256 | 284 | %if filediff.source_file_path != filediff.target_file_path: # file was renamed |
|
257 | 285 | <strong>${filediff.target_file_path}</strong> β¬ <del>${filediff.source_file_path}</del> |
|
258 | 286 | %else: |
|
259 | 287 | ## file was modified |
|
260 | 288 | <strong>${filediff.source_file_path}</strong> |
|
261 | 289 | %endif |
|
262 | 290 | %else: |
|
263 | 291 | %if filediff.source_file_path: |
|
264 | 292 | ## file was deleted |
|
265 | 293 | <strong>${filediff.source_file_path}</strong> |
|
266 | 294 | %else: |
|
267 | 295 | ## file was added |
|
268 | 296 | <strong>${filediff.target_file_path}</strong> |
|
269 | 297 | %endif |
|
270 | 298 | %endif |
|
271 | 299 | </span> |
|
272 | 300 | <span class="pill-group" style="float: left"> |
|
273 | 301 | %if filediff.patch['is_limited_diff']: |
|
274 | 302 | <span class="pill tooltip" op="limited" title="The stats for this diff are not complete">limited diff</span> |
|
275 | 303 | %endif |
|
276 | 304 | %if RENAMED_FILENODE in stats['ops']: |
|
277 | 305 | <span class="pill" op="renamed">renamed</span> |
|
278 | 306 | %endif |
|
279 | 307 | |
|
280 | 308 | %if NEW_FILENODE in stats['ops']: |
|
281 | 309 | <span class="pill" op="created">created</span> |
|
282 | 310 | %if filediff['target_mode'].startswith('120'): |
|
283 | 311 | <span class="pill" op="symlink">symlink</span> |
|
284 | 312 | %else: |
|
285 | 313 | <span class="pill" op="mode">${nice_mode(filediff['target_mode'])}</span> |
|
286 | 314 | %endif |
|
287 | 315 | %endif |
|
288 | 316 | |
|
289 | 317 | %if DEL_FILENODE in stats['ops']: |
|
290 | 318 | <span class="pill" op="removed">removed</span> |
|
291 | 319 | %endif |
|
292 | 320 | |
|
293 | 321 | %if CHMOD_FILENODE in stats['ops']: |
|
294 | 322 | <span class="pill" op="mode"> |
|
295 | 323 | ${nice_mode(filediff['source_mode'])} β‘ ${nice_mode(filediff['target_mode'])} |
|
296 | 324 | </span> |
|
297 | 325 | %endif |
|
298 | 326 | </span> |
|
299 | 327 | |
|
300 | 328 | <a class="pill filediff-anchor" href="#a_${h.FID('', filediff.patch['filename'])}">ΒΆ</a> |
|
301 | 329 | |
|
302 | 330 | <span class="pill-group" style="float: right"> |
|
303 | 331 | %if BIN_FILENODE in stats['ops']: |
|
304 | 332 | <span class="pill" op="binary">binary</span> |
|
305 | 333 | %if MOD_FILENODE in stats['ops']: |
|
306 | 334 | <span class="pill" op="modified">modified</span> |
|
307 | 335 | %endif |
|
308 | 336 | %endif |
|
309 | 337 | %if stats['added']: |
|
310 | 338 | <span class="pill" op="added">+${stats['added']}</span> |
|
311 | 339 | %endif |
|
312 | 340 | %if stats['deleted']: |
|
313 | 341 | <span class="pill" op="deleted">-${stats['deleted']}</span> |
|
314 | 342 | %endif |
|
315 | 343 | </span> |
|
316 | 344 | |
|
317 | 345 | </%def> |
|
318 | 346 | |
|
319 | 347 | <%def name="nice_mode(filemode)"> |
|
320 | 348 | ${filemode.startswith('100') and filemode[3:] or filemode} |
|
321 | 349 | </%def> |
|
322 | 350 | |
|
323 | 351 | <%def name="diff_menu(filediff, use_comments=False)"> |
|
324 | 352 | <div class="filediff-menu"> |
|
325 | 353 | %if filediff.diffset.source_ref: |
|
326 | 354 | %if filediff.patch['operation'] in ['D', 'M']: |
|
327 | 355 | <a |
|
328 | 356 | class="tooltip" |
|
329 | 357 | href="${h.url('files_home',repo_name=filediff.diffset.repo_name,f_path=filediff.source_file_path,revision=filediff.diffset.source_ref)}" |
|
330 | 358 | title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}" |
|
331 | 359 | > |
|
332 | 360 | ${_('Show file before')} |
|
333 | 361 | </a> |
|
334 | 362 | %else: |
|
335 | 363 | <span |
|
336 | 364 | class="tooltip" |
|
337 | 365 | title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}" |
|
338 | 366 | > |
|
339 | 367 | ${_('Show file before')} |
|
340 | 368 | </span> |
|
341 | 369 | %endif |
|
342 | 370 | %if filediff.patch['operation'] in ['A', 'M']: |
|
343 | 371 | <a |
|
344 | 372 | class="tooltip" |
|
345 | 373 | href="${h.url('files_home',repo_name=filediff.diffset.source_repo_name,f_path=filediff.target_file_path,revision=filediff.diffset.target_ref)}" |
|
346 | 374 | title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}" |
|
347 | 375 | > |
|
348 | 376 | ${_('Show file after')} |
|
349 | 377 | </a> |
|
350 | 378 | %else: |
|
351 | 379 | <span |
|
352 | 380 | class="tooltip" |
|
353 | 381 | title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}" |
|
354 | 382 | > |
|
355 | 383 | ${_('Show file after')} |
|
356 | 384 | </span> |
|
357 | 385 | %endif |
|
358 | 386 | <a |
|
359 | 387 | class="tooltip" |
|
360 | 388 | title="${h.tooltip(_('Raw diff'))}" |
|
361 | 389 | href="${h.url('files_diff_home',repo_name=filediff.diffset.repo_name,f_path=filediff.target_file_path,diff2=filediff.diffset.target_ref,diff1=filediff.diffset.source_ref,diff='raw')}" |
|
362 | 390 | > |
|
363 | 391 | ${_('Raw diff')} |
|
364 | 392 | </a> |
|
365 | 393 | <a |
|
366 | 394 | class="tooltip" |
|
367 | 395 | title="${h.tooltip(_('Download diff'))}" |
|
368 | 396 | href="${h.url('files_diff_home',repo_name=filediff.diffset.repo_name,f_path=filediff.target_file_path,diff2=filediff.diffset.target_ref,diff1=filediff.diffset.source_ref,diff='download')}" |
|
369 | 397 | > |
|
370 | 398 | ${_('Download diff')} |
|
371 | 399 | </a> |
|
372 | 400 | |
|
373 | 401 | ## TODO: dan: refactor ignorews_url and context_url into the diff renderer same as diffmode=unified/sideside. Also use ajax to load more context (by clicking hunks) |
|
374 | 402 | %if hasattr(c, 'ignorews_url'): |
|
375 | 403 | ${c.ignorews_url(request.GET, h.FID('', filediff['patch']['filename']))} |
|
376 | 404 | %endif |
|
377 | 405 | %if hasattr(c, 'context_url'): |
|
378 | 406 | ${c.context_url(request.GET, h.FID('', filediff['patch']['filename']))} |
|
379 | 407 | %endif |
|
380 | 408 | |
|
381 | 409 | |
|
382 | 410 | %if use_comments: |
|
383 | 411 | <a href="#" onclick="return Rhodecode.comments.toggleComments(this);"> |
|
384 | 412 | <span class="show-comment-button">${_('Show comments')}</span><span class="hide-comment-button">${_('Hide comments')}</span> |
|
385 | 413 | </a> |
|
386 | 414 | %endif |
|
387 | 415 | %endif |
|
388 | 416 | </div> |
|
389 | 417 | </%def> |
|
390 | 418 | |
|
391 | 419 | |
|
392 | 420 | <%namespace name="commentblock" file="/changeset/changeset_file_comment.html"/> |
|
393 | 421 | <%def name="inline_comments_container(comments)"> |
|
394 | 422 | <div class="inline-comments"> |
|
395 | 423 | %for comment in comments: |
|
396 | 424 | ${commentblock.comment_block(comment, inline=True)} |
|
397 | 425 | %endfor |
|
398 | 426 | |
|
399 | 427 | <span onclick="return Rhodecode.comments.createComment(this)" |
|
400 | 428 | class="btn btn-secondary cb-comment-add-button ${'comment-outdated' if comments and comments[-1].outdated else ''}" |
|
401 | 429 | style="${'display: none;' if comments and comments[-1].outdated else ''}"> |
|
402 | 430 | ${_('Add another comment')} |
|
403 | 431 | </span> |
|
404 | 432 | |
|
405 | 433 | </div> |
|
406 | 434 | </%def> |
|
407 | 435 | |
|
408 | 436 | |
|
409 | 437 | <%def name="render_hunk_lines_sideside(hunk, use_comments=False)"> |
|
410 | 438 | %for i, line in enumerate(hunk.sideside): |
|
411 | 439 | <% |
|
412 | 440 | old_line_anchor, new_line_anchor = None, None |
|
413 | 441 | if line.original.lineno: |
|
414 | 442 | old_line_anchor = diff_line_anchor(hunk.filediff.source_file_path, line.original.lineno, 'o') |
|
415 | 443 | if line.modified.lineno: |
|
416 | 444 | new_line_anchor = diff_line_anchor(hunk.filediff.target_file_path, line.modified.lineno, 'n') |
|
417 | 445 | %> |
|
418 | 446 | |
|
419 | 447 | <tr class="cb-line"> |
|
420 | 448 | <td class="cb-data ${action_class(line.original.action)}" |
|
421 | 449 | data-line-number="${line.original.lineno}" |
|
422 | 450 | > |
|
423 | 451 | <div> |
|
424 | 452 | %if line.original.comments: |
|
425 | 453 | <i class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i> |
|
426 | 454 | %endif |
|
427 | 455 | </div> |
|
428 | 456 | </td> |
|
429 | 457 | <td class="cb-lineno ${action_class(line.original.action)}" |
|
430 | 458 | data-line-number="${line.original.lineno}" |
|
431 | 459 | %if old_line_anchor: |
|
432 | 460 | id="${old_line_anchor}" |
|
433 | 461 | %endif |
|
434 | 462 | > |
|
435 | 463 | %if line.original.lineno: |
|
436 | 464 | <a name="${old_line_anchor}" href="#${old_line_anchor}">${line.original.lineno}</a> |
|
437 | 465 | %endif |
|
438 | 466 | </td> |
|
439 | 467 | <td class="cb-content ${action_class(line.original.action)}" |
|
440 | 468 | data-line-number="o${line.original.lineno}" |
|
441 | 469 | > |
|
442 | 470 | %if use_comments and line.original.lineno: |
|
443 | 471 | ${render_add_comment_button()} |
|
444 | 472 | %endif |
|
445 | 473 | <span class="cb-code">${line.original.action} ${line.original.content or '' | n}</span> |
|
446 | 474 | %if use_comments and line.original.lineno and line.original.comments: |
|
447 | 475 | ${inline_comments_container(line.original.comments)} |
|
448 | 476 | %endif |
|
449 | 477 | </td> |
|
450 | 478 | <td class="cb-data ${action_class(line.modified.action)}" |
|
451 | 479 | data-line-number="${line.modified.lineno}" |
|
452 | 480 | > |
|
453 | 481 | <div> |
|
454 | 482 | %if line.modified.comments: |
|
455 | 483 | <i class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i> |
|
456 | 484 | %endif |
|
457 | 485 | </div> |
|
458 | 486 | </td> |
|
459 | 487 | <td class="cb-lineno ${action_class(line.modified.action)}" |
|
460 | 488 | data-line-number="${line.modified.lineno}" |
|
461 | 489 | %if new_line_anchor: |
|
462 | 490 | id="${new_line_anchor}" |
|
463 | 491 | %endif |
|
464 | 492 | > |
|
465 | 493 | %if line.modified.lineno: |
|
466 | 494 | <a name="${new_line_anchor}" href="#${new_line_anchor}">${line.modified.lineno}</a> |
|
467 | 495 | %endif |
|
468 | 496 | </td> |
|
469 | 497 | <td class="cb-content ${action_class(line.modified.action)}" |
|
470 | 498 | data-line-number="n${line.modified.lineno}" |
|
471 | 499 | > |
|
472 | 500 | %if use_comments and line.modified.lineno: |
|
473 | 501 | ${render_add_comment_button()} |
|
474 | 502 | %endif |
|
475 | 503 | <span class="cb-code">${line.modified.action} ${line.modified.content or '' | n}</span> |
|
476 | 504 | %if use_comments and line.modified.lineno and line.modified.comments: |
|
477 | 505 | ${inline_comments_container(line.modified.comments)} |
|
478 | 506 | %endif |
|
479 | 507 | </td> |
|
480 | 508 | </tr> |
|
481 | 509 | %endfor |
|
482 | 510 | </%def> |
|
483 | 511 | |
|
484 | 512 | |
|
485 | 513 | <%def name="render_hunk_lines_unified(hunk, use_comments=False)"> |
|
486 | 514 | %for old_line_no, new_line_no, action, content, comments in hunk.unified: |
|
487 | 515 | <% |
|
488 | 516 | old_line_anchor, new_line_anchor = None, None |
|
489 | 517 | if old_line_no: |
|
490 | 518 | old_line_anchor = diff_line_anchor(hunk.filediff.source_file_path, old_line_no, 'o') |
|
491 | 519 | if new_line_no: |
|
492 | 520 | new_line_anchor = diff_line_anchor(hunk.filediff.target_file_path, new_line_no, 'n') |
|
493 | 521 | %> |
|
494 | 522 | <tr class="cb-line"> |
|
495 | 523 | <td class="cb-data ${action_class(action)}"> |
|
496 | 524 | <div> |
|
497 | 525 | %if comments: |
|
498 | 526 | <i class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i> |
|
499 | 527 | %endif |
|
500 | 528 | </div> |
|
501 | 529 | </td> |
|
502 | 530 | <td class="cb-lineno ${action_class(action)}" |
|
503 | 531 | data-line-number="${old_line_no}" |
|
504 | 532 | %if old_line_anchor: |
|
505 | 533 | id="${old_line_anchor}" |
|
506 | 534 | %endif |
|
507 | 535 | > |
|
508 | 536 | %if old_line_anchor: |
|
509 | 537 | <a name="${old_line_anchor}" href="#${old_line_anchor}">${old_line_no}</a> |
|
510 | 538 | %endif |
|
511 | 539 | </td> |
|
512 | 540 | <td class="cb-lineno ${action_class(action)}" |
|
513 | 541 | data-line-number="${new_line_no}" |
|
514 | 542 | %if new_line_anchor: |
|
515 | 543 | id="${new_line_anchor}" |
|
516 | 544 | %endif |
|
517 | 545 | > |
|
518 | 546 | %if new_line_anchor: |
|
519 | 547 | <a name="${new_line_anchor}" href="#${new_line_anchor}">${new_line_no}</a> |
|
520 | 548 | %endif |
|
521 | 549 | </td> |
|
522 | 550 | <td class="cb-content ${action_class(action)}" |
|
523 | 551 | data-line-number="${new_line_no and 'n' or 'o'}${new_line_no or old_line_no}" |
|
524 | 552 | > |
|
525 | 553 | %if use_comments: |
|
526 | 554 | ${render_add_comment_button()} |
|
527 | 555 | %endif |
|
528 | 556 | <span class="cb-code">${action} ${content or '' | n}</span> |
|
529 | 557 | %if use_comments and comments: |
|
530 | 558 | ${inline_comments_container(comments)} |
|
531 | 559 | %endif |
|
532 | 560 | </td> |
|
533 | 561 | </tr> |
|
534 | 562 | %endfor |
|
535 | 563 | </%def> |
|
536 | 564 | |
|
537 | 565 | <%def name="render_add_comment_button()"> |
|
538 | 566 | <button |
|
539 | 567 | class="btn btn-small btn-primary cb-comment-box-opener" |
|
540 | 568 | onclick="return Rhodecode.comments.createComment(this)" |
|
541 | 569 | ><span>+</span></button> |
|
542 | 570 | </%def> |
|
543 | 571 | |
|
544 | 572 | <%def name="render_diffset_menu()"> |
|
545 | 573 | |
|
546 | 574 | <div class="diffset-menu clearinner"> |
|
547 | 575 | <div class="pull-right"> |
|
548 | 576 | <div class="btn-group"> |
|
549 | 577 | |
|
550 | 578 | <a |
|
551 | 579 | class="btn ${c.diffmode == 'sideside' and 'btn-primary'} tooltip" |
|
552 | 580 | title="${_('View side by side')}" |
|
553 | 581 | href="${h.url_replace(diffmode='sideside')}"> |
|
554 | 582 | <span>${_('Side by Side')}</span> |
|
555 | 583 | </a> |
|
556 | 584 | <a |
|
557 | 585 | class="btn ${c.diffmode == 'unified' and 'btn-primary'} tooltip" |
|
558 | 586 | title="${_('View unified')}" href="${h.url_replace(diffmode='unified')}"> |
|
559 | 587 | <span>${_('Unified')}</span> |
|
560 | 588 | </a> |
|
561 | 589 | </div> |
|
562 | 590 | </div> |
|
563 | 591 | |
|
564 | 592 | <div class="pull-left"> |
|
565 | 593 | <div class="btn-group"> |
|
566 | 594 | <a |
|
567 | 595 | class="btn" |
|
568 | 596 | href="#" |
|
569 | 597 | onclick="$('input[class=filediff-collapse-state]').prop('checked', false); return false">${_('Expand All Files')}</a> |
|
570 | 598 | <a |
|
571 | 599 | class="btn" |
|
572 | 600 | href="#" |
|
573 | 601 | onclick="$('input[class=filediff-collapse-state]').prop('checked', true); return false">${_('Collapse All Files')}</a> |
|
574 | 602 | <a |
|
575 | 603 | class="btn" |
|
576 | 604 | href="#" |
|
577 | 605 | onclick="return Rhodecode.comments.toggleWideMode(this)">${_('Wide Mode Diff')}</a> |
|
578 | 606 | </div> |
|
579 | 607 | </div> |
|
580 | 608 | </div> |
|
581 | 609 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now