##// END OF EJS Templates
changelog for file history shows that we're in different changelog view
marcink -
r3761:087b50ef beta
parent child Browse files
Show More
@@ -1,280 +1,288 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2
2
3 <%inherit file="/base/base.html"/>
3 <%inherit file="/base/base.html"/>
4
4
5 <%def name="title()">
5 <%def name="title()">
6 ${_('%s Changelog') % c.repo_name} &middot; ${c.rhodecode_name}
6 ${_('%s Changelog') % c.repo_name} &middot;
7 %if c.changelog_for_path:
8 /${c.changelog_for_path} &middot;
9 %endif
10 ${c.rhodecode_name}
7 </%def>
11 </%def>
8
12
9 <%def name="breadcrumbs_links()">
13 <%def name="breadcrumbs_links()">
10 <% size = c.size if c.size <= c.total_cs else c.total_cs %>
14 <% size = c.size if c.size <= c.total_cs else c.total_cs %>
11 ${_('Changelog')} - ${ungettext('showing %d out of %d revision', 'showing %d out of %d revisions', size) % (size, c.total_cs)}
15 ${_('Changelog')}
16 %if c.changelog_for_path:
17 - /${c.changelog_for_path}
18 %endif
19 - ${ungettext('showing %d out of %d revision', 'showing %d out of %d revisions', size) % (size, c.total_cs)}
12 </%def>
20 </%def>
13
21
14 <%def name="page_nav()">
22 <%def name="page_nav()">
15 ${self.menu('repositories')}
23 ${self.menu('repositories')}
16 </%def>
24 </%def>
17
25
18 <%def name="main()">
26 <%def name="main()">
19 ${self.context_bar('changelog')}
27 ${self.context_bar('changelog')}
20 <div class="box">
28 <div class="box">
21 <!-- box / title -->
29 <!-- box / title -->
22 <div class="title">
30 <div class="title">
23 ${self.breadcrumbs()}
31 ${self.breadcrumbs()}
24 </div>
32 </div>
25 <div class="table">
33 <div class="table">
26 % if c.pagination:
34 % if c.pagination:
27 <div id="graph">
35 <div id="graph">
28 <div style="display:${'none' if c.changelog_for_path else ''}">
36 <div style="display:${'none' if c.changelog_for_path else ''}">
29 <div class="info_box" style="clear: both;padding: 10px 6px;min-height: 12px;text-align: right;">
37 <div class="info_box" style="clear: both;padding: 10px 6px;min-height: 12px;text-align: right;">
30 <a href="#" class="ui-btn small" id="rev_range_container" style="display:none"></a>
38 <a href="#" class="ui-btn small" id="rev_range_container" style="display:none"></a>
31 <a href="#" class="ui-btn small" id="rev_range_clear" style="display:none">${_('Clear selection')}</a>
39 <a href="#" class="ui-btn small" id="rev_range_clear" style="display:none">${_('Clear selection')}</a>
32
40
33 %if c.rhodecode_db_repo.fork:
41 %if c.rhodecode_db_repo.fork:
34 <a id="compare_fork" title="${_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name)}" href="${h.url('compare_url',repo_name=c.rhodecode_db_repo.fork.repo_name,org_ref_type='branch',org_ref='default',other_repo=c.repo_name,other_ref_type='branch',other_ref=request.GET.get('branch') or 'default',merge=1)}" class="ui-btn small">${_('Compare fork with parent')}</a>
42 <a id="compare_fork" title="${_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name)}" href="${h.url('compare_url',repo_name=c.rhodecode_db_repo.fork.repo_name,org_ref_type='branch',org_ref='default',other_repo=c.repo_name,other_ref_type='branch',other_ref=request.GET.get('branch') or 'default',merge=1)}" class="ui-btn small">${_('Compare fork with parent')}</a>
35 %endif
43 %endif
36 %if h.is_hg(c.rhodecode_repo):
44 %if h.is_hg(c.rhodecode_repo):
37 <a id="open_new_pr" href="${h.url('pullrequest_home',repo_name=c.repo_name)}" class="ui-btn small">${_('Open new pull request')}</a>
45 <a id="open_new_pr" href="${h.url('pullrequest_home',repo_name=c.repo_name)}" class="ui-btn small">${_('Open new pull request')}</a>
38 %endif
46 %endif
39 </div>
47 </div>
40 <div class="container_header">
48 <div class="container_header">
41 ${h.form(h.url.current(),method='get')}
49 ${h.form(h.url.current(),method='get')}
42 <div style="float:left">
50 <div style="float:left">
43 ${h.submit('set',_('Show'),class_="ui-btn")}
51 ${h.submit('set',_('Show'),class_="ui-btn")}
44 ${h.text('size',size=1,value=c.size)}
52 ${h.text('size',size=1,value=c.size)}
45 ${_('revisions')}
53 ${_('revisions')}
46 </div>
54 </div>
47 ${h.end_form()}
55 ${h.end_form()}
48 <div style="float:right">${h.select('branch_filter',c.branch_name,c.branch_filters)}</div>
56 <div style="float:right">${h.select('branch_filter',c.branch_name,c.branch_filters)}</div>
49 </div>
57 </div>
50 </div>
58 </div>
51 <div id="graph_nodes">
59 <div id="graph_nodes">
52 <canvas id="graph_canvas"></canvas>
60 <canvas id="graph_canvas"></canvas>
53 </div>
61 </div>
54 <div id="graph_content">
62 <div id="graph_content">
55
63
56 <table id="changesets">
64 <table id="changesets">
57 <tbody>
65 <tbody>
58 %for cnt,cs in enumerate(c.pagination):
66 %for cnt,cs in enumerate(c.pagination):
59 <tr id="chg_${cnt+1}" class="container ${'tablerow%s' % (cnt%2)}">
67 <tr id="chg_${cnt+1}" class="container ${'tablerow%s' % (cnt%2)}">
60 <td class="checkbox">
68 <td class="checkbox">
61 %if c.changelog_for_path:
69 %if c.changelog_for_path:
62 ${h.checkbox(cs.raw_id,class_="changeset_range", disabled="disabled")}
70 ${h.checkbox(cs.raw_id,class_="changeset_range", disabled="disabled")}
63 %else:
71 %else:
64 ${h.checkbox(cs.raw_id,class_="changeset_range")}
72 ${h.checkbox(cs.raw_id,class_="changeset_range")}
65 %endif
73 %endif
66 <td class="status">
74 <td class="status">
67 %if c.statuses.get(cs.raw_id):
75 %if c.statuses.get(cs.raw_id):
68 <div class="changeset-status-ico">
76 <div class="changeset-status-ico">
69 %if c.statuses.get(cs.raw_id)[2]:
77 %if c.statuses.get(cs.raw_id)[2]:
70 <a class="tooltip" title="${_('Click to open associated pull request #%s' % c.statuses.get(cs.raw_id)[2])}" href="${h.url('pullrequest_show',repo_name=c.statuses.get(cs.raw_id)[3],pull_request_id=c.statuses.get(cs.raw_id)[2])}">
78 <a class="tooltip" title="${_('Click to open associated pull request #%s' % c.statuses.get(cs.raw_id)[2])}" href="${h.url('pullrequest_show',repo_name=c.statuses.get(cs.raw_id)[3],pull_request_id=c.statuses.get(cs.raw_id)[2])}">
71 <img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses.get(cs.raw_id)[0])}" />
79 <img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses.get(cs.raw_id)[0])}" />
72 </a>
80 </a>
73 %else:
81 %else:
74 <img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses.get(cs.raw_id)[0])}" />
82 <img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses.get(cs.raw_id)[0])}" />
75 %endif
83 %endif
76 </div>
84 </div>
77 %endif
85 %endif
78 </td>
86 </td>
79 <td class="author">
87 <td class="author">
80 <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(cs.author),16)}"/>
88 <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(cs.author),16)}"/>
81 <span title="${cs.author}" class="user">${h.shorter(h.person(cs.author),22)}</span>
89 <span title="${cs.author}" class="user">${h.shorter(h.person(cs.author),22)}</span>
82 </td>
90 </td>
83 <td class="hash" style="width:${len(h.show_id(cs))*6.5}px">
91 <td class="hash" style="width:${len(h.show_id(cs))*6.5}px">
84 <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}">
92 <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}">
85 <span class="changeset_hash">${h.show_id(cs)}</span>
93 <span class="changeset_hash">${h.show_id(cs)}</span>
86 </a>
94 </a>
87 </td>
95 </td>
88 <td class="date">
96 <td class="date">
89 <div class="date">${h.age(cs.date,True)}</div>
97 <div class="date">${h.age(cs.date,True)}</div>
90 </td>
98 </td>
91 <td class="mid">
99 <td class="mid">
92 <div class="log-container">
100 <div class="log-container">
93 <div class="message">${h.urlify_commit(cs.message, c.repo_name,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
101 <div class="message">${h.urlify_commit(cs.message, c.repo_name,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
94 <div class="expand"><span class="expandtext">&darr; ${_('Show more')} &darr;</span></div>
102 <div class="expand"><span class="expandtext">&darr; ${_('Show more')} &darr;</span></div>
95 <div class="extra-container">
103 <div class="extra-container">
96 %if c.comments.get(cs.raw_id,[]):
104 %if c.comments.get(cs.raw_id,[]):
97 <div class="comments-container">
105 <div class="comments-container">
98 <div class="comments-cnt" title="${('comments')}">
106 <div class="comments-cnt" title="${('comments')}">
99 <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id,anchor='comment-%s' % c.comments[cs.raw_id][0].comment_id)}">
107 <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id,anchor='comment-%s' % c.comments[cs.raw_id][0].comment_id)}">
100 ${len(c.comments[cs.raw_id])}
108 ${len(c.comments[cs.raw_id])}
101 </a>
109 </a>
102 </div>
110 </div>
103 </div>
111 </div>
104 %endif
112 %endif
105 %if h.is_hg(c.rhodecode_repo):
113 %if h.is_hg(c.rhodecode_repo):
106 %for book in cs.bookmarks:
114 %for book in cs.bookmarks:
107 <div class="booktag" title="${_('Bookmark %s') % book}">
115 <div class="booktag" title="${_('Bookmark %s') % book}">
108 ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
116 ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
109 </div>
117 </div>
110 %endfor
118 %endfor
111 %endif
119 %endif
112 %for tag in cs.tags:
120 %for tag in cs.tags:
113 <div class="tagtag" title="${_('Tag %s') % tag}">
121 <div class="tagtag" title="${_('Tag %s') % tag}">
114 ${h.link_to(h.shorter(tag),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
122 ${h.link_to(h.shorter(tag),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
115 </div>
123 </div>
116 %endfor
124 %endfor
117 %if (not c.branch_name) and cs.branch:
125 %if (not c.branch_name) and cs.branch:
118 <div class="branchtag" title="${_('Branch %s' % cs.branch)}">
126 <div class="branchtag" title="${_('Branch %s' % cs.branch)}">
119 ${h.link_to(h.shorter(cs.branch),h.url('changelog_home',repo_name=c.repo_name,branch=cs.branch))}
127 ${h.link_to(h.shorter(cs.branch),h.url('changelog_home',repo_name=c.repo_name,branch=cs.branch))}
120 </div>
128 </div>
121 %endif
129 %endif
122 </div>
130 </div>
123 </div>
131 </div>
124 </td>
132 </td>
125 </tr>
133 </tr>
126 %endfor
134 %endfor
127 </tbody>
135 </tbody>
128 </table>
136 </table>
129
137
130 <div class="pagination-wh pagination-left">
138 <div class="pagination-wh pagination-left">
131 ${c.pagination.pager('$link_previous ~2~ $link_next')}
139 ${c.pagination.pager('$link_previous ~2~ $link_next')}
132 </div>
140 </div>
133 </div>
141 </div>
134 </div>
142 </div>
135
143
136 <script type="text/javascript" src="${h.url('/js/graph.js')}"></script>
144 <script type="text/javascript" src="${h.url('/js/graph.js')}"></script>
137 <script type="text/javascript">
145 <script type="text/javascript">
138 YAHOO.util.Event.onDOMReady(function(){
146 YAHOO.util.Event.onDOMReady(function(){
139
147
140 //Monitor range checkboxes and build a link to changesets
148 //Monitor range checkboxes and build a link to changesets
141 //ranges
149 //ranges
142 var checkboxes = YUD.getElementsByClassName('changeset_range');
150 var checkboxes = YUD.getElementsByClassName('changeset_range');
143 var url_tmpl = "${h.url('changeset_home',repo_name=c.repo_name,revision='__REVRANGE__')}";
151 var url_tmpl = "${h.url('changeset_home',repo_name=c.repo_name,revision='__REVRANGE__')}";
144 var pr_tmpl = "${h.url('pullrequest_home',repo_name=c.repo_name)}";
152 var pr_tmpl = "${h.url('pullrequest_home',repo_name=c.repo_name)}";
145
153
146 var checkbox_checker = function(e){
154 var checkbox_checker = function(e){
147 var checked_checkboxes = [];
155 var checked_checkboxes = [];
148 for (pos in checkboxes){
156 for (pos in checkboxes){
149 if(checkboxes[pos].checked){
157 if(checkboxes[pos].checked){
150 checked_checkboxes.push(checkboxes[pos]);
158 checked_checkboxes.push(checkboxes[pos]);
151 }
159 }
152 }
160 }
153 if(YUD.get('open_new_pr')){
161 if(YUD.get('open_new_pr')){
154 if(checked_checkboxes.length>1){
162 if(checked_checkboxes.length>1){
155 YUD.setStyle('open_new_pr','display','none');
163 YUD.setStyle('open_new_pr','display','none');
156 } else {
164 } else {
157 YUD.setStyle('open_new_pr','display','');
165 YUD.setStyle('open_new_pr','display','');
158 if(checked_checkboxes.length>0){
166 if(checked_checkboxes.length>0){
159 YUD.get('open_new_pr').innerHTML = _TM['Open new pull request for selected changesets'];
167 YUD.get('open_new_pr').innerHTML = _TM['Open new pull request for selected changesets'];
160 }else{
168 }else{
161 YUD.get('open_new_pr').innerHTML = _TM['Open new pull request'];
169 YUD.get('open_new_pr').innerHTML = _TM['Open new pull request'];
162 }
170 }
163 }
171 }
164 }
172 }
165
173
166 if(checked_checkboxes.length>0){
174 if(checked_checkboxes.length>0){
167 var rev_end = checked_checkboxes[0].name;
175 var rev_end = checked_checkboxes[0].name;
168 var rev_start = checked_checkboxes[checked_checkboxes.length-1].name;
176 var rev_start = checked_checkboxes[checked_checkboxes.length-1].name;
169 var url = url_tmpl.replace('__REVRANGE__',
177 var url = url_tmpl.replace('__REVRANGE__',
170 rev_start+'...'+rev_end);
178 rev_start+'...'+rev_end);
171
179
172 var link = (rev_start == rev_end)
180 var link = (rev_start == rev_end)
173 ? _TM['Show selected changeset __S']
181 ? _TM['Show selected changeset __S']
174 : _TM['Show selected changesets __S -> __E'];
182 : _TM['Show selected changesets __S -> __E'];
175
183
176 link = link.replace('__S',rev_start.substr(0,6));
184 link = link.replace('__S',rev_start.substr(0,6));
177 link = link.replace('__E',rev_end.substr(0,6));
185 link = link.replace('__E',rev_end.substr(0,6));
178 YUD.get('rev_range_container').href = url;
186 YUD.get('rev_range_container').href = url;
179 YUD.get('rev_range_container').innerHTML = link;
187 YUD.get('rev_range_container').innerHTML = link;
180 YUD.setStyle('rev_range_container','display','');
188 YUD.setStyle('rev_range_container','display','');
181 YUD.setStyle('rev_range_clear','display','');
189 YUD.setStyle('rev_range_clear','display','');
182
190
183 YUD.get('open_new_pr').href = pr_tmpl + '?rev_start={0}&rev_end={1}'.format(rev_start,rev_end);
191 YUD.get('open_new_pr').href = pr_tmpl + '?rev_start={0}&rev_end={1}'.format(rev_start,rev_end);
184 YUD.setStyle('compare_fork','display','none');
192 YUD.setStyle('compare_fork','display','none');
185 }else{
193 }else{
186 YUD.setStyle('rev_range_container','display','none');
194 YUD.setStyle('rev_range_container','display','none');
187 YUD.setStyle('rev_range_clear','display','none');
195 YUD.setStyle('rev_range_clear','display','none');
188 if (checkboxes){
196 if (checkboxes){
189 YUD.get('open_new_pr').href = pr_tmpl + '?rev_end={0}'.format(checkboxes[0].name);
197 YUD.get('open_new_pr').href = pr_tmpl + '?rev_end={0}'.format(checkboxes[0].name);
190 }
198 }
191 YUD.setStyle('compare_fork','display','');
199 YUD.setStyle('compare_fork','display','');
192 }
200 }
193 };
201 };
194 YUE.onDOMReady(checkbox_checker);
202 YUE.onDOMReady(checkbox_checker);
195 YUE.on(checkboxes,'click', checkbox_checker);
203 YUE.on(checkboxes,'click', checkbox_checker);
196
204
197 YUE.on('rev_range_clear','click',function(e){
205 YUE.on('rev_range_clear','click',function(e){
198 for (var i=0; i<checkboxes.length; i++){
206 for (var i=0; i<checkboxes.length; i++){
199 var cb = checkboxes[i];
207 var cb = checkboxes[i];
200 cb.checked = false;
208 cb.checked = false;
201 }
209 }
202 checkbox_checker();
210 checkbox_checker();
203 YUE.preventDefault(e);
211 YUE.preventDefault(e);
204 });
212 });
205
213
206 var msgs = YUQ('.message');
214 var msgs = YUQ('.message');
207 // get first element height
215 // get first element height
208 var el = YUQ('#graph_content .container')[0];
216 var el = YUQ('#graph_content .container')[0];
209 var row_h = el.clientHeight;
217 var row_h = el.clientHeight;
210 for(var i=0;i<msgs.length;i++){
218 for(var i=0;i<msgs.length;i++){
211 var m = msgs[i];
219 var m = msgs[i];
212
220
213 var h = m.clientHeight;
221 var h = m.clientHeight;
214 var pad = YUD.getStyle(m,'padding');
222 var pad = YUD.getStyle(m,'padding');
215 if(h > row_h){
223 if(h > row_h){
216 var offset = row_h - (h+12);
224 var offset = row_h - (h+12);
217 YUD.setStyle(m.nextElementSibling,'display','block');
225 YUD.setStyle(m.nextElementSibling,'display','block');
218 YUD.setStyle(m.nextElementSibling,'margin-top',offset+'px');
226 YUD.setStyle(m.nextElementSibling,'margin-top',offset+'px');
219 };
227 };
220 }
228 }
221 YUE.on(YUQ('.expand'),'click',function(e){
229 YUE.on(YUQ('.expand'),'click',function(e){
222 var elem = e.currentTarget.parentNode.parentNode;
230 var elem = e.currentTarget.parentNode.parentNode;
223 YUD.setStyle(e.currentTarget,'display','none');
231 YUD.setStyle(e.currentTarget,'display','none');
224 YUD.setStyle(elem,'height','auto');
232 YUD.setStyle(elem,'height','auto');
225
233
226 //redraw the graph, line_count and jsdata are global vars
234 //redraw the graph, line_count and jsdata are global vars
227 set_canvas(100);
235 set_canvas(100);
228
236
229 var r = new BranchRenderer();
237 var r = new BranchRenderer();
230 r.render(jsdata,100,line_count);
238 r.render(jsdata,100,line_count);
231
239
232 });
240 });
233
241
234 // change branch filter
242 // change branch filter
235 YUE.on(YUD.get('branch_filter'),'change',function(e){
243 YUE.on(YUD.get('branch_filter'),'change',function(e){
236 var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value;
244 var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value;
237 var url_main = "${h.url('changelog_home',repo_name=c.repo_name)}";
245 var url_main = "${h.url('changelog_home',repo_name=c.repo_name)}";
238 var url = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}";
246 var url = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}";
239 var url = url.replace('__BRANCH__',selected_branch);
247 var url = url.replace('__BRANCH__',selected_branch);
240 if(selected_branch != ''){
248 if(selected_branch != ''){
241 window.location = url;
249 window.location = url;
242 }else{
250 }else{
243 window.location = url_main;
251 window.location = url_main;
244 }
252 }
245
253
246 });
254 });
247
255
248 function set_canvas(width) {
256 function set_canvas(width) {
249 var c = document.getElementById('graph_nodes');
257 var c = document.getElementById('graph_nodes');
250 var t = document.getElementById('graph_content');
258 var t = document.getElementById('graph_content');
251 canvas = document.getElementById('graph_canvas');
259 canvas = document.getElementById('graph_canvas');
252 var div_h = t.clientHeight;
260 var div_h = t.clientHeight;
253 canvas.setAttribute('height',div_h);
261 canvas.setAttribute('height',div_h);
254 canvas.setAttribute('width',width);
262 canvas.setAttribute('width',width);
255 };
263 };
256 var heads = 1;
264 var heads = 1;
257 var line_count = 0;
265 var line_count = 0;
258 var jsdata = ${c.jsdata|n};
266 var jsdata = ${c.jsdata|n};
259
267
260 for (var i=0;i<jsdata.length;i++) {
268 for (var i=0;i<jsdata.length;i++) {
261 var in_l = jsdata[i][2];
269 var in_l = jsdata[i][2];
262 for (var j in in_l) {
270 for (var j in in_l) {
263 var m = in_l[j][1];
271 var m = in_l[j][1];
264 if (m > line_count)
272 if (m > line_count)
265 line_count = m;
273 line_count = m;
266 }
274 }
267 }
275 }
268 set_canvas(100);
276 set_canvas(100);
269
277
270 var r = new BranchRenderer();
278 var r = new BranchRenderer();
271 r.render(jsdata,100,line_count);
279 r.render(jsdata,100,line_count);
272
280
273 });
281 });
274 </script>
282 </script>
275 %else:
283 %else:
276 ${_('There are no changes yet')}
284 ${_('There are no changes yet')}
277 %endif
285 %endif
278 </div>
286 </div>
279 </div>
287 </div>
280 </%def>
288 </%def>
General Comments 0
You need to be logged in to leave comments. Login now