Show More
@@ -1,296 +1,296 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} · |
|
7 | 7 | %if c.changelog_for_path: |
|
8 | 8 | /${c.changelog_for_path} · |
|
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 | 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])}"> |
|
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 | 82 | <img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses.get(cs.raw_id)[0])}" /> |
|
83 | 83 | %endif |
|
84 | 84 | </div> |
|
85 | 85 | %endif |
|
86 | 86 | </td> |
|
87 | 87 | <td class="author"> |
|
88 | 88 | <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(cs.author),16)}"/> |
|
89 | 89 | <span title="${cs.author}" class="user">${h.shorter(h.person(cs.author),22)}</span> |
|
90 | 90 | </td> |
|
91 | 91 | <td class="hash" style="width:${len(h.show_id(cs))*6.5}px"> |
|
92 | 92 | <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}"> |
|
93 | 93 | <span class="changeset_hash">${h.show_id(cs)}</span> |
|
94 | 94 | </a> |
|
95 | 95 | </td> |
|
96 | 96 | <td class="date"> |
|
97 | 97 | <div class="date">${h.age(cs.date,True)}</div> |
|
98 | 98 | </td> |
|
99 | 99 | <td class="mid"> |
|
100 | 100 | <div class="log-container"> |
|
101 | 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> |
|
102 | 102 | <div class="expand"><span class="expandtext">↓ ${_('Show more')} ↓</span></div> |
|
103 | 103 | <div class="extra-container"> |
|
104 | 104 | %if c.comments.get(cs.raw_id): |
|
105 | 105 | <div class="comments-container"> |
|
106 | 106 | <div class="comments-cnt" title="${('comments')}"> |
|
107 | 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)}"> |
|
108 | 108 | ${len(c.comments[cs.raw_id])} |
|
109 | 109 | </a> |
|
110 | 110 | </div> |
|
111 | 111 | </div> |
|
112 | 112 | %endif |
|
113 | 113 | %if h.is_hg(c.rhodecode_repo): |
|
114 | 114 | %for book in cs.bookmarks: |
|
115 | 115 | <div class="booktag" title="${_('Bookmark %s') % book}"> |
|
116 | 116 | ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))} |
|
117 | 117 | </div> |
|
118 | 118 | %endfor |
|
119 | 119 | %endif |
|
120 | 120 | %for tag in cs.tags: |
|
121 | 121 | <div class="tagtag" title="${_('Tag %s') % tag}"> |
|
122 | 122 | ${h.link_to(h.shorter(tag),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))} |
|
123 | 123 | </div> |
|
124 | 124 | %endfor |
|
125 | 125 | %if (not c.branch_name) and cs.branch: |
|
126 | 126 | <div class="branchtag" title="${_('Branch %s' % cs.branch)}"> |
|
127 | 127 | ${h.link_to(h.shorter(cs.branch),h.url('changelog_home',repo_name=c.repo_name,branch=cs.branch))} |
|
128 | 128 | </div> |
|
129 | 129 | %endif |
|
130 | 130 | </div> |
|
131 | 131 | </div> |
|
132 | 132 | </td> |
|
133 | 133 | </tr> |
|
134 | 134 | %endfor |
|
135 | 135 | </tbody> |
|
136 | 136 | </table> |
|
137 | 137 | |
|
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 | // register our routes needed for this view |
|
152 | 152 | pyroutes.register('changeset_home', "${h.url('changeset_home', repo_name='%(repo_name)s', revision='%(revision)s')}", ['repo_name', 'revision']); |
|
153 | 153 | pyroutes.register('changelog_home', "${h.url('changelog_home', repo_name='%(repo_name)s')}", ['repo_name']); |
|
154 | 154 | pyroutes.register('pullrequest_home', "${h.url('pullrequest_home', repo_name='%(repo_name)s')}", ['repo_name']); |
|
155 | 155 | |
|
156 | 156 | var checkbox_checker = function(e){ |
|
157 | 157 | var checked_checkboxes = []; |
|
158 | 158 | for (pos in checkboxes){ |
|
159 | 159 | if(checkboxes[pos].checked){ |
|
160 | 160 | checked_checkboxes.push(checkboxes[pos]); |
|
161 | 161 | } |
|
162 | 162 | } |
|
163 | 163 | if(YUD.get('open_new_pr')){ |
|
164 | 164 | if(checked_checkboxes.length>1){ |
|
165 | 165 | YUD.setStyle('open_new_pr','display','none'); |
|
166 | 166 | } else { |
|
167 | 167 | YUD.setStyle('open_new_pr','display',''); |
|
168 | 168 | if(checked_checkboxes.length>0){ |
|
169 | 169 | YUD.get('open_new_pr').innerHTML = _TM['Open new pull request for selected changesets']; |
|
170 | 170 | }else{ |
|
171 | 171 | YUD.get('open_new_pr').innerHTML = _TM['Open new pull request']; |
|
172 | 172 | } |
|
173 | 173 | } |
|
174 | 174 | } |
|
175 | 175 | |
|
176 | 176 | if(checked_checkboxes.length>0){ |
|
177 | 177 | var rev_end = checked_checkboxes[0].name; |
|
178 | 178 | var rev_start = checked_checkboxes[checked_checkboxes.length-1].name; |
|
179 | 179 | var url = pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}', |
|
180 | 180 | 'revision': rev_start+'...'+rev_end}); |
|
181 | 181 | |
|
182 | 182 | var link = (rev_start == rev_end) |
|
183 | 183 | ? _TM['Show selected changeset __S'] |
|
184 | 184 | : _TM['Show selected changesets __S -> __E']; |
|
185 | 185 | |
|
186 | 186 | link = link.replace('__S',rev_start.substr(0,6)); |
|
187 | 187 | link = link.replace('__E',rev_end.substr(0,6)); |
|
188 | 188 | YUD.get('rev_range_container').href = url; |
|
189 | 189 | YUD.get('rev_range_container').innerHTML = link; |
|
190 | 190 | YUD.setStyle('rev_range_container','display',''); |
|
191 | 191 | YUD.setStyle('rev_range_clear','display',''); |
|
192 | 192 | |
|
193 | 193 | YUD.get('open_new_pr').href = pyroutes.url('pullrequest_home', |
|
194 | 194 | {'repo_name': '${c.repo_name}', |
|
195 | 195 | 'rev_start': rev_start, |
|
196 | 196 | 'rev_end': rev_end}) |
|
197 | 197 | |
|
198 | 198 | YUD.setStyle('compare_fork','display','none'); |
|
199 | 199 | }else{ |
|
200 | 200 | YUD.setStyle('rev_range_container','display','none'); |
|
201 | 201 | YUD.setStyle('rev_range_clear','display','none'); |
|
202 | 202 | %if c.branch_name: |
|
203 | 203 | YUD.get('open_new_pr').href = pyroutes.url('pullrequest_home', |
|
204 | 204 | {'repo_name': '${c.repo_name}', |
|
205 | 205 | 'branch':'${c.branch_name}'}); |
|
206 | 206 | %else: |
|
207 | 207 | YUD.get('open_new_pr').href = pyroutes.url('pullrequest_home', |
|
208 | 208 | {'repo_name': '${c.repo_name}'}); |
|
209 | 209 | %endif |
|
210 | 210 | YUD.setStyle('compare_fork','display',''); |
|
211 | 211 | } |
|
212 | 212 | }; |
|
213 | 213 | YUE.onDOMReady(checkbox_checker); |
|
214 | 214 | YUE.on(checkboxes,'click', checkbox_checker); |
|
215 | 215 | |
|
216 | 216 | YUE.on('rev_range_clear','click',function(e){ |
|
217 | 217 | for (var i=0; i<checkboxes.length; i++){ |
|
218 | 218 | var cb = checkboxes[i]; |
|
219 | 219 | cb.checked = false; |
|
220 | 220 | } |
|
221 | 221 | checkbox_checker(); |
|
222 | 222 | YUE.preventDefault(e); |
|
223 | 223 | }); |
|
224 | 224 | |
|
225 | 225 | var msgs = YUQ('.message'); |
|
226 | 226 | // get first element height |
|
227 | 227 | var el = YUQ('#graph_content .container')[0]; |
|
228 | 228 | var row_h = el.clientHeight; |
|
229 | 229 | for(var i=0;i<msgs.length;i++){ |
|
230 | 230 | var m = msgs[i]; |
|
231 | 231 | |
|
232 | 232 | var h = m.clientHeight; |
|
233 | 233 | var pad = YUD.getStyle(m,'padding'); |
|
234 | 234 | if(h > row_h){ |
|
235 | 235 | var offset = row_h - (h+12); |
|
236 | 236 | YUD.setStyle(m.nextElementSibling,'display','block'); |
|
237 | 237 | YUD.setStyle(m.nextElementSibling,'margin-top',offset+'px'); |
|
238 | 238 | }; |
|
239 | 239 | } |
|
240 | 240 | YUE.on(YUQ('.expand'),'click',function(e){ |
|
241 | 241 | var elem = e.currentTarget.parentNode.parentNode; |
|
242 | 242 | YUD.setStyle(e.currentTarget,'display','none'); |
|
243 | 243 | YUD.setStyle(elem,'height','auto'); |
|
244 | 244 | |
|
245 | 245 | //redraw the graph, line_count and jsdata are global vars |
|
246 | 246 | set_canvas(100); |
|
247 | 247 | |
|
248 | 248 | var r = new BranchRenderer(); |
|
249 | 249 | r.render(jsdata,100,line_count); |
|
250 | 250 | |
|
251 | 251 | }); |
|
252 | 252 | |
|
253 | 253 | // change branch filter |
|
254 | 254 | YUE.on(YUD.get('branch_filter'),'change',function(e){ |
|
255 | 255 | var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value; |
|
256 | 256 | if(selected_branch != ''){ |
|
257 | 257 | window.location = pyroutes.url('changelog_home', {'repo_name': '${c.repo_name}', |
|
258 |
'branch': |
|
|
258 | 'branch':selected_branch}); | |
|
259 | 259 | }else{ |
|
260 | 260 | window.location = pyroutes.url('changelog_home', {'repo_name': '${c.repo_name}'}); |
|
261 | 261 | } |
|
262 | 262 | }); |
|
263 | 263 | |
|
264 | 264 | function set_canvas(width) { |
|
265 | 265 | var c = document.getElementById('graph_nodes'); |
|
266 | 266 | var t = document.getElementById('graph_content'); |
|
267 | 267 | canvas = document.getElementById('graph_canvas'); |
|
268 | 268 | var div_h = t.clientHeight; |
|
269 | 269 | canvas.setAttribute('height',div_h); |
|
270 | 270 | canvas.setAttribute('width',width); |
|
271 | 271 | }; |
|
272 | 272 | var heads = 1; |
|
273 | 273 | var line_count = 0; |
|
274 | 274 | var jsdata = ${c.jsdata|n}; |
|
275 | 275 | |
|
276 | 276 | for (var i=0;i<jsdata.length;i++) { |
|
277 | 277 | var in_l = jsdata[i][2]; |
|
278 | 278 | for (var j in in_l) { |
|
279 | 279 | var m = in_l[j][1]; |
|
280 | 280 | if (m > line_count) |
|
281 | 281 | line_count = m; |
|
282 | 282 | } |
|
283 | 283 | } |
|
284 | 284 | set_canvas(100); |
|
285 | 285 | |
|
286 | 286 | var r = new BranchRenderer(); |
|
287 | 287 | r.render(jsdata,100,line_count); |
|
288 | 288 | |
|
289 | 289 | }); |
|
290 | 290 | </script> |
|
291 | 291 | %else: |
|
292 | 292 | ${_('There are no changes yet')} |
|
293 | 293 | %endif |
|
294 | 294 | </div> |
|
295 | 295 | </div> |
|
296 | 296 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now