Show More
@@ -1,331 +1,336 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | <%inherit file="/base/base.mako"/> |
|
3 | <%inherit 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 |
|
5 | |||
6 | <%def name="title()"> |
|
6 | <%def name="title()"> | |
7 | ${_('%s Commit') % c.repo_name} - ${h.show_id(c.commit)} |
|
7 | ${_('%s Commit') % c.repo_name} - ${h.show_id(c.commit)} | |
8 | %if c.rhodecode_name: |
|
8 | %if c.rhodecode_name: | |
9 | · ${h.branding(c.rhodecode_name)} |
|
9 | · ${h.branding(c.rhodecode_name)} | |
10 | %endif |
|
10 | %endif | |
11 | </%def> |
|
11 | </%def> | |
12 |
|
12 | |||
13 | <%def name="menu_bar_nav()"> |
|
13 | <%def name="menu_bar_nav()"> | |
14 | ${self.menu_items(active='repositories')} |
|
14 | ${self.menu_items(active='repositories')} | |
15 | </%def> |
|
15 | </%def> | |
16 |
|
16 | |||
17 | <%def name="menu_bar_subnav()"> |
|
17 | <%def name="menu_bar_subnav()"> | |
18 | ${self.repo_menu(active='changelog')} |
|
18 | ${self.repo_menu(active='changelog')} | |
19 | </%def> |
|
19 | </%def> | |
20 |
|
20 | |||
21 | <%def name="main()"> |
|
21 | <%def name="main()"> | |
22 | <script> |
|
22 | <script> | |
23 | // TODO: marcink switch this to pyroutes |
|
23 | // TODO: marcink switch this to pyroutes | |
24 | AJAX_COMMENT_DELETE_URL = "${url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}"; |
|
24 | AJAX_COMMENT_DELETE_URL = "${url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}"; | |
25 | templateContext.commit_data.commit_id = "${c.commit.raw_id}"; |
|
25 | templateContext.commit_data.commit_id = "${c.commit.raw_id}"; | |
26 | </script> |
|
26 | </script> | |
27 | <div class="box"> |
|
27 | <div class="box"> | |
28 | <div class="title"> |
|
28 | <div class="title"> | |
29 | ${self.repo_page_title(c.rhodecode_db_repo)} |
|
29 | ${self.repo_page_title(c.rhodecode_db_repo)} | |
30 | </div> |
|
30 | </div> | |
31 |
|
31 | |||
32 | <div id="changeset_compare_view_content" class="summary changeset"> |
|
32 | <div id="changeset_compare_view_content" class="summary changeset"> | |
33 | <div class="summary-detail"> |
|
33 | <div class="summary-detail"> | |
34 | <div class="summary-detail-header"> |
|
34 | <div class="summary-detail-header"> | |
35 | <span class="breadcrumbs files_location"> |
|
35 | <span class="breadcrumbs files_location"> | |
36 | <h4>${_('Commit')} |
|
36 | <h4>${_('Commit')} | |
37 | <code> |
|
37 | <code> | |
38 | ${h.show_id(c.commit)} |
|
38 | ${h.show_id(c.commit)} | |
|
39 | % if hasattr(c.commit, 'phase'): | |||
|
40 | <span class="tag phase-${c.commit.phase} tooltip" title="${_('commit phase')}">${c.commit.phase}</span> | |||
|
41 | % endif | |||
39 | </code> |
|
42 | </code> | |
40 | </h4> |
|
43 | </h4> | |
41 | </span> |
|
44 | </span> | |
42 | <span id="parent_link"> |
|
45 | <div class="pull-right"> | |
43 | <a href="#" title="${_('Parent Commit')}">${_('Parent')}</a> |
|
46 | <span id="parent_link"> | |
44 | </span> |
|
47 | <a href="#" title="${_('Parent Commit')}">${_('Parent')}</a> | |
45 |
|
|
48 | </span> | |
46 | <span id="child_link"> |
|
49 | | | |
47 | <a href="#" title="${_('Child Commit')}">${_('Child')}</a> |
|
50 | <span id="child_link"> | |
48 | </span> |
|
51 | <a href="#" title="${_('Child Commit')}">${_('Child')}</a> | |
|
52 | </span> | |||
|
53 | </div> | |||
49 | </div> |
|
54 | </div> | |
50 |
|
55 | |||
51 | <div class="fieldset"> |
|
56 | <div class="fieldset"> | |
52 | <div class="left-label"> |
|
57 | <div class="left-label"> | |
53 | ${_('Description')}: |
|
58 | ${_('Description')}: | |
54 | </div> |
|
59 | </div> | |
55 | <div class="right-content"> |
|
60 | <div class="right-content"> | |
56 | <div id="trimmed_message_box" class="commit">${h.urlify_commit_message(c.commit.message,c.repo_name)}</div> |
|
61 | <div id="trimmed_message_box" class="commit">${h.urlify_commit_message(c.commit.message,c.repo_name)}</div> | |
57 | <div id="message_expand" style="display:none;"> |
|
62 | <div id="message_expand" style="display:none;"> | |
58 | ${_('Expand')} |
|
63 | ${_('Expand')} | |
59 | </div> |
|
64 | </div> | |
60 | </div> |
|
65 | </div> | |
61 | </div> |
|
66 | </div> | |
62 |
|
67 | |||
63 | %if c.statuses: |
|
68 | %if c.statuses: | |
64 | <div class="fieldset"> |
|
69 | <div class="fieldset"> | |
65 | <div class="left-label"> |
|
70 | <div class="left-label"> | |
66 | ${_('Commit status')}: |
|
71 | ${_('Commit status')}: | |
67 | </div> |
|
72 | </div> | |
68 | <div class="right-content"> |
|
73 | <div class="right-content"> | |
69 | <div class="changeset-status-ico"> |
|
74 | <div class="changeset-status-ico"> | |
70 | <div class="${'flag_status %s' % c.statuses[0]} pull-left"></div> |
|
75 | <div class="${'flag_status %s' % c.statuses[0]} pull-left"></div> | |
71 | </div> |
|
76 | </div> | |
72 | <div title="${_('Commit status')}" class="changeset-status-lbl">[${h.commit_status_lbl(c.statuses[0])}]</div> |
|
77 | <div title="${_('Commit status')}" class="changeset-status-lbl">[${h.commit_status_lbl(c.statuses[0])}]</div> | |
73 | </div> |
|
78 | </div> | |
74 | </div> |
|
79 | </div> | |
75 | %endif |
|
80 | %endif | |
76 |
|
81 | |||
77 | <div class="fieldset"> |
|
82 | <div class="fieldset"> | |
78 | <div class="left-label"> |
|
83 | <div class="left-label"> | |
79 | ${_('References')}: |
|
84 | ${_('References')}: | |
80 | </div> |
|
85 | </div> | |
81 | <div class="right-content"> |
|
86 | <div class="right-content"> | |
82 | <div class="tags"> |
|
87 | <div class="tags"> | |
83 |
|
88 | |||
84 | %if c.commit.merge: |
|
89 | %if c.commit.merge: | |
85 | <span class="mergetag tag"> |
|
90 | <span class="mergetag tag"> | |
86 | <i class="icon-merge"></i>${_('merge')} |
|
91 | <i class="icon-merge"></i>${_('merge')} | |
87 | </span> |
|
92 | </span> | |
88 | %endif |
|
93 | %endif | |
89 |
|
94 | |||
90 | %if h.is_hg(c.rhodecode_repo): |
|
95 | %if h.is_hg(c.rhodecode_repo): | |
91 | %for book in c.commit.bookmarks: |
|
96 | %for book in c.commit.bookmarks: | |
92 | <span class="booktag tag" title="${_('Bookmark %s') % book}"> |
|
97 | <span class="booktag tag" title="${_('Bookmark %s') % book}"> | |
93 | <a href="${h.url('files_home',repo_name=c.repo_name,revision=c.commit.raw_id)}"><i class="icon-bookmark"></i>${h.shorter(book)}</a> |
|
98 | <a href="${h.url('files_home',repo_name=c.repo_name,revision=c.commit.raw_id)}"><i class="icon-bookmark"></i>${h.shorter(book)}</a> | |
94 | </span> |
|
99 | </span> | |
95 | %endfor |
|
100 | %endfor | |
96 | %endif |
|
101 | %endif | |
97 |
|
102 | |||
98 | %for tag in c.commit.tags: |
|
103 | %for tag in c.commit.tags: | |
99 | <span class="tagtag tag" title="${_('Tag %s') % tag}"> |
|
104 | <span class="tagtag tag" title="${_('Tag %s') % tag}"> | |
100 | <a href="${h.url('files_home',repo_name=c.repo_name,revision=c.commit.raw_id)}"><i class="icon-tag"></i>${tag}</a> |
|
105 | <a href="${h.url('files_home',repo_name=c.repo_name,revision=c.commit.raw_id)}"><i class="icon-tag"></i>${tag}</a> | |
101 | </span> |
|
106 | </span> | |
102 | %endfor |
|
107 | %endfor | |
103 |
|
108 | |||
104 | %if c.commit.branch: |
|
109 | %if c.commit.branch: | |
105 | <span class="branchtag tag" title="${_('Branch %s') % c.commit.branch}"> |
|
110 | <span class="branchtag tag" title="${_('Branch %s') % c.commit.branch}"> | |
106 | <a href="${h.url('files_home',repo_name=c.repo_name,revision=c.commit.raw_id)}"><i class="icon-code-fork"></i>${h.shorter(c.commit.branch)}</a> |
|
111 | <a href="${h.url('files_home',repo_name=c.repo_name,revision=c.commit.raw_id)}"><i class="icon-code-fork"></i>${h.shorter(c.commit.branch)}</a> | |
107 | </span> |
|
112 | </span> | |
108 | %endif |
|
113 | %endif | |
109 | </div> |
|
114 | </div> | |
110 | </div> |
|
115 | </div> | |
111 | </div> |
|
116 | </div> | |
112 |
|
117 | |||
113 | <div class="fieldset"> |
|
118 | <div class="fieldset"> | |
114 | <div class="left-label"> |
|
119 | <div class="left-label"> | |
115 | ${_('Diff options')}: |
|
120 | ${_('Diff options')}: | |
116 | </div> |
|
121 | </div> | |
117 | <div class="right-content"> |
|
122 | <div class="right-content"> | |
118 | <div class="diff-actions"> |
|
123 | <div class="diff-actions"> | |
119 | <a href="${h.url('changeset_raw_home',repo_name=c.repo_name,revision=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Raw diff'))}"> |
|
124 | <a href="${h.url('changeset_raw_home',repo_name=c.repo_name,revision=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Raw diff'))}"> | |
120 | ${_('Raw Diff')} |
|
125 | ${_('Raw Diff')} | |
121 | </a> |
|
126 | </a> | |
122 | | |
|
127 | | | |
123 | <a href="${h.url('changeset_patch_home',repo_name=c.repo_name,revision=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Patch diff'))}"> |
|
128 | <a href="${h.url('changeset_patch_home',repo_name=c.repo_name,revision=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Patch diff'))}"> | |
124 | ${_('Patch Diff')} |
|
129 | ${_('Patch Diff')} | |
125 | </a> |
|
130 | </a> | |
126 | | |
|
131 | | | |
127 | <a href="${h.url('changeset_download_home',repo_name=c.repo_name,revision=c.commit.raw_id,diff='download')}" class="tooltip" title="${h.tooltip(_('Download diff'))}"> |
|
132 | <a href="${h.url('changeset_download_home',repo_name=c.repo_name,revision=c.commit.raw_id,diff='download')}" class="tooltip" title="${h.tooltip(_('Download diff'))}"> | |
128 | ${_('Download Diff')} |
|
133 | ${_('Download Diff')} | |
129 | </a> |
|
134 | </a> | |
130 | | |
|
135 | | | |
131 | ${c.ignorews_url(request.GET)} |
|
136 | ${c.ignorews_url(request.GET)} | |
132 | | |
|
137 | | | |
133 | ${c.context_url(request.GET)} |
|
138 | ${c.context_url(request.GET)} | |
134 | </div> |
|
139 | </div> | |
135 | </div> |
|
140 | </div> | |
136 | </div> |
|
141 | </div> | |
137 |
|
142 | |||
138 | <div class="fieldset"> |
|
143 | <div class="fieldset"> | |
139 | <div class="left-label"> |
|
144 | <div class="left-label"> | |
140 | ${_('Comments')}: |
|
145 | ${_('Comments')}: | |
141 | </div> |
|
146 | </div> | |
142 | <div class="right-content"> |
|
147 | <div class="right-content"> | |
143 | <div class="comments-number"> |
|
148 | <div class="comments-number"> | |
144 | %if c.comments: |
|
149 | %if c.comments: | |
145 | <a href="#comments">${ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}</a>, |
|
150 | <a href="#comments">${ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}</a>, | |
146 | %else: |
|
151 | %else: | |
147 | ${ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)} |
|
152 | ${ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)} | |
148 | %endif |
|
153 | %endif | |
149 | %if c.inline_cnt: |
|
154 | %if c.inline_cnt: | |
150 | <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}</a> |
|
155 | <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}</a> | |
151 | %else: |
|
156 | %else: | |
152 | ${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt} |
|
157 | ${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt} | |
153 | %endif |
|
158 | %endif | |
154 | </div> |
|
159 | </div> | |
155 | </div> |
|
160 | </div> | |
156 | </div> |
|
161 | </div> | |
157 |
|
162 | |||
158 | <div class="fieldset"> |
|
163 | <div class="fieldset"> | |
159 | <div class="left-label"> |
|
164 | <div class="left-label"> | |
160 | ${_('Unresolved TODOs')}: |
|
165 | ${_('Unresolved TODOs')}: | |
161 | </div> |
|
166 | </div> | |
162 | <div class="right-content"> |
|
167 | <div class="right-content"> | |
163 | <div class="comments-number"> |
|
168 | <div class="comments-number"> | |
164 | % if c.unresolved_comments: |
|
169 | % if c.unresolved_comments: | |
165 | % for co in c.unresolved_comments: |
|
170 | % for co in c.unresolved_comments: | |
166 | <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'))"> #${co.comment_id}</a>${'' if loop.last else ','} |
|
171 | <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'))"> #${co.comment_id}</a>${'' if loop.last else ','} | |
167 | % endfor |
|
172 | % endfor | |
168 | % else: |
|
173 | % else: | |
169 | ${_('There are no unresolved TODOs')} |
|
174 | ${_('There are no unresolved TODOs')} | |
170 | % endif |
|
175 | % endif | |
171 | </div> |
|
176 | </div> | |
172 | </div> |
|
177 | </div> | |
173 | </div> |
|
178 | </div> | |
174 |
|
179 | |||
175 | </div> <!-- end summary-detail --> |
|
180 | </div> <!-- end summary-detail --> | |
176 |
|
181 | |||
177 | <div id="commit-stats" class="sidebar-right"> |
|
182 | <div id="commit-stats" class="sidebar-right"> | |
178 | <div class="summary-detail-header"> |
|
183 | <div class="summary-detail-header"> | |
179 | <h4 class="item"> |
|
184 | <h4 class="item"> | |
180 | ${_('Author')} |
|
185 | ${_('Author')} | |
181 | </h4> |
|
186 | </h4> | |
182 | </div> |
|
187 | </div> | |
183 | <div class="sidebar-right-content"> |
|
188 | <div class="sidebar-right-content"> | |
184 | ${self.gravatar_with_user(c.commit.author)} |
|
189 | ${self.gravatar_with_user(c.commit.author)} | |
185 | <div class="user-inline-data">- ${h.age_component(c.commit.date)}</div> |
|
190 | <div class="user-inline-data">- ${h.age_component(c.commit.date)}</div> | |
186 | </div> |
|
191 | </div> | |
187 | </div><!-- end sidebar --> |
|
192 | </div><!-- end sidebar --> | |
188 | </div> <!-- end summary --> |
|
193 | </div> <!-- end summary --> | |
189 | <div class="cs_files"> |
|
194 | <div class="cs_files"> | |
190 | <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> |
|
195 | <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> | |
191 | ${cbdiffs.render_diffset_menu()} |
|
196 | ${cbdiffs.render_diffset_menu()} | |
192 | ${cbdiffs.render_diffset( |
|
197 | ${cbdiffs.render_diffset( | |
193 | c.changes[c.commit.raw_id], commit=c.commit, use_comments=True)} |
|
198 | c.changes[c.commit.raw_id], commit=c.commit, use_comments=True)} | |
194 | </div> |
|
199 | </div> | |
195 |
|
200 | |||
196 | ## template for inline comment form |
|
201 | ## template for inline comment form | |
197 | <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> |
|
202 | <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> | |
198 |
|
203 | |||
199 | ## render comments |
|
204 | ## render comments | |
200 | ${comment.generate_comments(c.comments)} |
|
205 | ${comment.generate_comments(c.comments)} | |
201 |
|
206 | |||
202 | ## main comment form and it status |
|
207 | ## main comment form and it status | |
203 | ${comment.comments(h.url('changeset_comment', repo_name=c.repo_name, revision=c.commit.raw_id), |
|
208 | ${comment.comments(h.url('changeset_comment', repo_name=c.repo_name, revision=c.commit.raw_id), | |
204 | h.commit_status(c.rhodecode_db_repo, c.commit.raw_id))} |
|
209 | h.commit_status(c.rhodecode_db_repo, c.commit.raw_id))} | |
205 | </div> |
|
210 | </div> | |
206 |
|
211 | |||
207 | ## FORM FOR MAKING JS ACTION AS CHANGESET COMMENTS |
|
212 | ## FORM FOR MAKING JS ACTION AS CHANGESET COMMENTS | |
208 | <script type="text/javascript"> |
|
213 | <script type="text/javascript"> | |
209 |
|
214 | |||
210 | $(document).ready(function() { |
|
215 | $(document).ready(function() { | |
211 |
|
216 | |||
212 | var boxmax = parseInt($('#trimmed_message_box').css('max-height'), 10); |
|
217 | var boxmax = parseInt($('#trimmed_message_box').css('max-height'), 10); | |
213 | if($('#trimmed_message_box').height() === boxmax){ |
|
218 | if($('#trimmed_message_box').height() === boxmax){ | |
214 | $('#message_expand').show(); |
|
219 | $('#message_expand').show(); | |
215 | } |
|
220 | } | |
216 |
|
221 | |||
217 | $('#message_expand').on('click', function(e){ |
|
222 | $('#message_expand').on('click', function(e){ | |
218 | $('#trimmed_message_box').css('max-height', 'none'); |
|
223 | $('#trimmed_message_box').css('max-height', 'none'); | |
219 | $(this).hide(); |
|
224 | $(this).hide(); | |
220 | }); |
|
225 | }); | |
221 |
|
226 | |||
222 | $('.show-inline-comments').on('click', function(e){ |
|
227 | $('.show-inline-comments').on('click', function(e){ | |
223 | var boxid = $(this).attr('data-comment-id'); |
|
228 | var boxid = $(this).attr('data-comment-id'); | |
224 | var button = $(this); |
|
229 | var button = $(this); | |
225 |
|
230 | |||
226 | if(button.hasClass("comments-visible")) { |
|
231 | if(button.hasClass("comments-visible")) { | |
227 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ |
|
232 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ | |
228 | $(this).hide(); |
|
233 | $(this).hide(); | |
229 | }); |
|
234 | }); | |
230 | button.removeClass("comments-visible"); |
|
235 | button.removeClass("comments-visible"); | |
231 | } else { |
|
236 | } else { | |
232 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ |
|
237 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ | |
233 | $(this).show(); |
|
238 | $(this).show(); | |
234 | }); |
|
239 | }); | |
235 | button.addClass("comments-visible"); |
|
240 | button.addClass("comments-visible"); | |
236 | } |
|
241 | } | |
237 | }); |
|
242 | }); | |
238 |
|
243 | |||
239 |
|
244 | |||
240 | // next links |
|
245 | // next links | |
241 | $('#child_link').on('click', function(e){ |
|
246 | $('#child_link').on('click', function(e){ | |
242 | // fetch via ajax what is going to be the next link, if we have |
|
247 | // fetch via ajax what is going to be the next link, if we have | |
243 | // >1 links show them to user to choose |
|
248 | // >1 links show them to user to choose | |
244 | if(!$('#child_link').hasClass('disabled')){ |
|
249 | if(!$('#child_link').hasClass('disabled')){ | |
245 | $.ajax({ |
|
250 | $.ajax({ | |
246 | url: '${h.url('changeset_children',repo_name=c.repo_name, revision=c.commit.raw_id)}', |
|
251 | url: '${h.url('changeset_children',repo_name=c.repo_name, revision=c.commit.raw_id)}', | |
247 | success: function(data) { |
|
252 | success: function(data) { | |
248 | if(data.results.length === 0){ |
|
253 | if(data.results.length === 0){ | |
249 | $('#child_link').html("${_('No Child Commits')}").addClass('disabled'); |
|
254 | $('#child_link').html("${_('No Child Commits')}").addClass('disabled'); | |
250 | } |
|
255 | } | |
251 | if(data.results.length === 1){ |
|
256 | if(data.results.length === 1){ | |
252 | var commit = data.results[0]; |
|
257 | var commit = data.results[0]; | |
253 | window.location = pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': commit.raw_id}); |
|
258 | window.location = pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': commit.raw_id}); | |
254 | } |
|
259 | } | |
255 | else if(data.results.length === 2){ |
|
260 | else if(data.results.length === 2){ | |
256 | $('#child_link').addClass('disabled'); |
|
261 | $('#child_link').addClass('disabled'); | |
257 | $('#child_link').addClass('double'); |
|
262 | $('#child_link').addClass('double'); | |
258 | var _html = ''; |
|
263 | var _html = ''; | |
259 | _html +='<a title="__title__" href="__url__">__rev__</a> ' |
|
264 | _html +='<a title="__title__" href="__url__">__rev__</a> ' | |
260 | .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6))) |
|
265 | .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6))) | |
261 | .replace('__title__', data.results[0].message) |
|
266 | .replace('__title__', data.results[0].message) | |
262 | .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[0].raw_id})); |
|
267 | .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[0].raw_id})); | |
263 | _html +=' | '; |
|
268 | _html +=' | '; | |
264 | _html +='<a title="__title__" href="__url__">__rev__</a> ' |
|
269 | _html +='<a title="__title__" href="__url__">__rev__</a> ' | |
265 | .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6))) |
|
270 | .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6))) | |
266 | .replace('__title__', data.results[1].message) |
|
271 | .replace('__title__', data.results[1].message) | |
267 | .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[1].raw_id})); |
|
272 | .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[1].raw_id})); | |
268 | $('#child_link').html(_html); |
|
273 | $('#child_link').html(_html); | |
269 | } |
|
274 | } | |
270 | } |
|
275 | } | |
271 | }); |
|
276 | }); | |
272 | e.preventDefault(); |
|
277 | e.preventDefault(); | |
273 | } |
|
278 | } | |
274 | }); |
|
279 | }); | |
275 |
|
280 | |||
276 | // prev links |
|
281 | // prev links | |
277 | $('#parent_link').on('click', function(e){ |
|
282 | $('#parent_link').on('click', function(e){ | |
278 | // fetch via ajax what is going to be the next link, if we have |
|
283 | // fetch via ajax what is going to be the next link, if we have | |
279 | // >1 links show them to user to choose |
|
284 | // >1 links show them to user to choose | |
280 | if(!$('#parent_link').hasClass('disabled')){ |
|
285 | if(!$('#parent_link').hasClass('disabled')){ | |
281 | $.ajax({ |
|
286 | $.ajax({ | |
282 | url: '${h.url("changeset_parents",repo_name=c.repo_name, revision=c.commit.raw_id)}', |
|
287 | url: '${h.url("changeset_parents",repo_name=c.repo_name, revision=c.commit.raw_id)}', | |
283 | success: function(data) { |
|
288 | success: function(data) { | |
284 | if(data.results.length === 0){ |
|
289 | if(data.results.length === 0){ | |
285 | $('#parent_link').html('${_('No Parent Commits')}').addClass('disabled'); |
|
290 | $('#parent_link').html('${_('No Parent Commits')}').addClass('disabled'); | |
286 | } |
|
291 | } | |
287 | if(data.results.length === 1){ |
|
292 | if(data.results.length === 1){ | |
288 | var commit = data.results[0]; |
|
293 | var commit = data.results[0]; | |
289 | window.location = pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': commit.raw_id}); |
|
294 | window.location = pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': commit.raw_id}); | |
290 | } |
|
295 | } | |
291 | else if(data.results.length === 2){ |
|
296 | else if(data.results.length === 2){ | |
292 | $('#parent_link').addClass('disabled'); |
|
297 | $('#parent_link').addClass('disabled'); | |
293 | $('#parent_link').addClass('double'); |
|
298 | $('#parent_link').addClass('double'); | |
294 | var _html = ''; |
|
299 | var _html = ''; | |
295 | _html +='<a title="__title__" href="__url__">Parent __rev__</a>' |
|
300 | _html +='<a title="__title__" href="__url__">Parent __rev__</a>' | |
296 | .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6))) |
|
301 | .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6))) | |
297 | .replace('__title__', data.results[0].message) |
|
302 | .replace('__title__', data.results[0].message) | |
298 | .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[0].raw_id})); |
|
303 | .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[0].raw_id})); | |
299 | _html +=' | '; |
|
304 | _html +=' | '; | |
300 | _html +='<a title="__title__" href="__url__">Parent __rev__</a>' |
|
305 | _html +='<a title="__title__" href="__url__">Parent __rev__</a>' | |
301 | .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6))) |
|
306 | .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6))) | |
302 | .replace('__title__', data.results[1].message) |
|
307 | .replace('__title__', data.results[1].message) | |
303 | .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[1].raw_id})); |
|
308 | .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[1].raw_id})); | |
304 | $('#parent_link').html(_html); |
|
309 | $('#parent_link').html(_html); | |
305 | } |
|
310 | } | |
306 | } |
|
311 | } | |
307 | }); |
|
312 | }); | |
308 | e.preventDefault(); |
|
313 | e.preventDefault(); | |
309 | } |
|
314 | } | |
310 | }); |
|
315 | }); | |
311 |
|
316 | |||
312 | if (location.hash) { |
|
317 | if (location.hash) { | |
313 | var result = splitDelimitedHash(location.hash); |
|
318 | var result = splitDelimitedHash(location.hash); | |
314 | var line = $('html').find(result.loc); |
|
319 | var line = $('html').find(result.loc); | |
315 | if (line.length > 0){ |
|
320 | if (line.length > 0){ | |
316 | offsetScroll(line, 70); |
|
321 | offsetScroll(line, 70); | |
317 | } |
|
322 | } | |
318 | } |
|
323 | } | |
319 |
|
324 | |||
320 | // browse tree @ revision |
|
325 | // browse tree @ revision | |
321 | $('#files_link').on('click', function(e){ |
|
326 | $('#files_link').on('click', function(e){ | |
322 | window.location = '${h.url('files_home',repo_name=c.repo_name, revision=c.commit.raw_id, f_path='')}'; |
|
327 | window.location = '${h.url('files_home',repo_name=c.repo_name, revision=c.commit.raw_id, f_path='')}'; | |
323 | e.preventDefault(); |
|
328 | e.preventDefault(); | |
324 | }); |
|
329 | }); | |
325 |
|
330 | |||
326 | // inject comments into their proper positions |
|
331 | // inject comments into their proper positions | |
327 | var file_comments = $('.inline-comment-placeholder'); |
|
332 | var file_comments = $('.inline-comment-placeholder'); | |
328 | }) |
|
333 | }) | |
329 | </script> |
|
334 | </script> | |
330 |
|
335 | |||
331 | </%def> |
|
336 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now