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