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