##// END OF EJS Templates
fixed compare view for git (by changed to use raw_id)
marcink -
r2512:8ece6d04 beta
parent child Browse files
Show More
@@ -1,257 +1,257 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} - ${c.rhodecode_name}
6 ${_('%s Changelog') % c.repo_name} - ${c.rhodecode_name}
7 </%def>
7 </%def>
8
8
9 <%def name="breadcrumbs_links()">
9 <%def name="breadcrumbs_links()">
10 ${h.link_to(_(u'Home'),h.url('/'))}
10 ${h.link_to(_(u'Home'),h.url('/'))}
11 &raquo;
11 &raquo;
12 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
12 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
13 &raquo;
13 &raquo;
14 <% 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 %>
15 ${_('Changelog')} - ${ungettext('showing %d out of %d revision', 'showing %d out of %d revisions', size) % (size, c.total_cs)}
15 ${_('Changelog')} - ${ungettext('showing %d out of %d revision', 'showing %d out of %d revisions', size) % (size, c.total_cs)}
16 </%def>
16 </%def>
17
17
18 <%def name="page_nav()">
18 <%def name="page_nav()">
19 ${self.menu('changelog')}
19 ${self.menu('changelog')}
20 </%def>
20 </%def>
21
21
22 <%def name="main()">
22 <%def name="main()">
23 <div class="box">
23 <div class="box">
24 <!-- box / title -->
24 <!-- box / title -->
25 <div class="title">
25 <div class="title">
26 ${self.breadcrumbs()}
26 ${self.breadcrumbs()}
27 </div>
27 </div>
28 <div class="table">
28 <div class="table">
29 % if c.pagination:
29 % if c.pagination:
30 <div id="graph">
30 <div id="graph">
31 <div id="graph_nodes">
31 <div id="graph_nodes">
32 <canvas id="graph_canvas"></canvas>
32 <canvas id="graph_canvas"></canvas>
33 </div>
33 </div>
34 <div id="graph_content">
34 <div id="graph_content">
35 <div class="info_box" style="clear: both;padding: 10px 6px;vertical-align: right;text-align: right;">
35 <div class="info_box" style="clear: both;padding: 10px 6px;vertical-align: right;text-align: right;">
36 %if c.rhodecode_db_repo.fork:
36 %if c.rhodecode_db_repo.fork:
37 <a title="${_('compare fork with %s' % c.rhodecode_db_repo.fork.repo_name)}" href="${h.url('compare_url',repo_name=c.repo_name,org_ref_type='branch',org_ref='default',other_ref_type='branch',other_ref='default',repo=c.rhodecode_db_repo.fork.repo_name)}" class="ui-btn small">${_('Compare fork')}</a>
37 <a title="${_('compare fork with %s' % c.rhodecode_db_repo.fork.repo_name)}" href="${h.url('compare_url',repo_name=c.repo_name,org_ref_type='branch',org_ref='default',other_ref_type='branch',other_ref='default',repo=c.rhodecode_db_repo.fork.repo_name)}" class="ui-btn small">${_('Compare fork')}</a>
38 %endif
38 %endif
39 <a href="${h.url('pullrequest_home',repo_name=c.repo_name)}" class="ui-btn small">${_('Open new pull request')}</a>
39 <a href="${h.url('pullrequest_home',repo_name=c.repo_name)}" class="ui-btn small">${_('Open new pull request')}</a>
40 </div>
40 </div>
41 <div class="container_header">
41 <div class="container_header">
42 ${h.form(h.url.current(),method='get')}
42 ${h.form(h.url.current(),method='get')}
43 <div class="info_box" style="float:left">
43 <div class="info_box" style="float:left">
44 ${h.submit('set',_('Show'),class_="ui-btn")}
44 ${h.submit('set',_('Show'),class_="ui-btn")}
45 ${h.text('size',size=1,value=c.size)}
45 ${h.text('size',size=1,value=c.size)}
46 ${_('revisions')}
46 ${_('revisions')}
47 </div>
47 </div>
48 ${h.end_form()}
48 ${h.end_form()}
49 <div id="rev_range_container" style="display:none"></div>
49 <div id="rev_range_container" style="display:none"></div>
50 <div style="float:right">${h.select('branch_filter',c.branch_name,c.branch_filters)}</div>
50 <div style="float:right">${h.select('branch_filter',c.branch_name,c.branch_filters)}</div>
51 </div>
51 </div>
52
52
53 %for cnt,cs in enumerate(c.pagination):
53 %for cnt,cs in enumerate(c.pagination):
54 <div id="chg_${cnt+1}" class="container ${'tablerow%s' % (cnt%2)}">
54 <div id="chg_${cnt+1}" class="container ${'tablerow%s' % (cnt%2)}">
55 <div class="left">
55 <div class="left">
56 <div>
56 <div>
57 ${h.checkbox(cs.short_id,class_="changeset_range")}
57 ${h.checkbox(cs.raw_id,class_="changeset_range")}
58 <span class="tooltip" title="${h.tooltip(h.age(cs.date))}"><a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}"><span class="changeset_id">${cs.revision}:<span class="changeset_hash">${h.short_id(cs.raw_id)}</span></span></a></span>
58 <span class="tooltip" title="${h.tooltip(h.age(cs.date))}"><a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}"><span class="changeset_id">${cs.revision}:<span class="changeset_hash">${h.short_id(cs.raw_id)}</span></span></a></span>
59 </div>
59 </div>
60 <div class="author">
60 <div class="author">
61 <div class="gravatar">
61 <div class="gravatar">
62 <img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),16)}"/>
62 <img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),16)}"/>
63 </div>
63 </div>
64 <div title="${cs.author}" class="user">${h.shorter(h.person(cs.author),22)}</div>
64 <div title="${cs.author}" class="user">${h.shorter(h.person(cs.author),22)}</div>
65 </div>
65 </div>
66 <div class="date">${h.fmt_date(cs.date)}</div>
66 <div class="date">${h.fmt_date(cs.date)}</div>
67 </div>
67 </div>
68 <div class="mid">
68 <div class="mid">
69 <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>
69 <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>
70 <div class="expand"><span class="expandtext">&darr; ${_('show more')} &darr;</span></div>
70 <div class="expand"><span class="expandtext">&darr; ${_('show more')} &darr;</span></div>
71 </div>
71 </div>
72 <div class="right">
72 <div class="right">
73 <div class="changes">
73 <div class="changes">
74 <div id="${cs.raw_id}" style="float:right;" class="changed_total tooltip" title="${h.tooltip(_('Affected number of files, click to show more details'))}">${len(cs.affected_files)}</div>
74 <div id="${cs.raw_id}" style="float:right;" class="changed_total tooltip" title="${h.tooltip(_('Affected number of files, click to show more details'))}">${len(cs.affected_files)}</div>
75 <div class="comments-container">
75 <div class="comments-container">
76 %if len(c.comments.get(cs.raw_id,[])) > 0:
76 %if len(c.comments.get(cs.raw_id,[])) > 0:
77 <div class="comments-cnt" title="${('comments')}">
77 <div class="comments-cnt" title="${('comments')}">
78 <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)}">
78 <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)}">
79 <div class="comments-cnt">${len(c.comments[cs.raw_id])}</div>
79 <div class="comments-cnt">${len(c.comments[cs.raw_id])}</div>
80 <img src="${h.url('/images/icons/comments.png')}">
80 <img src="${h.url('/images/icons/comments.png')}">
81 </a>
81 </a>
82 </div>
82 </div>
83 %endif
83 %endif
84 </div>
84 </div>
85 <div class="changeset-status-container">
85 <div class="changeset-status-container">
86 %if c.statuses.get(cs.raw_id):
86 %if c.statuses.get(cs.raw_id):
87 <div title="${_('Changeset status')}" class="changeset-status-lbl">${c.statuses.get(cs.raw_id)[1]}</div>
87 <div title="${_('Changeset status')}" class="changeset-status-lbl">${c.statuses.get(cs.raw_id)[1]}</div>
88 <div class="changeset-status-ico">
88 <div class="changeset-status-ico">
89 %if c.statuses.get(cs.raw_id)[2]:
89 %if c.statuses.get(cs.raw_id)[2]:
90 <a class="tooltip" title="${_('Click to open associated pull request')}" href="${h.url('pullrequest_show',repo_name=c.statuses.get(cs.raw_id)[3],pull_request_id=c.statuses.get(cs.raw_id)[2])}"><img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses.get(cs.raw_id)[0])}" /></a>
90 <a class="tooltip" title="${_('Click to open associated pull request')}" href="${h.url('pullrequest_show',repo_name=c.statuses.get(cs.raw_id)[3],pull_request_id=c.statuses.get(cs.raw_id)[2])}"><img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses.get(cs.raw_id)[0])}" /></a>
91 %else:
91 %else:
92 <img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses.get(cs.raw_id)[0])}" />
92 <img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses.get(cs.raw_id)[0])}" />
93 %endif
93 %endif
94 </div>
94 </div>
95 %endif
95 %endif
96 </div>
96 </div>
97 </div>
97 </div>
98 %if cs.parents:
98 %if cs.parents:
99 %for p_cs in reversed(cs.parents):
99 %for p_cs in reversed(cs.parents):
100 <div class="parent">${_('Parent')}
100 <div class="parent">${_('Parent')}
101 <span class="changeset_id">${p_cs.revision}:<span class="changeset_hash">${h.link_to(h.short_id(p_cs.raw_id),
101 <span class="changeset_id">${p_cs.revision}:<span class="changeset_hash">${h.link_to(h.short_id(p_cs.raw_id),
102 h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}</span></span>
102 h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}</span></span>
103 </div>
103 </div>
104 %endfor
104 %endfor
105 %else:
105 %else:
106 <div class="parent">${_('No parents')}</div>
106 <div class="parent">${_('No parents')}</div>
107 %endif
107 %endif
108
108
109 <span class="logtags">
109 <span class="logtags">
110 %if len(cs.parents)>1:
110 %if len(cs.parents)>1:
111 <span class="merge">${_('merge')}</span>
111 <span class="merge">${_('merge')}</span>
112 %endif
112 %endif
113 %if cs.branch:
113 %if cs.branch:
114 <span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}">
114 <span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}">
115 ${h.link_to(h.shorter(cs.branch),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
115 ${h.link_to(h.shorter(cs.branch),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
116 </span>
116 </span>
117 %endif
117 %endif
118 %if h.is_hg(c.rhodecode_repo):
118 %if h.is_hg(c.rhodecode_repo):
119 %for book in cs.bookmarks:
119 %for book in cs.bookmarks:
120 <span class="bookbook" title="${'%s %s' % (_('bookmark'),book)}">
120 <span class="bookbook" title="${'%s %s' % (_('bookmark'),book)}">
121 ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
121 ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
122 </span>
122 </span>
123 %endfor
123 %endfor
124 %endif
124 %endif
125 %for tag in cs.tags:
125 %for tag in cs.tags:
126 <span class="tagtag" title="${'%s %s' % (_('tag'),tag)}">
126 <span class="tagtag" title="${'%s %s' % (_('tag'),tag)}">
127 ${h.link_to(h.shorter(tag),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
127 ${h.link_to(h.shorter(tag),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
128 %endfor
128 %endfor
129 </span>
129 </span>
130 </div>
130 </div>
131 </div>
131 </div>
132
132
133 %endfor
133 %endfor
134 <div class="pagination-wh pagination-left">
134 <div class="pagination-wh pagination-left">
135 ${c.pagination.pager('$link_previous ~2~ $link_next')}
135 ${c.pagination.pager('$link_previous ~2~ $link_next')}
136 </div>
136 </div>
137 </div>
137 </div>
138 </div>
138 </div>
139
139
140 <script type="text/javascript" src="${h.url('/js/graph.js')}"></script>
140 <script type="text/javascript" src="${h.url('/js/graph.js')}"></script>
141 <script type="text/javascript">
141 <script type="text/javascript">
142 YAHOO.util.Event.onDOMReady(function(){
142 YAHOO.util.Event.onDOMReady(function(){
143
143
144 //Monitor range checkboxes and build a link to changesets
144 //Monitor range checkboxes and build a link to changesets
145 //ranges
145 //ranges
146 var checkboxes = YUD.getElementsByClassName('changeset_range');
146 var checkboxes = YUD.getElementsByClassName('changeset_range');
147 var url_tmpl = "${h.url('changeset_home',repo_name=c.repo_name,revision='__REVRANGE__')}";
147 var url_tmpl = "${h.url('changeset_home',repo_name=c.repo_name,revision='__REVRANGE__')}";
148 YUE.on(checkboxes,'click',function(e){
148 YUE.on(checkboxes,'click',function(e){
149 var checked_checkboxes = [];
149 var checked_checkboxes = [];
150 for (pos in checkboxes){
150 for (pos in checkboxes){
151 if(checkboxes[pos].checked){
151 if(checkboxes[pos].checked){
152 checked_checkboxes.push(checkboxes[pos]);
152 checked_checkboxes.push(checkboxes[pos]);
153 }
153 }
154 }
154 }
155 if(checked_checkboxes.length>1){
155 if(checked_checkboxes.length>1){
156 var rev_end = checked_checkboxes[0].name;
156 var rev_end = checked_checkboxes[0].name;
157 var rev_start = checked_checkboxes[checked_checkboxes.length-1].name;
157 var rev_start = checked_checkboxes[checked_checkboxes.length-1].name;
158
158
159 var url = url_tmpl.replace('__REVRANGE__',
159 var url = url_tmpl.replace('__REVRANGE__',
160 rev_start+'...'+rev_end);
160 rev_start+'...'+rev_end);
161
161
162 var link = "<a href="+url+">${_('Show selected changes __S -> __E')}</a>"
162 var link = "<a href="+url+">${_('Show selected changes __S -> __E')}</a>"
163 link = link.replace('__S',rev_start);
163 link = link.replace('__S',rev_start.substr(0,6));
164 link = link.replace('__E',rev_end);
164 link = link.replace('__E',rev_end.substr(0,6));
165 YUD.get('rev_range_container').innerHTML = link;
165 YUD.get('rev_range_container').innerHTML = link;
166 YUD.setStyle('rev_range_container','display','');
166 YUD.setStyle('rev_range_container','display','');
167 }
167 }
168 else{
168 else{
169 YUD.setStyle('rev_range_container','display','none');
169 YUD.setStyle('rev_range_container','display','none');
170
170
171 }
171 }
172 });
172 });
173
173
174 var msgs = YUQ('.message');
174 var msgs = YUQ('.message');
175 // get first element height
175 // get first element height
176 var el = YUQ('#graph_content .container')[0];
176 var el = YUQ('#graph_content .container')[0];
177 var row_h = el.clientHeight;
177 var row_h = el.clientHeight;
178 for(var i=0;i<msgs.length;i++){
178 for(var i=0;i<msgs.length;i++){
179 var m = msgs[i];
179 var m = msgs[i];
180
180
181 var h = m.clientHeight;
181 var h = m.clientHeight;
182 var pad = YUD.getStyle(m,'padding');
182 var pad = YUD.getStyle(m,'padding');
183 if(h > row_h){
183 if(h > row_h){
184 var offset = row_h - (h+12);
184 var offset = row_h - (h+12);
185 YUD.setStyle(m.nextElementSibling,'display','block');
185 YUD.setStyle(m.nextElementSibling,'display','block');
186 YUD.setStyle(m.nextElementSibling,'margin-top',offset+'px');
186 YUD.setStyle(m.nextElementSibling,'margin-top',offset+'px');
187 };
187 };
188 }
188 }
189 YUE.on(YUQ('.expand'),'click',function(e){
189 YUE.on(YUQ('.expand'),'click',function(e){
190 var elem = e.currentTarget.parentNode.parentNode;
190 var elem = e.currentTarget.parentNode.parentNode;
191 YUD.setStyle(e.currentTarget,'display','none');
191 YUD.setStyle(e.currentTarget,'display','none');
192 YUD.setStyle(elem,'height','auto');
192 YUD.setStyle(elem,'height','auto');
193
193
194 //redraw the graph, max_w and jsdata are global vars
194 //redraw the graph, max_w and jsdata are global vars
195 set_canvas(max_w);
195 set_canvas(max_w);
196
196
197 var r = new BranchRenderer();
197 var r = new BranchRenderer();
198 r.render(jsdata,max_w);
198 r.render(jsdata,max_w);
199
199
200 })
200 })
201
201
202 // Fetch changeset details
202 // Fetch changeset details
203 YUE.on(YUD.getElementsByClassName('changed_total'),'click',function(e){
203 YUE.on(YUD.getElementsByClassName('changed_total'),'click',function(e){
204 var id = e.currentTarget.id
204 var id = e.currentTarget.id
205 var url = "${h.url('changelog_details',repo_name=c.repo_name,cs='__CS__')}"
205 var url = "${h.url('changelog_details',repo_name=c.repo_name,cs='__CS__')}"
206 var url = url.replace('__CS__',id);
206 var url = url.replace('__CS__',id);
207 ypjax(url,id,function(){tooltip_activate()});
207 ypjax(url,id,function(){tooltip_activate()});
208 });
208 });
209
209
210 // change branch filter
210 // change branch filter
211 YUE.on(YUD.get('branch_filter'),'change',function(e){
211 YUE.on(YUD.get('branch_filter'),'change',function(e){
212 var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value;
212 var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value;
213 var url_main = "${h.url('changelog_home',repo_name=c.repo_name)}";
213 var url_main = "${h.url('changelog_home',repo_name=c.repo_name)}";
214 var url = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}";
214 var url = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}";
215 var url = url.replace('__BRANCH__',selected_branch);
215 var url = url.replace('__BRANCH__',selected_branch);
216 if(selected_branch != ''){
216 if(selected_branch != ''){
217 window.location = url;
217 window.location = url;
218 }else{
218 }else{
219 window.location = url_main;
219 window.location = url_main;
220 }
220 }
221
221
222 });
222 });
223
223
224 function set_canvas(heads) {
224 function set_canvas(heads) {
225 var c = document.getElementById('graph_nodes');
225 var c = document.getElementById('graph_nodes');
226 var t = document.getElementById('graph_content');
226 var t = document.getElementById('graph_content');
227 canvas = document.getElementById('graph_canvas');
227 canvas = document.getElementById('graph_canvas');
228 var div_h = t.clientHeight;
228 var div_h = t.clientHeight;
229 c.style.height=div_h+'px';
229 c.style.height=div_h+'px';
230 canvas.setAttribute('height',div_h);
230 canvas.setAttribute('height',div_h);
231 c.style.height=max_w+'px';
231 c.style.height=max_w+'px';
232 canvas.setAttribute('width',max_w);
232 canvas.setAttribute('width',max_w);
233 };
233 };
234 var heads = 1;
234 var heads = 1;
235 var max_heads = 0;
235 var max_heads = 0;
236 var jsdata = ${c.jsdata|n};
236 var jsdata = ${c.jsdata|n};
237
237
238 for( var i=0;i<jsdata.length;i++){
238 for( var i=0;i<jsdata.length;i++){
239 var m = Math.max.apply(Math, jsdata[i][1]);
239 var m = Math.max.apply(Math, jsdata[i][1]);
240 if (m>max_heads){
240 if (m>max_heads){
241 max_heads = m;
241 max_heads = m;
242 }
242 }
243 }
243 }
244 var max_w = Math.max(100,max_heads*25);
244 var max_w = Math.max(100,max_heads*25);
245 set_canvas(max_w);
245 set_canvas(max_w);
246
246
247 var r = new BranchRenderer();
247 var r = new BranchRenderer();
248 r.render(jsdata,max_w);
248 r.render(jsdata,max_w);
249
249
250 });
250 });
251 </script>
251 </script>
252 %else:
252 %else:
253 ${_('There are no changes yet')}
253 ${_('There are no changes yet')}
254 %endif
254 %endif
255 </div>
255 </div>
256 </div>
256 </div>
257 </%def>
257 </%def>
General Comments 0
You need to be logged in to leave comments. Login now