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