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