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