Show More
@@ -1,209 +1,205 | |||
|
1 | 1 | ## -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | <%inherit file="/base/base.html"/> |
|
4 | 4 | |
|
5 | 5 | <%def name="title()"> |
|
6 | 6 | ${c.repo_name} ${_('Changelog')} - ${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 | » |
|
12 | 12 | ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))} |
|
13 | 13 | » |
|
14 | 14 | ${_('Changelog')} - ${_('showing ')} ${c.size if c.size <= c.total_cs else c.total_cs} ${_('out of')} ${c.total_cs} ${_('revisions')} |
|
15 | 15 | </%def> |
|
16 | 16 | |
|
17 | 17 | <%def name="page_nav()"> |
|
18 | 18 | ${self.menu('changelog')} |
|
19 | 19 | </%def> |
|
20 | 20 | |
|
21 | 21 | <%def name="main()"> |
|
22 | 22 | <div class="box"> |
|
23 | 23 | <!-- box / title --> |
|
24 | 24 | <div class="title"> |
|
25 | 25 | ${self.breadcrumbs()} |
|
26 | 26 | </div> |
|
27 | 27 | <div class="table"> |
|
28 | 28 | % if c.pagination: |
|
29 | 29 | <div id="graph"> |
|
30 | 30 | <div id="graph_nodes"> |
|
31 | 31 | <canvas id="graph_canvas"></canvas> |
|
32 | 32 | </div> |
|
33 | 33 | <div id="graph_content"> |
|
34 | 34 | <div class="container_header"> |
|
35 | 35 | ${h.form(h.url.current(),method='get')} |
|
36 | 36 | <div class="info_box" style="float:left"> |
|
37 | 37 | ${h.submit('set',_('Show'),class_="ui-btn")} |
|
38 | 38 | ${h.text('size',size=1,value=c.size)} |
|
39 | 39 | ${_('revisions')} |
|
40 | 40 | </div> |
|
41 | 41 | ${h.end_form()} |
|
42 | 42 | <div id="rev_range_container" style="display:none"></div> |
|
43 | 43 | <div style="float:right">${h.select('branch_filter',c.branch_name,c.branch_filters)}</div> |
|
44 | 44 | </div> |
|
45 | 45 | |
|
46 | 46 | %for cnt,cs in enumerate(c.pagination): |
|
47 | 47 | <div id="chg_${cnt+1}" class="container ${'tablerow1' if cnt%2==0 else 'tablerow2'}"> |
|
48 | 48 | <div class="left"> |
|
49 | 49 | <div> |
|
50 | 50 | ${h.checkbox(cs.short_id,class_="changeset_range")} |
|
51 | 51 | <span class="tooltip" title="${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> |
|
52 | 52 | </div> |
|
53 | 53 | <div class="author"> |
|
54 | 54 | <div class="gravatar"> |
|
55 | 55 | <img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),16)}"/> |
|
56 | 56 | </div> |
|
57 | 57 | <div title="${cs.author}" class="user">${h.person(cs.author)}</div> |
|
58 | 58 | </div> |
|
59 | 59 | </div> |
|
60 | 60 | <div class="mid"> |
|
61 | 61 | <div class="message">${h.link_to(h.wrap_paragraphs(cs.message),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div> |
|
62 | 62 | </div> |
|
63 | 63 | <div class="right"> |
|
64 | 64 | <div id="${cs.raw_id}_changes_info" class="changes"> |
|
65 | 65 | <span id="${cs.raw_id}" class="changed_total tooltip" title="${_('Affected number of files, click to show more details')}">${len(cs.affected_files)}</span> |
|
66 | 66 | </div> |
|
67 | 67 | %if cs.parents: |
|
68 | 68 | %for p_cs in reversed(cs.parents): |
|
69 | 69 | <div class="parent">${_('Parent')} |
|
70 | 70 | <span class="changeset_id">${p_cs.revision}:<span class="changeset_hash">${h.link_to(h.short_id(p_cs.raw_id), |
|
71 | 71 | h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}</span></span> |
|
72 | 72 | </div> |
|
73 | 73 | %endfor |
|
74 | 74 | %else: |
|
75 | 75 | <div class="parent">${_('No parents')}</div> |
|
76 | 76 | %endif |
|
77 | 77 | |
|
78 | 78 | <span class="logtags"> |
|
79 | 79 | %if len(cs.parents)>1: |
|
80 | 80 | <span class="merge">${_('merge')}</span> |
|
81 | 81 | %endif |
|
82 | 82 | %if cs.branch: |
|
83 | 83 | <span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}"> |
|
84 | 84 | ${h.link_to(cs.branch,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span> |
|
85 | 85 | %endif |
|
86 | 86 | %for tag in cs.tags: |
|
87 | 87 | <span class="tagtag" title="${'%s %s' % (_('tag'),tag)}"> |
|
88 | 88 | ${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span> |
|
89 | 89 | %endfor |
|
90 | 90 | </span> |
|
91 | 91 | </div> |
|
92 | 92 | </div> |
|
93 | 93 | |
|
94 | 94 | %endfor |
|
95 | 95 | <div class="pagination-wh pagination-left"> |
|
96 | 96 | ${c.pagination.pager('$link_previous ~2~ $link_next')} |
|
97 | 97 | </div> |
|
98 | 98 | </div> |
|
99 | 99 | </div> |
|
100 | 100 | |
|
101 | 101 | <script type="text/javascript" src="${h.url('/js/graph.js')}"></script> |
|
102 | 102 | <script type="text/javascript"> |
|
103 | 103 | YAHOO.util.Event.onDOMReady(function(){ |
|
104 | 104 | |
|
105 | 105 | //Monitor range checkboxes and build a link to changesets |
|
106 | 106 | //ranges |
|
107 | 107 | var checkboxes = YUD.getElementsByClassName('changeset_range'); |
|
108 | 108 | var url_tmpl = "${h.url('changeset_home',repo_name=c.repo_name,revision='__REVRANGE__')}"; |
|
109 | 109 | YUE.on(checkboxes,'click',function(e){ |
|
110 | 110 | var checked_checkboxes = []; |
|
111 | 111 | for (pos in checkboxes){ |
|
112 | 112 | if(checkboxes[pos].checked){ |
|
113 | 113 | checked_checkboxes.push(checkboxes[pos]); |
|
114 | 114 | } |
|
115 | 115 | } |
|
116 | 116 | if(checked_checkboxes.length>1){ |
|
117 | 117 | var rev_end = checked_checkboxes[0].name; |
|
118 | 118 | var rev_start = checked_checkboxes[checked_checkboxes.length-1].name; |
|
119 | 119 | |
|
120 | 120 | var url = url_tmpl.replace('__REVRANGE__', |
|
121 | 121 | rev_start+'...'+rev_end); |
|
122 | 122 | |
|
123 | 123 | var link = "<a href="+url+">${_('Show selected changes __S -> __E')}</a>" |
|
124 | 124 | link = link.replace('__S',rev_start); |
|
125 | 125 | link = link.replace('__E',rev_end); |
|
126 | 126 | YUD.get('rev_range_container').innerHTML = link; |
|
127 | 127 | YUD.setStyle('rev_range_container','display',''); |
|
128 | 128 | } |
|
129 | 129 | else{ |
|
130 | 130 | YUD.setStyle('rev_range_container','display','none'); |
|
131 | 131 | |
|
132 | 132 | } |
|
133 | 133 | }); |
|
134 | 134 | |
|
135 | 135 | // Fetch changeset details |
|
136 | 136 | YUE.on(YUD.getElementsByClassName('changed_total'),'click',function(e){ |
|
137 | 137 | var id = e.currentTarget.id |
|
138 | 138 | var url = "${h.url('changelog_details',repo_name=c.repo_name,cs='__CS__')}" |
|
139 | 139 | var url = url.replace('__CS__',id); |
|
140 | 140 | ypjax(url,id+'_changes_info',function(){tooltip_activate()}); |
|
141 | 141 | }); |
|
142 | 142 | |
|
143 | 143 | // change branch filter |
|
144 | 144 | YUE.on(YUD.get('branch_filter'),'change',function(e){ |
|
145 | 145 | var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value; |
|
146 | 146 | console.log(selected_branch); |
|
147 | 147 | var url_main = "${h.url('changelog_home',repo_name=c.repo_name)}"; |
|
148 | 148 | var url = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}"; |
|
149 | 149 | var url = url.replace('__BRANCH__',selected_branch); |
|
150 | 150 | if(selected_branch != ''){ |
|
151 | 151 | window.location = url; |
|
152 | 152 | }else{ |
|
153 | 153 | window.location = url_main; |
|
154 | 154 | } |
|
155 | 155 | |
|
156 | 156 | }); |
|
157 | 157 | |
|
158 | 158 | // Expand long messages on click |
|
159 | 159 | var messages = YUD.getElementsByClassName('message'); |
|
160 | 160 | for (idx in messages) { |
|
161 | 161 | var msg = messages[idx]; |
|
162 | 162 | // would the message be clipped? |
|
163 | 163 | if (msg.scrollHeight > msg.parentNode.parentNode.offsetHeight) |
|
164 | 164 | { |
|
165 | 165 | msg.style.cursor = 's-resize'; |
|
166 | 166 | msg.onclick = function() { |
|
167 | 167 | this.parentNode.parentNode.style.height = 'auto'; |
|
168 | repaint_graph(); | |
|
169 | 168 | } |
|
170 | 169 | } |
|
171 | 170 | } |
|
172 | 171 | |
|
173 |
function set_canvas( |
|
|
172 | function set_canvas(heads) { | |
|
174 | 173 | var c = document.getElementById('graph_nodes'); |
|
175 | 174 | var t = document.getElementById('graph_content'); |
|
176 | 175 | canvas = document.getElementById('graph_canvas'); |
|
177 | 176 | var div_h = t.clientHeight; |
|
178 | 177 | c.style.height=div_h+'px'; |
|
179 | 178 | canvas.setAttribute('height',div_h); |
|
180 | 179 | c.style.height=max_w+'px'; |
|
181 | 180 | canvas.setAttribute('width',max_w); |
|
182 | 181 | }; |
|
183 | function calc_max_w(jsdata) { | |
|
184 |
|
|
|
185 | var max_heads = 0; | |
|
186 | for( var i=0;i<jsdata.length;i++){ | |
|
187 | var m = Math.max.apply(Math, jsdata[i][1]); | |
|
188 | if (m>max_heads){ | |
|
189 |
|
|
|
190 | } | |
|
191 |
|
|
|
192 | return Math.max(100,max_heads*25); | |
|
182 | var heads = 1; | |
|
183 | var max_heads = 0; | |
|
184 | var jsdata = ${c.jsdata|n}; | |
|
185 | ||
|
186 | for( var i=0;i<jsdata.length;i++){ | |
|
187 | var m = Math.max.apply(Math, jsdata[i][1]); | |
|
188 | if (m>max_heads){ | |
|
189 | max_heads = m; | |
|
190 | } | |
|
193 | 191 | } |
|
194 | function repaint_graph() { | |
|
195 | var jsdata = ${c.jsdata|n}; | |
|
196 | var max_w = calc_max_w(jsdata); | |
|
197 | set_canvas(max_w); | |
|
198 | var r = new BranchRenderer(); | |
|
199 | r.render(jsdata,max_w); | |
|
200 | } | |
|
201 | repaint_graph (); | |
|
192 | var max_w = Math.max(100,max_heads*25); | |
|
193 | set_canvas(max_w); | |
|
194 | ||
|
195 | var r = new BranchRenderer(); | |
|
196 | r.render(jsdata,max_w); | |
|
197 | ||
|
202 | 198 | }); |
|
203 | 199 | </script> |
|
204 | 200 | %else: |
|
205 | 201 | ${_('There are no changes yet')} |
|
206 | 202 | %endif |
|
207 | 203 | </div> |
|
208 | 204 | </div> |
|
209 | 205 | </%def> No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now