Show More
@@ -1,569 +1,569 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 | lines_changed = filediff['patch']['stats']['added'] + filediff['patch']['stats']['deleted'] |
|
167 | 167 | over_lines_changed_limit = lines_changed > lines_changed_limit |
|
168 | 168 | %> |
|
169 | 169 | <input ${collapse_all and 'checked' or ''} class="filediff-collapse-state" id="filediff-collapse-${id(filediff)}" type="checkbox"> |
|
170 | 170 | <div |
|
171 | 171 | class="filediff" |
|
172 | 172 | data-f-path="${filediff['patch']['filename']}" |
|
173 | 173 | id="a_${h.FID('', filediff['patch']['filename'])}"> |
|
174 | 174 | <label for="filediff-collapse-${id(filediff)}" class="filediff-heading"> |
|
175 | 175 | <div class="filediff-collapse-indicator"></div> |
|
176 | 176 | ${diff_ops(filediff)} |
|
177 | 177 | </label> |
|
178 | 178 | ${diff_menu(filediff, use_comments=use_comments)} |
|
179 | 179 | <table class="cb cb-diff-${c.diffmode} code-highlight ${over_lines_changed_limit and 'cb-collapsed' or ''}"> |
|
180 | 180 | %if not filediff.hunks: |
|
181 | 181 | %for op_id, op_text in filediff['patch']['stats']['ops'].items(): |
|
182 | 182 | <tr> |
|
183 | 183 | <td class="cb-text cb-${op_class(op_id)}" ${c.diffmode == 'unified' and 'colspan=3' or 'colspan=4'}> |
|
184 | 184 | %if op_id == DEL_FILENODE: |
|
185 | 185 | ${_('File was deleted')} |
|
186 | 186 | %elif op_id == BIN_FILENODE: |
|
187 | 187 | ${_('Binary file hidden')} |
|
188 | 188 | %else: |
|
189 | 189 | ${op_text} |
|
190 | 190 | %endif |
|
191 | 191 | </td> |
|
192 | 192 | </tr> |
|
193 | 193 | %endfor |
|
194 | 194 | %endif |
|
195 | 195 | %if over_lines_changed_limit: |
|
196 | 196 | <tr class="cb-warning cb-collapser"> |
|
197 |
<td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan= |
|
|
197 | <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}> | |
|
198 | 198 | ${_('This diff has been collapsed as it changes many lines, (%i lines changed)' % lines_changed)} |
|
199 | 199 | <a href="#" class="cb-expand" |
|
200 | 200 | onclick="$(this).closest('table').removeClass('cb-collapsed'); return false;">${_('Show them')} |
|
201 | 201 | </a> |
|
202 | 202 | <a href="#" class="cb-collapse" |
|
203 | 203 | onclick="$(this).closest('table').addClass('cb-collapsed'); return false;">${_('Hide them')} |
|
204 | 204 | </a> |
|
205 | 205 | </td> |
|
206 | 206 | </tr> |
|
207 | 207 | %endif |
|
208 | 208 | %if filediff.patch['is_limited_diff']: |
|
209 | 209 | <tr class="cb-warning cb-collapser"> |
|
210 |
<td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan= |
|
|
210 | <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}> | |
|
211 | 211 | ${_('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> |
|
212 | 212 | </td> |
|
213 | 213 | </tr> |
|
214 | 214 | %endif |
|
215 | 215 | %for hunk in filediff.hunks: |
|
216 | 216 | <tr class="cb-hunk"> |
|
217 | 217 | <td ${c.diffmode == 'unified' and 'colspan=3' or ''}> |
|
218 | 218 | ## TODO: dan: add ajax loading of more context here |
|
219 | 219 | ## <a href="#"> |
|
220 | 220 | <i class="icon-more"></i> |
|
221 | 221 | ## </a> |
|
222 | 222 | </td> |
|
223 | 223 | <td ${c.diffmode == 'sideside' and 'colspan=5' or ''}> |
|
224 | 224 | @@ |
|
225 | 225 | -${hunk.source_start},${hunk.source_length} |
|
226 | 226 | +${hunk.target_start},${hunk.target_length} |
|
227 | 227 | ${hunk.section_header} |
|
228 | 228 | </td> |
|
229 | 229 | </tr> |
|
230 | 230 | %if c.diffmode == 'unified': |
|
231 | 231 | ${render_hunk_lines_unified(hunk, use_comments=use_comments)} |
|
232 | 232 | %elif c.diffmode == 'sideside': |
|
233 | 233 | ${render_hunk_lines_sideside(hunk, use_comments=use_comments)} |
|
234 | 234 | %else: |
|
235 | 235 | <tr class="cb-line"> |
|
236 | 236 | <td>unknown diff mode</td> |
|
237 | 237 | </tr> |
|
238 | 238 | %endif |
|
239 | 239 | %endfor |
|
240 | 240 | </table> |
|
241 | 241 | </div> |
|
242 | 242 | %endfor |
|
243 | 243 | </div> |
|
244 | 244 | </div> |
|
245 | 245 | </%def> |
|
246 | 246 | |
|
247 | 247 | <%def name="diff_ops(filediff)"> |
|
248 | 248 | <% |
|
249 | 249 | stats = filediff['patch']['stats'] |
|
250 | 250 | from rhodecode.lib.diffs import NEW_FILENODE, DEL_FILENODE, \ |
|
251 | 251 | MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE |
|
252 | 252 | %> |
|
253 | 253 | <span class="pill"> |
|
254 | 254 | %if filediff.source_file_path and filediff.target_file_path: |
|
255 | 255 | %if filediff.source_file_path != filediff.target_file_path: # file was renamed |
|
256 | 256 | <strong>${filediff.target_file_path}</strong> β¬ <del>${filediff.source_file_path}</del> |
|
257 | 257 | %else: |
|
258 | 258 | ## file was modified |
|
259 | 259 | <strong>${filediff.source_file_path}</strong> |
|
260 | 260 | %endif |
|
261 | 261 | %else: |
|
262 | 262 | %if filediff.source_file_path: |
|
263 | 263 | ## file was deleted |
|
264 | 264 | <strong>${filediff.source_file_path}</strong> |
|
265 | 265 | %else: |
|
266 | 266 | ## file was added |
|
267 | 267 | <strong>${filediff.target_file_path}</strong> |
|
268 | 268 | %endif |
|
269 | 269 | %endif |
|
270 | 270 | </span> |
|
271 | 271 | <span class="pill-group" style="float: left"> |
|
272 | 272 | %if filediff.patch['is_limited_diff']: |
|
273 | 273 | <span class="pill tooltip" op="limited" title="The stats for this diff are not complete">limited diff</span> |
|
274 | 274 | %endif |
|
275 | 275 | %if RENAMED_FILENODE in stats['ops']: |
|
276 | 276 | <span class="pill" op="renamed">renamed</span> |
|
277 | 277 | %endif |
|
278 | 278 | |
|
279 | 279 | %if NEW_FILENODE in stats['ops']: |
|
280 | 280 | <span class="pill" op="created">created</span> |
|
281 | 281 | %if filediff['target_mode'].startswith('120'): |
|
282 | 282 | <span class="pill" op="symlink">symlink</span> |
|
283 | 283 | %else: |
|
284 | 284 | <span class="pill" op="mode">${nice_mode(filediff['target_mode'])}</span> |
|
285 | 285 | %endif |
|
286 | 286 | %endif |
|
287 | 287 | |
|
288 | 288 | %if DEL_FILENODE in stats['ops']: |
|
289 | 289 | <span class="pill" op="removed">removed</span> |
|
290 | 290 | %endif |
|
291 | 291 | |
|
292 | 292 | %if CHMOD_FILENODE in stats['ops']: |
|
293 | 293 | <span class="pill" op="mode"> |
|
294 | 294 | ${nice_mode(filediff['source_mode'])} β‘ ${nice_mode(filediff['target_mode'])} |
|
295 | 295 | </span> |
|
296 | 296 | %endif |
|
297 | 297 | </span> |
|
298 | 298 | |
|
299 | 299 | <a class="pill filediff-anchor" href="#a_${h.FID('', filediff.patch['filename'])}">ΒΆ</a> |
|
300 | 300 | |
|
301 | 301 | <span class="pill-group" style="float: right"> |
|
302 | 302 | %if BIN_FILENODE in stats['ops']: |
|
303 | 303 | <span class="pill" op="binary">binary</span> |
|
304 | 304 | %if MOD_FILENODE in stats['ops']: |
|
305 | 305 | <span class="pill" op="modified">modified</span> |
|
306 | 306 | %endif |
|
307 | 307 | %endif |
|
308 | 308 | %if stats['added']: |
|
309 | 309 | <span class="pill" op="added">+${stats['added']}</span> |
|
310 | 310 | %endif |
|
311 | 311 | %if stats['deleted']: |
|
312 | 312 | <span class="pill" op="deleted">-${stats['deleted']}</span> |
|
313 | 313 | %endif |
|
314 | 314 | </span> |
|
315 | 315 | |
|
316 | 316 | </%def> |
|
317 | 317 | |
|
318 | 318 | <%def name="nice_mode(filemode)"> |
|
319 | 319 | ${filemode.startswith('100') and filemode[3:] or filemode} |
|
320 | 320 | </%def> |
|
321 | 321 | |
|
322 | 322 | <%def name="diff_menu(filediff, use_comments=False)"> |
|
323 | 323 | <div class="filediff-menu"> |
|
324 | 324 | %if filediff.diffset.source_ref: |
|
325 | 325 | %if filediff.patch['operation'] in ['D', 'M']: |
|
326 | 326 | <a |
|
327 | 327 | class="tooltip" |
|
328 | 328 | href="${h.url('files_home',repo_name=filediff.diffset.repo_name,f_path=filediff.source_file_path,revision=filediff.diffset.source_ref)}" |
|
329 | 329 | title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}" |
|
330 | 330 | > |
|
331 | 331 | ${_('Show file before')} |
|
332 | 332 | </a> |
|
333 | 333 | %else: |
|
334 | 334 | <span |
|
335 | 335 | class="tooltip" |
|
336 | 336 | title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.source_ref[:12]})}" |
|
337 | 337 | > |
|
338 | 338 | ${_('Show file before')} |
|
339 | 339 | </span> |
|
340 | 340 | %endif |
|
341 | 341 | %if filediff.patch['operation'] in ['A', 'M']: |
|
342 | 342 | <a |
|
343 | 343 | class="tooltip" |
|
344 | 344 | href="${h.url('files_home',repo_name=filediff.diffset.repo_name,f_path=filediff.target_file_path,revision=filediff.diffset.target_ref)}" |
|
345 | 345 | title="${h.tooltip(_('Show file at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}" |
|
346 | 346 | > |
|
347 | 347 | ${_('Show file after')} |
|
348 | 348 | </a> |
|
349 | 349 | %else: |
|
350 | 350 | <span |
|
351 | 351 | class="tooltip" |
|
352 | 352 | title="${h.tooltip(_('File no longer present at commit: %(commit_id)s') % {'commit_id': filediff.diffset.target_ref[:12]})}" |
|
353 | 353 | > |
|
354 | 354 | ${_('Show file after')} |
|
355 | 355 | </span> |
|
356 | 356 | %endif |
|
357 | 357 | <a |
|
358 | 358 | class="tooltip" |
|
359 | 359 | title="${h.tooltip(_('Raw diff'))}" |
|
360 | 360 | 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')}" |
|
361 | 361 | > |
|
362 | 362 | ${_('Raw diff')} |
|
363 | 363 | </a> |
|
364 | 364 | <a |
|
365 | 365 | class="tooltip" |
|
366 | 366 | title="${h.tooltip(_('Download diff'))}" |
|
367 | 367 | 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')}" |
|
368 | 368 | > |
|
369 | 369 | ${_('Download diff')} |
|
370 | 370 | </a> |
|
371 | 371 | |
|
372 | 372 | ## 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) |
|
373 | 373 | %if hasattr(c, 'ignorews_url'): |
|
374 | 374 | ${c.ignorews_url(request.GET, h.FID('', filediff['patch']['filename']))} |
|
375 | 375 | %endif |
|
376 | 376 | %if hasattr(c, 'context_url'): |
|
377 | 377 | ${c.context_url(request.GET, h.FID('', filediff['patch']['filename']))} |
|
378 | 378 | %endif |
|
379 | 379 | |
|
380 | 380 | |
|
381 | 381 | %if use_comments: |
|
382 | 382 | <a href="#" onclick="return Rhodecode.comments.toggleComments(this);"> |
|
383 | 383 | <span class="show-comment-button">${_('Show comments')}</span><span class="hide-comment-button">${_('Hide comments')}</span> |
|
384 | 384 | </a> |
|
385 | 385 | %endif |
|
386 | 386 | %endif |
|
387 | 387 | </div> |
|
388 | 388 | </%def> |
|
389 | 389 | |
|
390 | 390 | |
|
391 | 391 | <%namespace name="commentblock" file="/changeset/changeset_file_comment.html"/> |
|
392 | 392 | <%def name="inline_comments_container(comments)"> |
|
393 | 393 | <div class="inline-comments"> |
|
394 | 394 | %for comment in comments: |
|
395 | 395 | ${commentblock.comment_block(comment, inline=True)} |
|
396 | 396 | %endfor |
|
397 | 397 | <span onclick="return Rhodecode.comments.createComment(this)" |
|
398 | 398 | class="btn btn-secondary cb-comment-add-button"> |
|
399 | 399 | ${_('Add another comment')} |
|
400 | 400 | </span> |
|
401 | 401 | </div> |
|
402 | 402 | </%def> |
|
403 | 403 | |
|
404 | 404 | |
|
405 | 405 | <%def name="render_hunk_lines_sideside(hunk, use_comments=False)"> |
|
406 | 406 | %for i, line in enumerate(hunk.sideside): |
|
407 | 407 | <% |
|
408 | 408 | old_line_anchor, new_line_anchor = None, None |
|
409 | 409 | if line.original.lineno: |
|
410 | 410 | old_line_anchor = diff_line_anchor(hunk.filediff.source_file_path, line.original.lineno, 'o') |
|
411 | 411 | if line.modified.lineno: |
|
412 | 412 | new_line_anchor = diff_line_anchor(hunk.filediff.target_file_path, line.modified.lineno, 'n') |
|
413 | 413 | %> |
|
414 | 414 | <tr class="cb-line"> |
|
415 | 415 | <td class="cb-data ${action_class(line.original.action)}" |
|
416 | 416 | data-line-number="${line.original.lineno}" |
|
417 | 417 | > |
|
418 | 418 | <div> |
|
419 | 419 | %if line.original.comments: |
|
420 | 420 | <i class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i> |
|
421 | 421 | %endif |
|
422 | 422 | </div> |
|
423 | 423 | </td> |
|
424 | 424 | <td class="cb-lineno ${action_class(line.original.action)}" |
|
425 | 425 | data-line-number="${line.original.lineno}" |
|
426 | 426 | %if old_line_anchor: |
|
427 | 427 | id="${old_line_anchor}" |
|
428 | 428 | %endif |
|
429 | 429 | > |
|
430 | 430 | %if line.original.lineno: |
|
431 | 431 | <a name="${old_line_anchor}" href="#${old_line_anchor}">${line.original.lineno}</a> |
|
432 | 432 | %endif |
|
433 | 433 | </td> |
|
434 | 434 | <td class="cb-content ${action_class(line.original.action)}" |
|
435 | 435 | data-line-number="o${line.original.lineno}" |
|
436 | 436 | > |
|
437 | 437 | %if use_comments and line.original.lineno: |
|
438 | 438 | ${render_add_comment_button()} |
|
439 | 439 | %endif |
|
440 | 440 | <span class="cb-code">${line.original.action} ${line.original.content or '' | n}</span> |
|
441 | 441 | %if use_comments and line.original.lineno and line.original.comments: |
|
442 | 442 | ${inline_comments_container(line.original.comments)} |
|
443 | 443 | %endif |
|
444 | 444 | </td> |
|
445 | 445 | <td class="cb-data ${action_class(line.modified.action)}" |
|
446 | 446 | data-line-number="${line.modified.lineno}" |
|
447 | 447 | > |
|
448 | 448 | <div> |
|
449 | 449 | %if line.modified.comments: |
|
450 | 450 | <i class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i> |
|
451 | 451 | %endif |
|
452 | 452 | </div> |
|
453 | 453 | </td> |
|
454 | 454 | <td class="cb-lineno ${action_class(line.modified.action)}" |
|
455 | 455 | data-line-number="${line.modified.lineno}" |
|
456 | 456 | %if new_line_anchor: |
|
457 | 457 | id="${new_line_anchor}" |
|
458 | 458 | %endif |
|
459 | 459 | > |
|
460 | 460 | %if line.modified.lineno: |
|
461 | 461 | <a name="${new_line_anchor}" href="#${new_line_anchor}">${line.modified.lineno}</a> |
|
462 | 462 | %endif |
|
463 | 463 | </td> |
|
464 | 464 | <td class="cb-content ${action_class(line.modified.action)}" |
|
465 | 465 | data-line-number="n${line.modified.lineno}" |
|
466 | 466 | > |
|
467 | 467 | %if use_comments and line.modified.lineno: |
|
468 | 468 | ${render_add_comment_button()} |
|
469 | 469 | %endif |
|
470 | 470 | <span class="cb-code">${line.modified.action} ${line.modified.content or '' | n}</span> |
|
471 | 471 | %if use_comments and line.modified.lineno and line.modified.comments: |
|
472 | 472 | ${inline_comments_container(line.modified.comments)} |
|
473 | 473 | %endif |
|
474 | 474 | </td> |
|
475 | 475 | </tr> |
|
476 | 476 | %endfor |
|
477 | 477 | </%def> |
|
478 | 478 | |
|
479 | 479 | |
|
480 | 480 | <%def name="render_hunk_lines_unified(hunk, use_comments=False)"> |
|
481 | 481 | %for old_line_no, new_line_no, action, content, comments in hunk.unified: |
|
482 | 482 | <% |
|
483 | 483 | old_line_anchor, new_line_anchor = None, None |
|
484 | 484 | if old_line_no: |
|
485 | 485 | old_line_anchor = diff_line_anchor(hunk.filediff.source_file_path, old_line_no, 'o') |
|
486 | 486 | if new_line_no: |
|
487 | 487 | new_line_anchor = diff_line_anchor(hunk.filediff.target_file_path, new_line_no, 'n') |
|
488 | 488 | %> |
|
489 | 489 | <tr class="cb-line"> |
|
490 | 490 | <td class="cb-data ${action_class(action)}"> |
|
491 | 491 | <div> |
|
492 | 492 | %if comments: |
|
493 | 493 | <i class="icon-comment" onclick="return Rhodecode.comments.toggleLineComments(this)"></i> |
|
494 | 494 | %endif |
|
495 | 495 | </div> |
|
496 | 496 | </td> |
|
497 | 497 | <td class="cb-lineno ${action_class(action)}" |
|
498 | 498 | data-line-number="${old_line_no}" |
|
499 | 499 | %if old_line_anchor: |
|
500 | 500 | id="${old_line_anchor}" |
|
501 | 501 | %endif |
|
502 | 502 | > |
|
503 | 503 | %if old_line_anchor: |
|
504 | 504 | <a name="${old_line_anchor}" href="#${old_line_anchor}">${old_line_no}</a> |
|
505 | 505 | %endif |
|
506 | 506 | </td> |
|
507 | 507 | <td class="cb-lineno ${action_class(action)}" |
|
508 | 508 | data-line-number="${new_line_no}" |
|
509 | 509 | %if new_line_anchor: |
|
510 | 510 | id="${new_line_anchor}" |
|
511 | 511 | %endif |
|
512 | 512 | > |
|
513 | 513 | %if new_line_anchor: |
|
514 | 514 | <a name="${new_line_anchor}" href="#${new_line_anchor}">${new_line_no}</a> |
|
515 | 515 | %endif |
|
516 | 516 | </td> |
|
517 | 517 | <td class="cb-content ${action_class(action)}" |
|
518 | 518 | data-line-number="${new_line_no and 'n' or 'o'}${new_line_no or old_line_no}" |
|
519 | 519 | > |
|
520 | 520 | %if use_comments: |
|
521 | 521 | ${render_add_comment_button()} |
|
522 | 522 | %endif |
|
523 | 523 | <span class="cb-code">${action} ${content or '' | n}</span> |
|
524 | 524 | %if use_comments and comments: |
|
525 | 525 | ${inline_comments_container(comments)} |
|
526 | 526 | %endif |
|
527 | 527 | </td> |
|
528 | 528 | </tr> |
|
529 | 529 | %endfor |
|
530 | 530 | </%def> |
|
531 | 531 | |
|
532 | 532 | <%def name="render_add_comment_button()"> |
|
533 | 533 | <button |
|
534 | 534 | class="btn btn-small btn-primary cb-comment-box-opener" |
|
535 | 535 | onclick="return Rhodecode.comments.createComment(this)" |
|
536 | 536 | ><span>+</span></button> |
|
537 | 537 | </%def> |
|
538 | 538 | |
|
539 | 539 | <%def name="render_diffset_menu()"> |
|
540 | 540 | <div class="diffset-menu clearinner"> |
|
541 | 541 | <div class="pull-right"> |
|
542 | 542 | <div class="btn-group"> |
|
543 | 543 | <a |
|
544 | 544 | class="btn ${c.diffmode == 'sideside' and 'btn-primary'} tooltip" |
|
545 | 545 | title="${_('View side by side')}" |
|
546 | 546 | href="${h.url_replace(diffmode='sideside')}"> |
|
547 | 547 | <span>${_('Side by Side')}</span> |
|
548 | 548 | </a> |
|
549 | 549 | <a |
|
550 | 550 | class="btn ${c.diffmode == 'unified' and 'btn-primary'} tooltip" |
|
551 | 551 | title="${_('View unified')}" href="${h.url_replace(diffmode='unified')}"> |
|
552 | 552 | <span>${_('Unified')}</span> |
|
553 | 553 | </a> |
|
554 | 554 | </div> |
|
555 | 555 | </div> |
|
556 | 556 | <div class="pull-left"> |
|
557 | 557 | <div class="btn-group"> |
|
558 | 558 | <a |
|
559 | 559 | class="btn" |
|
560 | 560 | href="#" |
|
561 | 561 | onclick="$('input[class=filediff-collapse-state]').prop('checked', false); return false">${_('Expand All')}</a> |
|
562 | 562 | <a |
|
563 | 563 | class="btn" |
|
564 | 564 | href="#" |
|
565 | 565 | onclick="$('input[class=filediff-collapse-state]').prop('checked', true); return false">${_('Collapse All')}</a> |
|
566 | 566 | </div> |
|
567 | 567 | </div> |
|
568 | 568 | </div> |
|
569 | 569 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now