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