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