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