##// END OF EJS Templates
fix(changeset): fixed incosistent behaviour of rendering gravatars in commit view. Fixes RCCE-25
super-admin -
r5255:8cf3d30a default
parent child Browse files
Show More
@@ -1,434 +1,440 b''
1 1
2 2 <%inherit file="/base/base.mako"/>
3 3 <%namespace name="base" file="/base/base.mako"/>
4 4 <%namespace name="diff_block" file="/changeset/diff_block.mako"/>
5 5 <%namespace name="file_base" file="/files/base.mako"/>
6 6 <%namespace name="sidebar" file="/base/sidebar.mako"/>
7 7
8 8
9 9 <%def name="title()">
10 10 ${_('{} Commit').format(c.repo_name)} - ${h.show_id(c.commit)}
11 11 %if c.rhodecode_name:
12 12 &middot; ${h.branding(c.rhodecode_name)}
13 13 %endif
14 14 </%def>
15 15
16 16 <%def name="menu_bar_nav()">
17 17 ${self.menu_items(active='repositories')}
18 18 </%def>
19 19
20 20 <%def name="menu_bar_subnav()">
21 21 ${self.repo_menu(active='commits')}
22 22 </%def>
23 23
24 24 <%def name="main()">
25 25 <script type="text/javascript">
26 26 templateContext.commit_data.commit_id = "${c.commit.raw_id}";
27 27 </script>
28 28
29 29 <div class="box">
30 30
31 31 <div class="summary">
32 32
33 33 <div class="fieldset">
34 34 <div class="left-content">
35 35 <%
36 36 rc_user = h.discover_user(c.commit.author_email)
37 37 %>
38 38 <div class="left-content-avatar">
39 ${base.gravatar(c.commit.author_email, 30, tooltip=(True if rc_user else False), user=rc_user)}
39 <%
40 email = h.email_or_none(c.commit.author)
41 rc_user = h.discover_user(c.commit.author)
42 %>
43 ${base.gravatar(email, 30, tooltip=(True if rc_user else False), user=rc_user)}
44
40 45 </div>
41 46
42 47 <div class="left-content-message">
43 48 <div class="fieldset collapsable-content no-hide" data-toggle="summary-details">
44 49 <div class="commit truncate-wrap">${h.urlify_commit_message(h.chop_at_smart(c.commit.message, '\n', suffix_if_chopped='...'), c.repo_name)}</div>
45 50 </div>
46 51
47 52 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none">
53
48 54 <div class="commit">${h.urlify_commit_message(c.commit.message,c.repo_name)}</div>
49 55 </div>
50 56
51 57 <div class="fieldset" data-toggle="summary-details">
52 58 <div class="">
53 59 <table>
54 60 <tr class="file_author">
55 61
56 62 <td>
57 63 <span class="user commit-author">${h.link_to_user(rc_user or c.commit.author)}</span>
58 64 <span class="commit-date">- ${h.age_component(c.commit.date)}</span>
59 65 </td>
60 66
61 67 <td>
62 68 ## second cell for consistency with files
63 69 </td>
64 70 </tr>
65 71 </table>
66 72 </div>
67 73 </div>
68 74
69 75 </div>
70 76 </div>
71 77
72 78 <div class="right-content">
73 79
74 80 <div data-toggle="summary-details">
75 81 <div class="tags tags-main">
76 82 <code><a href="${h.route_path('repo_commit',repo_name=c.repo_name,commit_id=c.commit.raw_id)}">${h.show_id(c.commit)}</a></code>
77 83 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.commit.raw_id}" title="${_('Copy the full commit id')}"></i>
78 84 ${file_base.refs(c.commit)}
79 85
80 86
81 87 ## phase
82 88 % if hasattr(c.commit, 'phase') and getattr(c.commit, 'phase') != 'public':
83 89 <span class="tag phase-${c.commit.phase} tooltip" title="${_('Commit phase')}">
84 90 <i class="icon-info"></i>${c.commit.phase}
85 91 </span>
86 92 % endif
87 93
88 94 ## obsolete commits
89 95 % if getattr(c.commit, 'obsolete', False):
90 96 <span class="tag obsolete-${c.commit.obsolete} tooltip" title="${_('Evolve State')}">
91 97 ${_('obsolete')}
92 98 </span>
93 99 % endif
94 100
95 101 ## hidden commits
96 102 % if getattr(c.commit, 'hidden', False):
97 103 <span class="tag hidden-${c.commit.hidden} tooltip" title="${_('Evolve State')}">
98 104 ${_('hidden')}
99 105 </span>
100 106 % endif
101 107 </div>
102 108
103 109 <span id="parent_link" class="tag tagtag">
104 110 <a href="#parentCommit" title="${_('Parent Commit')}"><i class="icon-left icon-no-margin"></i>${_('parent')}</a>
105 111 </span>
106 112
107 113 <span id="child_link" class="tag tagtag">
108 114 <a href="#childCommit" title="${_('Child Commit')}">${_('child')}<i class="icon-right icon-no-margin"></i></a>
109 115 </span>
110 116 <span class="tag tooltip" title="${_('Browse files at this commit')}">
111 117 <i class="icon-code"></i>
112 118 <a href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path='')}">${_('Browse files')}</a>
113 119 </span>
114 120
115 121 </div>
116 122
117 123 </div>
118 124 </div>
119 125
120 126 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
121 127 <div class="left-label-summary">
122 128 <p>${_('Diff options')}:</p>
123 129 <div class="right-label-summary">
124 130 <div class="diff-actions">
125 131 <a href="${h.route_path('repo_commit_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id)}">
126 132 ${_('Raw Diff')}
127 133 </a>
128 134 |
129 135 <a href="${h.route_path('repo_commit_patch',repo_name=c.repo_name,commit_id=c.commit.raw_id)}">
130 136 ${_('Patch Diff')}
131 137 </a>
132 138 |
133 139 <a href="${h.route_path('repo_commit_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(diff='download'))}">
134 140 ${_('Download Diff')}
135 141 </a>
136 142 </div>
137 143 </div>
138 144 </div>
139 145 </div>
140 146
141 147 <div class="clear-fix"></div>
142 148
143 149 <div class="btn-collapse" data-toggle="summary-details">
144 150 ${_('Show More')}
145 151 </div>
146 152
147 153 </div>
148 154
149 155 <div class="cs_files">
150 156 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
151 157 ${cbdiffs.render_diffset_menu(c.changes[c.commit.raw_id], commit=c.commit)}
152 158 ${cbdiffs.render_diffset(
153 159 c.changes[c.commit.raw_id], commit=c.commit, use_comments=True,
154 160 inline_comments=c.inline_comments,
155 161 show_todos=False)}
156 162 </div>
157 163
158 164 ## template for inline comment form
159 165 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
160 166
161 167 ## comments heading with count
162 168 <div class="comments-heading">
163 169 <i class="icon-comment"></i>
164 170 ${_('General Comments')} ${len(c.comments)}
165 171 </div>
166 172
167 173 ## render comments
168 174 ${comment.generate_comments(c.comments)}
169 175
170 176 ## main comment form and it status
171 177 ${comment.comments(h.route_path('repo_commit_comment_create', repo_name=c.repo_name, commit_id=c.commit.raw_id),
172 178 h.commit_status(c.rhodecode_db_repo, c.commit.raw_id))}
173 179 </div>
174 180
175 181 ### NAV SIDEBAR
176 182 <aside class="right-sidebar right-sidebar-expanded" id="commit-nav-sticky" style="display: none">
177 183 <div class="sidenav navbar__inner" >
178 184 ## TOGGLE
179 185 <div class="sidebar-toggle" onclick="toggleSidebar(); return false">
180 186 <a href="#toggleSidebar" class="grey-link-action">
181 187
182 188 </a>
183 189 </div>
184 190
185 191 ## CONTENT
186 192 <div class="sidebar-content">
187 193
188 194 ## RULES SUMMARY/RULES
189 195 <div class="sidebar-element clear-both">
190 196 <% vote_title = _ungettext(
191 197 'Status calculated based on votes from {} reviewer',
192 198 'Status calculated based on votes from {} reviewers', c.reviewers_count).format(c.reviewers_count)
193 199 %>
194 200
195 201 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${vote_title}">
196 202 <i class="icon-circle review-status-${c.commit_review_status}"></i>
197 203 ${c.reviewers_count}
198 204 </div>
199 205 </div>
200 206
201 207 ## REVIEWERS
202 208 <div class="right-sidebar-expanded-state pr-details-title">
203 209 <span class="tooltip sidebar-heading" title="${vote_title}">
204 210 <i class="icon-circle review-status-${c.commit_review_status}"></i>
205 211 ${_('Reviewers')}
206 212 </span>
207 213 </div>
208 214
209 215 <div id="reviewers" class="right-sidebar-expanded-state pr-details-content reviewers">
210 216
211 217 <table id="review_members" class="group_members">
212 218 ## This content is loaded via JS and ReviewersPanel
213 219 </table>
214 220
215 221 </div>
216 222
217 223 ## TODOs
218 224 <div class="sidebar-element clear-both">
219 225 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="TODOs">
220 226 <i class="icon-flag-filled"></i>
221 227 <span id="todos-count">${len(c.unresolved_comments)}</span>
222 228 </div>
223 229
224 230 <div class="right-sidebar-expanded-state pr-details-title">
225 231 ## Only show unresolved, that is only what matters
226 232 <span class="sidebar-heading noselect" onclick="refreshTODOs(); return false">
227 233 <i class="icon-flag-filled"></i>
228 234 TODOs
229 235 </span>
230 236
231 237 % if c.resolved_comments:
232 238 <span class="block-right action_button last-item noselect" onclick="$('.unresolved-todo-text').toggle(); return toggleElement(this, '.resolved-todo');" data-toggle-on="Show resolved" data-toggle-off="Hide resolved">Show resolved</span>
233 239 % else:
234 240 <span class="block-right last-item noselect">Show resolved</span>
235 241 % endif
236 242
237 243 </div>
238 244
239 245 <div class="right-sidebar-expanded-state pr-details-content">
240 246 % if c.unresolved_comments + c.resolved_comments:
241 247 ${sidebar.comments_table(c.unresolved_comments + c.resolved_comments, len(c.unresolved_comments), todo_comments=True, is_pr=False)}
242 248 % else:
243 249 <table>
244 250 <tr>
245 251 <td>
246 252 ${_('No TODOs yet')}
247 253 </td>
248 254 </tr>
249 255 </table>
250 256 % endif
251 257 </div>
252 258 </div>
253 259
254 260 ## COMMENTS
255 261 <div class="sidebar-element clear-both">
256 262 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${_('Comments')}">
257 263 <i class="icon-comment" style="color: #949494"></i>
258 264 <span id="comments-count">${len(c.inline_comments_flat+c.comments)}</span>
259 265 <span class="display-none" id="general-comments-count">${len(c.comments)}</span>
260 266 <span class="display-none" id="inline-comments-count">${len(c.inline_comments_flat)}</span>
261 267 </div>
262 268
263 269 <div class="right-sidebar-expanded-state pr-details-title">
264 270 <span class="sidebar-heading noselect" onclick="refreshComments(); return false">
265 271 <i class="icon-comment" style="color: #949494"></i>
266 272 ${_('Comments')}
267 273 </span>
268 274
269 275 </div>
270 276
271 277 <div class="right-sidebar-expanded-state pr-details-content">
272 278 % if c.inline_comments_flat + c.comments:
273 279 ${sidebar.comments_table(c.inline_comments_flat + c.comments, len(c.inline_comments_flat+c.comments), is_pr=False)}
274 280 % else:
275 281 <table>
276 282 <tr>
277 283 <td>
278 284 ${_('No Comments yet')}
279 285 </td>
280 286 </tr>
281 287 </table>
282 288 % endif
283 289 </div>
284 290
285 291 </div>
286 292
287 293 </div>
288 294
289 295 </div>
290 296 </aside>
291 297
292 298 ## FORM FOR MAKING JS ACTION AS CHANGESET COMMENTS
293 299 <script type="text/javascript">
294 300 window.setReviewersData = ${c.commit_set_reviewers_data_json | n};
295 301
296 302 $(document).ready(function () {
297 303 var boxmax = parseInt($('#trimmed_message_box').css('max-height'), 10);
298 304
299 305 if ($('#trimmed_message_box').height() === boxmax) {
300 306 $('#message_expand').show();
301 307 }
302 308
303 309 $('#message_expand').on('click', function (e) {
304 310 $('#trimmed_message_box').css('max-height', 'none');
305 311 $(this).hide();
306 312 });
307 313
308 314 $('.show-inline-comments').on('click', function (e) {
309 315 var boxid = $(this).attr('data-comment-id');
310 316 var button = $(this);
311 317
312 318 if (button.hasClass("comments-visible")) {
313 319 $('#{0} .inline-comments'.format(boxid)).each(function (index) {
314 320 $(this).hide();
315 321 });
316 322 button.removeClass("comments-visible");
317 323 } else {
318 324 $('#{0} .inline-comments'.format(boxid)).each(function (index) {
319 325 $(this).show();
320 326 });
321 327 button.addClass("comments-visible");
322 328 }
323 329 });
324 330
325 331 // next links
326 332 $('#child_link').on('click', function (e) {
327 333 // fetch via ajax what is going to be the next link, if we have
328 334 // >1 links show them to user to choose
329 335 if (!$('#child_link').hasClass('disabled')) {
330 336 $.ajax({
331 337 url: '${h.route_path('repo_commit_children',repo_name=c.repo_name, commit_id=c.commit.raw_id)}',
332 338 success: function (data) {
333 339 if (data.results.length === 0) {
334 340 $('#child_link').html("${_('No Child Commits')}").addClass('disabled');
335 341 }
336 342 if (data.results.length === 1) {
337 343 var commit = data.results[0];
338 344 window.location = pyroutes.url('repo_commit', {
339 345 'repo_name': '${c.repo_name}',
340 346 'commit_id': commit.raw_id
341 347 });
342 348 } else if (data.results.length === 2) {
343 349 $('#child_link').addClass('disabled');
344 350 $('#child_link').addClass('double');
345 351
346 352 var _html = '';
347 353 _html += '<a title="__title__" href="__url__"><span class="tag branchtag"><i class="icon-code-fork"></i>__branch__</span> __rev__</a> '
348 354 .replace('__branch__', data.results[0].branch)
349 355 .replace('__rev__', 'r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0, 6)))
350 356 .replace('__title__', data.results[0].message)
351 357 .replace('__url__', pyroutes.url('repo_commit', {
352 358 'repo_name': '${c.repo_name}',
353 359 'commit_id': data.results[0].raw_id
354 360 }));
355 361 _html += ' | ';
356 362 _html += '<a title="__title__" href="__url__"><span class="tag branchtag"><i class="icon-code-fork"></i>__branch__</span> __rev__</a> '
357 363 .replace('__branch__', data.results[1].branch)
358 364 .replace('__rev__', 'r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0, 6)))
359 365 .replace('__title__', data.results[1].message)
360 366 .replace('__url__', pyroutes.url('repo_commit', {
361 367 'repo_name': '${c.repo_name}',
362 368 'commit_id': data.results[1].raw_id
363 369 }));
364 370 $('#child_link').html(_html);
365 371 }
366 372 }
367 373 });
368 374 e.preventDefault();
369 375 }
370 376 });
371 377
372 378 // prev links
373 379 $('#parent_link').on('click', function (e) {
374 380 // fetch via ajax what is going to be the next link, if we have
375 381 // >1 links show them to user to choose
376 382 if (!$('#parent_link').hasClass('disabled')) {
377 383 $.ajax({
378 384 url: '${h.route_path("repo_commit_parents",repo_name=c.repo_name, commit_id=c.commit.raw_id)}',
379 385 success: function (data) {
380 386 if (data.results.length === 0) {
381 387 $('#parent_link').html('${_('No Parent Commits')}').addClass('disabled');
382 388 }
383 389 if (data.results.length === 1) {
384 390 var commit = data.results[0];
385 391 window.location = pyroutes.url('repo_commit', {
386 392 'repo_name': '${c.repo_name}',
387 393 'commit_id': commit.raw_id
388 394 });
389 395 } else if (data.results.length === 2) {
390 396 $('#parent_link').addClass('disabled');
391 397 $('#parent_link').addClass('double');
392 398
393 399 var _html = '';
394 400 _html += '<a title="__title__" href="__url__"><span class="tag branchtag"><i class="icon-code-fork"></i>__branch__</span> __rev__</a>'
395 401 .replace('__branch__', data.results[0].branch)
396 402 .replace('__rev__', 'r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0, 6)))
397 403 .replace('__title__', data.results[0].message)
398 404 .replace('__url__', pyroutes.url('repo_commit', {
399 405 'repo_name': '${c.repo_name}',
400 406 'commit_id': data.results[0].raw_id
401 407 }));
402 408 _html += ' | ';
403 409 _html += '<a title="__title__" href="__url__"><span class="tag branchtag"><i class="icon-code-fork"></i>__branch__</span> __rev__</a>'
404 410 .replace('__branch__', data.results[1].branch)
405 411 .replace('__rev__', 'r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0, 6)))
406 412 .replace('__title__', data.results[1].message)
407 413 .replace('__url__', pyroutes.url('repo_commit', {
408 414 'repo_name': '${c.repo_name}',
409 415 'commit_id': data.results[1].raw_id
410 416 }));
411 417 $('#parent_link').html(_html);
412 418 }
413 419 }
414 420 });
415 421 e.preventDefault();
416 422 }
417 423 });
418 424
419 425 // browse tree @ revision
420 426 $('#files_link').on('click', function (e) {
421 427 window.location = '${h.route_path('repo_files:default_path',repo_name=c.repo_name, commit_id=c.commit.raw_id)}';
422 428 e.preventDefault();
423 429 });
424 430
425 431 reviewersController = new ReviewersController();
426 432 ReviewersPanel.init(reviewersController, null, setReviewersData);
427 433
428 434 var channel = '${c.commit_broadcast_channel}';
429 435 new ReviewerPresenceController(channel)
430 436
431 437 })
432 438 </script>
433 439
434 440 </%def>
General Comments 0
You need to be logged in to leave comments. Login now