##// END OF EJS Templates
changelog: improve texts and functionality regarding selecting changesets
Mads Kiilerich -
r3445:246ab6d8 beta
parent child Browse files
Show More
@@ -1,113 +1,114 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <!DOCTYPE html>
3 3 <html xmlns="http://www.w3.org/1999/xhtml">
4 4 <head>
5 5 <title>${self.title()}</title>
6 6 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
7 7 <meta name="robots" content="index, nofollow"/>
8 8 <link rel="icon" href="${h.url('/images/icons/database_gear.png')}" type="image/png" />
9 9
10 10 ## CSS ###
11 11 <%def name="css()">
12 12 <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css', ver=c.rhodecode_version)}" media="screen"/>
13 13 <link rel="stylesheet" type="text/css" href="${h.url('/css/pygments.css', ver=c.rhodecode_version)}"/>
14 14 ## EXTRA FOR CSS
15 15 ${self.css_extra()}
16 16 </%def>
17 17 <%def name="css_extra()">
18 18 </%def>
19 19
20 20 ${self.css()}
21 21
22 22 %if c.ga_code:
23 23 <!-- Analytics -->
24 24 <script type="text/javascript">
25 25 var _gaq = _gaq || [];
26 26 _gaq.push(['_setAccount', '${c.ga_code}']);
27 27 _gaq.push(['_trackPageview']);
28 28
29 29 (function() {
30 30 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
31 31 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
32 32 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
33 33 })();
34 34 </script>
35 35 %endif
36 36
37 37 ## JAVASCRIPT ##
38 38 <%def name="js()">
39 39 <script type="text/javascript">
40 40 //JS translations map
41 41 var TRANSLATION_MAP = {
42 42 'add another comment':'${_("add another comment")}',
43 43 'Stop following this repository':"${_('Stop following this repository')}",
44 44 'Start following this repository':"${_('Start following this repository')}",
45 45 'Group':"${_('Group')}",
46 46 'members':"${_('members')}",
47 47 'loading...':"${_('loading...')}",
48 48 'search truncated': "${_('search truncated')}",
49 49 'no matching files': "${_('no matching files')}",
50 50 'Open new pull request': "${_('Open new pull request')}",
51 51 'Open new pull request for selected changesets': "${_('Open new pull request for selected changesets')}",
52 52 'Show selected changes __S -> __E': "${_('Show selected changes __S -> __E')}",
53 'Show selected change __S': "${_('Show selected change __S')}",
53 54 'Selection link': "${_('Selection link')}",
54 55 'collapse diff': "${_('collapse diff')}",
55 56 'expand diff': "${_('expand diff')}",
56 57 };
57 58 var _TM = TRANSLATION_MAP;
58 59
59 60 var TOGGLE_FOLLOW_URL = "${h.url('toggle_following')}";
60 61
61 62 </script>
62 63 <script type="text/javascript" src="${h.url('/js/yui.2.9.js', ver=c.rhodecode_version)}"></script>
63 64 <!--[if lt IE 9]>
64 65 <script language="javascript" type="text/javascript" src="${h.url('/js/excanvas.min.js')}"></script>
65 66 <![endif]-->
66 67 <script type="text/javascript" src="${h.url('/js/yui.flot.js', ver=c.rhodecode_version)}"></script>
67 68 <script type="text/javascript" src="${h.url('/js/native.history.js', ver=c.rhodecode_version)}"></script>
68 69 <script type="text/javascript" src="${h.url('/js/pyroutes_map.js', ver=c.rhodecode_version)}"></script>
69 70 <script type="text/javascript" src="${h.url('/js/rhodecode.js', ver=c.rhodecode_version)}"></script>
70 71 ## EXTRA FOR JS
71 72 ${self.js_extra()}
72 73 <script type="text/javascript">
73 74 (function(window,undefined){
74 75 // Prepare
75 76 var History = window.History; // Note: We are using a capital H instead of a lower h
76 77 if ( !History.enabled ) {
77 78 // History.js is disabled for this browser.
78 79 // This is because we can optionally choose to support HTML4 browsers or not.
79 80 return false;
80 81 }
81 82 })(window);
82 83
83 84 YUE.onDOMReady(function(){
84 85 tooltip_activate();
85 86 show_more_event();
86 87 show_changeset_tooltip();
87 88 // routes registration
88 89 pyroutes.register('toggle_following', "${h.url('toggle_following')}");
89 90 pyroutes.register('changeset_info', "${h.url('changeset_info', repo_name='%(repo_name)s', revision='%(revision)s')}", ['repo_name', 'revision']);
90 91 pyroutes.register('repo_size', "${h.url('repo_size', repo_name='%(repo_name)s')}", ['repo_name']);
91 92 })
92 93 </script>
93 94 </%def>
94 95 <%def name="js_extra()"></%def>
95 96 ${self.js()}
96 97 <%def name="head_extra()"></%def>
97 98 ${self.head_extra()}
98 99 </head>
99 100 <body id="body">
100 101 ## IE hacks
101 102 <!--[if IE 7]>
102 103 <script>YUD.addClass(document.body,'ie7')</script>
103 104 <![endif]-->
104 105 <!--[if IE 8]>
105 106 <script>YUD.addClass(document.body,'ie8')</script>
106 107 <![endif]-->
107 108 <!--[if IE 9]>
108 109 <script>YUD.addClass(document.body,'ie9')</script>
109 110 <![endif]-->
110 111
111 112 ${next.body()}
112 113 </body>
113 114 </html>
@@ -1,284 +1,286 b''
1 1 ## -*- coding: utf-8 -*-
2 2
3 3 <%inherit file="/base/base.html"/>
4 4
5 5 <%def name="title()">
6 6 ${_('%s Changelog') % c.repo_name} - ${c.rhodecode_name}
7 7 </%def>
8 8
9 9 <%def name="breadcrumbs_links()">
10 10 ${h.link_to(_(u'Home'),h.url('/'))}
11 11 &raquo;
12 12 ${h.repo_link(c.rhodecode_db_repo.groups_and_repo)}
13 13 &raquo;
14 14 <% size = c.size if c.size <= c.total_cs else c.total_cs %>
15 15 ${_('changelog')} - ${ungettext('showing %d out of %d revision', 'showing %d out of %d revisions', size) % (size, c.total_cs)}
16 16 </%def>
17 17
18 18 <%def name="page_nav()">
19 19 ${self.menu('changelog')}
20 20 </%def>
21 21
22 22 <%def name="main()">
23 23 <div class="box">
24 24 <!-- box / title -->
25 25 <div class="title">
26 26 ${self.breadcrumbs()}
27 27 </div>
28 28 <div class="table">
29 29 % if c.pagination:
30 30 <div id="graph">
31 31 <div id="graph_nodes">
32 32 <canvas id="graph_canvas"></canvas>
33 33 </div>
34 34 <div id="graph_content">
35 35 <div class="info_box" style="clear: both;padding: 10px 6px;text-align: right;">
36 36 <a href="#" class="ui-btn small" id="rev_range_container" style="display:none"></a>
37 37 <a href="#" class="ui-btn small" id="rev_range_clear" style="display:none">${_('Clear selection')}</a>
38 38
39 39 %if c.rhodecode_db_repo.fork:
40 <a 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')}" class="ui-btn small">${_('Compare fork with parent')}</a>
40 <a 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')}" class="ui-btn small">${_('Compare fork with parent')}</a>
41 41 %endif
42 42 %if h.is_hg(c.rhodecode_repo):
43 <a id="open_new_pr" href="${h.url('pullrequest_home',repo_name=c.repo_name)}" class="ui-btn small">${_('open new pull request')}</a>
43 <a id="open_new_pr" href="${h.url('pullrequest_form',repo_name=c.repo_name)}" class="ui-btn small">${_('Open new pull request')}</a>
44 44 %endif
45 45 </div>
46 46 <div class="container_header">
47 47 ${h.form(h.url.current(),method='get')}
48 48 <div class="info_box" style="float:left">
49 49 ${h.submit('set',_('Show'),class_="ui-btn")}
50 50 ${h.text('size',size=1,value=c.size)}
51 51 ${_('revisions')}
52 52 </div>
53 53 ${h.end_form()}
54 54 <div style="float:right">${h.select('branch_filter',c.branch_name,c.branch_filters)}</div>
55 55 </div>
56 56
57 57 %for cnt,cs in enumerate(c.pagination):
58 58 <div id="chg_${cnt+1}" class="container ${'tablerow%s' % (cnt%2)}">
59 59 <div class="left">
60 60 <div>
61 61 ${h.checkbox(cs.raw_id,class_="changeset_range")}
62 62 <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>
63 63 </div>
64 64 <div class="author">
65 65 <div class="gravatar">
66 66 <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(cs.author),16)}"/>
67 67 </div>
68 68 <div title="${cs.author}" class="user">${h.shorter(h.person(cs.author),22)}</div>
69 69 </div>
70 70 <div class="date">${h.fmt_date(cs.date)}</div>
71 71 </div>
72 72 <div class="mid">
73 73 <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>
74 <div class="expand"><span class="expandtext">&darr; ${_('show more')} &darr;</span></div>
74 <div class="expand"><span class="expandtext">&darr; ${_('Show more')} &darr;</span></div>
75 75 </div>
76 76 <div class="right">
77 77 <div class="changes">
78 78 <div id="changed_total_${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>
79 79 <div class="comments-container">
80 80 %if len(c.comments.get(cs.raw_id,[])) > 0:
81 81 <div class="comments-cnt" title="${('comments')}">
82 82 <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)}">
83 83 <div class="comments-cnt">${len(c.comments[cs.raw_id])}</div>
84 84 <img src="${h.url('/images/icons/comments.png')}">
85 85 </a>
86 86 </div>
87 87 %endif
88 88 </div>
89 89 <div class="changeset-status-container">
90 90 %if c.statuses.get(cs.raw_id):
91 91 <div title="${_('Changeset status')}" class="changeset-status-lbl">${c.statuses.get(cs.raw_id)[1]}</div>
92 92 <div class="changeset-status-ico">
93 93 %if c.statuses.get(cs.raw_id)[2]:
94 94 <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])}"><img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses.get(cs.raw_id)[0])}" /></a>
95 95 %else:
96 96 <img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses.get(cs.raw_id)[0])}" />
97 97 %endif
98 98 </div>
99 99 %endif
100 100 </div>
101 101 </div>
102 102 %if cs.parents:
103 103 %for p_cs in reversed(cs.parents):
104 104 <div class="parent">${_('Parent')}
105 105 <span class="changeset_id">${p_cs.revision}:<span class="changeset_hash">${h.link_to(h.short_id(p_cs.raw_id),
106 106 h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}</span></span>
107 107 </div>
108 108 %endfor
109 109 %else:
110 110 <div class="parent">${_('No parents')}</div>
111 111 %endif
112 112
113 113 <span class="logtags">
114 114 %if len(cs.parents)>1:
115 115 <span class="merge">${_('merge')}</span>
116 116 %endif
117 117 %if cs.branch:
118 118 <span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}">
119 119 ${h.link_to(h.shorter(cs.branch),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
120 120 </span>
121 121 %endif
122 122 %if h.is_hg(c.rhodecode_repo):
123 123 %for book in cs.bookmarks:
124 124 <span class="bookbook" title="${'%s %s' % (_('bookmark'),book)}">
125 125 ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
126 126 </span>
127 127 %endfor
128 128 %endif
129 129 %for tag in cs.tags:
130 130 <span class="tagtag" title="${'%s %s' % (_('tag'),tag)}">
131 131 ${h.link_to(h.shorter(tag),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
132 132 %endfor
133 133 </span>
134 134 </div>
135 135 </div>
136 136
137 137 %endfor
138 138 <div class="pagination-wh pagination-left">
139 139 ${c.pagination.pager('$link_previous ~2~ $link_next')}
140 140 </div>
141 141 </div>
142 142 </div>
143 143
144 144 <script type="text/javascript" src="${h.url('/js/graph.js')}"></script>
145 145 <script type="text/javascript">
146 146 YAHOO.util.Event.onDOMReady(function(){
147 147
148 148 //Monitor range checkboxes and build a link to changesets
149 149 //ranges
150 150 var checkboxes = YUD.getElementsByClassName('changeset_range');
151 151 var url_tmpl = "${h.url('changeset_home',repo_name=c.repo_name,revision='__REVRANGE__')}";
152 152 var pr_tmpl = "${h.url('pullrequest_home',repo_name=c.repo_name)}";
153 153 YUE.on(checkboxes,'click',function(e){
154 154 var clicked_cb = e.currentTarget;
155 155 var checked_checkboxes = [];
156 156 for (pos in checkboxes){
157 157 if(checkboxes[pos].checked){
158 158 checked_checkboxes.push(checkboxes[pos]);
159 159 }
160 160 }
161 161 if(YUD.get('open_new_pr')){
162 162 if(checked_checkboxes.length>0){
163 163 // modify open pull request to show we have selected cs
164 164 YUD.get('open_new_pr').innerHTML = _TM['Open new pull request for selected changesets'];
165
166 165 }else{
167 166 YUD.get('open_new_pr').innerHTML = _TM['Open new pull request'];
168 167 }
169 168 }
170 169
171 170 if(checked_checkboxes.length>0){
172 171 var rev_end = checked_checkboxes[0].name;
173 172 var rev_start = checked_checkboxes[checked_checkboxes.length-1].name;
174 173 var url = url_tmpl.replace('__REVRANGE__',
175 174 rev_start+'...'+rev_end);
176 175
177 var link = _TM['Show selected changes __S -> __E'];
176 var link = (rev_start == rev_end)
177 ? _TM['Show selected change __S']
178 : _TM['Show selected changes __S -> __E']";
179
178 180 link = link.replace('__S',rev_start.substr(0,6));
179 181 link = link.replace('__E',rev_end.substr(0,6));
180 182 YUD.get('rev_range_container').href = url;
181 183 YUD.get('rev_range_container').innerHTML = link;
182 184 YUD.setStyle('rev_range_container','display','');
183 185 YUD.setStyle('rev_range_clear','display','');
184 186
185 187 YUD.get('open_new_pr').href = pr_tmpl + '?rev_start={0}&rev_end={1}'.format(rev_start,rev_end);
186 188
187 189 }
188 190 else{
189 191 YUD.setStyle('rev_range_container','display','none');
190 192 YUD.setStyle('rev_range_clear','display','none');
191 193 }
192 194 });
193 195 YUE.on('rev_range_clear','click',function(e){
194 196 for (var i=0; i<checkboxes.length; i++){
195 197 var cb = checkboxes[i];
196 198 cb.checked = false;
197 199 }
198 200 YUE.preventDefault(e);
199 201 })
200 202 var msgs = YUQ('.message');
201 203 // get first element height
202 204 var el = YUQ('#graph_content .container')[0];
203 205 var row_h = el.clientHeight;
204 206 for(var i=0;i<msgs.length;i++){
205 207 var m = msgs[i];
206 208
207 209 var h = m.clientHeight;
208 210 var pad = YUD.getStyle(m,'padding');
209 211 if(h > row_h){
210 212 var offset = row_h - (h+12);
211 213 YUD.setStyle(m.nextElementSibling,'display','block');
212 214 YUD.setStyle(m.nextElementSibling,'margin-top',offset+'px');
213 215 };
214 216 }
215 217 YUE.on(YUQ('.expand'),'click',function(e){
216 218 var elem = e.currentTarget.parentNode.parentNode;
217 219 YUD.setStyle(e.currentTarget,'display','none');
218 220 YUD.setStyle(elem,'height','auto');
219 221
220 222 //redraw the graph, line_count and jsdata are global vars
221 223 set_canvas(100);
222 224
223 225 var r = new BranchRenderer();
224 226 r.render(jsdata,100,line_count);
225 227
226 228 })
227 229
228 230 // Fetch changeset details
229 231 YUE.on(YUD.getElementsByClassName('changed_total'),'click',function(e){
230 232 var id = e.currentTarget.id;
231 233 var url = "${h.url('changelog_details',repo_name=c.repo_name,cs='__CS__')}";
232 234 var url = url.replace('__CS__',id.replace('changed_total_',''));
233 235 ypjax(url,id,function(){tooltip_activate()});
234 236 });
235 237
236 238 // change branch filter
237 239 YUE.on(YUD.get('branch_filter'),'change',function(e){
238 240 var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value;
239 241 var url_main = "${h.url('changelog_home',repo_name=c.repo_name)}";
240 242 var url = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}";
241 243 var url = url.replace('__BRANCH__',selected_branch);
242 244 if(selected_branch != ''){
243 245 window.location = url;
244 246 }else{
245 247 window.location = url_main;
246 248 }
247 249
248 250 });
249 251
250 252 function set_canvas(width) {
251 253 var c = document.getElementById('graph_nodes');
252 254 var t = document.getElementById('graph_content');
253 255 canvas = document.getElementById('graph_canvas');
254 256 var div_h = t.clientHeight;
255 257 c.style.height=div_h+'px';
256 258 canvas.setAttribute('height',div_h);
257 259 c.style.height=width+'px';
258 260 canvas.setAttribute('width',width);
259 261 };
260 262 var heads = 1;
261 263 var line_count = 0;
262 264 var jsdata = ${c.jsdata|n};
263 265
264 266 for (var i=0;i<jsdata.length;i++) {
265 267 var in_l = jsdata[i][2];
266 268 for (var j in in_l) {
267 269 var m = in_l[j][1];
268 270 if (m > line_count)
269 271 line_count = m;
270 272 }
271 273 }
272 274 set_canvas(100);
273 275
274 276 var r = new BranchRenderer();
275 277 r.render(jsdata,100,line_count);
276 278
277 279 });
278 280 </script>
279 281 %else:
280 282 ${_('There are no changes yet')}
281 283 %endif
282 284 </div>
283 285 </div>
284 286 </%def>
General Comments 0
You need to be logged in to leave comments. Login now