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