##// END OF EJS Templates
changelog: re-render branch graph on page resize...
domruf -
r6622:d5ec8035 default
parent child Browse files
Show More
@@ -1,329 +1,333 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 <%block name="title">
5 <%block 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 </%block>
10 </%block>
11
11
12 <%def name="breadcrumbs_links()">
12 <%def name="breadcrumbs_links()">
13 <% size = c.size if c.size <= c.total_cs else c.total_cs %>
13 <% size = c.size if c.size <= c.total_cs else c.total_cs %>
14 ${_('Changelog')}
14 ${_('Changelog')}
15 %if c.changelog_for_path:
15 %if c.changelog_for_path:
16 - /${c.changelog_for_path}
16 - /${c.changelog_for_path}
17 %endif
17 %endif
18 %if c.revision:
18 %if c.revision:
19 @ ${h.short_id(c.first_revision.raw_id)}
19 @ ${h.short_id(c.first_revision.raw_id)}
20 %endif
20 %endif
21 - ${ungettext('showing %d out of %d revision', 'showing %d out of %d revisions', size) % (size, c.total_cs)}
21 - ${ungettext('showing %d out of %d revision', 'showing %d out of %d revisions', size) % (size, c.total_cs)}
22 </%def>
22 </%def>
23
23
24 <%block name="header_menu">
24 <%block name="header_menu">
25 ${self.menu('repositories')}
25 ${self.menu('repositories')}
26 </%block>
26 </%block>
27
27
28 <%def name="main()">
28 <%def name="main()">
29 ${self.repo_context_bar('changelog', c.first_revision.raw_id if c.first_revision else None)}
29 ${self.repo_context_bar('changelog', c.first_revision.raw_id if c.first_revision else None)}
30 <div class="panel panel-primary">
30 <div class="panel panel-primary">
31 <div class="panel-heading clearfix">
31 <div class="panel-heading clearfix">
32 ${self.breadcrumbs()}
32 ${self.breadcrumbs()}
33 </div>
33 </div>
34 <div class="panel-body changelog-panel">
34 <div class="panel-body changelog-panel">
35 %if c.pagination:
35 %if c.pagination:
36 <div class="changelog-heading clearfix" style="${'display:none' if c.changelog_for_path else ''}">
36 <div class="changelog-heading clearfix" style="${'display:none' if c.changelog_for_path else ''}">
37 <div class="pull-left">
37 <div class="pull-left">
38 ${h.form(h.url.current(),method='get',class_="form-inline")}
38 ${h.form(h.url.current(),method='get',class_="form-inline")}
39 ${h.submit('set',_('Show'),class_="btn btn-default btn-sm")}
39 ${h.submit('set',_('Show'),class_="btn btn-default btn-sm")}
40 ${h.text('size',size=3,value=c.size,class_='form-control')}
40 ${h.text('size',size=3,value=c.size,class_='form-control')}
41 ${_('revisions')}
41 ${_('revisions')}
42 %if c.branch_name:
42 %if c.branch_name:
43 ${h.hidden('branch', c.branch_name)}
43 ${h.hidden('branch', c.branch_name)}
44 %endif
44 %endif
45 <a href="#" class="btn btn-default btn-sm" id="rev_range_clear" style="display:none">${_('Clear selection')}</a>
45 <a href="#" class="btn btn-default btn-sm" id="rev_range_clear" style="display:none">${_('Clear selection')}</a>
46 ${h.end_form()}
46 ${h.end_form()}
47 </div>
47 </div>
48 <div class="pull-right">
48 <div class="pull-right">
49 <a href="#" class="btn btn-default btn-sm" id="rev_range_container" style="display:none"></a>
49 <a href="#" class="btn btn-default btn-sm" id="rev_range_container" style="display:none"></a>
50 %if c.revision:
50 %if c.revision:
51 <a class="btn btn-default btn-sm" href="${h.url('changelog_home', repo_name=c.repo_name)}">
51 <a class="btn btn-default btn-sm" href="${h.url('changelog_home', repo_name=c.repo_name)}">
52 ${_('Go to tip of repository')}
52 ${_('Go to tip of repository')}
53 </a>
53 </a>
54 %endif
54 %endif
55 %if c.db_repo.fork:
55 %if c.db_repo.fork:
56 <a id="compare_fork"
56 <a id="compare_fork"
57 title="${_('Compare fork with %s' % c.db_repo.fork.repo_name)}"
57 title="${_('Compare fork with %s' % c.db_repo.fork.repo_name)}"
58 href="${h.url('compare_url',repo_name=c.db_repo.fork.repo_name,org_ref_type=c.db_repo.landing_rev[0],org_ref_name=c.db_repo.landing_rev[1],other_repo=c.repo_name,other_ref_type='branch' if request.GET.get('branch') else c.db_repo.landing_rev[0],other_ref_name=request.GET.get('branch') or c.db_repo.landing_rev[1], merge=1)}"
58 href="${h.url('compare_url',repo_name=c.db_repo.fork.repo_name,org_ref_type=c.db_repo.landing_rev[0],org_ref_name=c.db_repo.landing_rev[1],other_repo=c.repo_name,other_ref_type='branch' if request.GET.get('branch') else c.db_repo.landing_rev[0],other_ref_name=request.GET.get('branch') or c.db_repo.landing_rev[1], merge=1)}"
59 class="btn btn-default btn-sm"><i class="icon-git-compare"></i> ${_('Compare fork with parent repository (%s)' % c.db_repo.fork.repo_name)}</a>
59 class="btn btn-default btn-sm"><i class="icon-git-compare"></i> ${_('Compare fork with parent repository (%s)' % c.db_repo.fork.repo_name)}</a>
60 %endif
60 %endif
61 ## text and href of open_new_pr is controlled from javascript
61 ## text and href of open_new_pr is controlled from javascript
62 <a id="open_new_pr" class="btn btn-default btn-sm"></a>
62 <a id="open_new_pr" class="btn btn-default btn-sm"></a>
63 ${_("Branch filter:")} ${h.select('branch_filter',c.branch_name,c.branch_filters)}
63 ${_("Branch filter:")} ${h.select('branch_filter',c.branch_name,c.branch_filters)}
64 </div>
64 </div>
65 </div>
65 </div>
66
66
67 <div id="graph_nodes">
67 <div id="graph_nodes">
68 <canvas id="graph_canvas" style="width:0"></canvas>
68 <canvas id="graph_canvas" style="width:0"></canvas>
69 </div>
69 </div>
70 <div id="graph_content" style="${'margin: 0px' if c.changelog_for_path else ''}">
70 <div id="graph_content" style="${'margin: 0px' if c.changelog_for_path else ''}">
71
71
72 <table class="table" id="changesets">
72 <table class="table" id="changesets">
73 <tbody>
73 <tbody>
74 %for cnt,cs in enumerate(c.pagination):
74 %for cnt,cs in enumerate(c.pagination):
75 <tr id="chg_${cnt+1}" class="container ${'mergerow' if len(cs.parents) > 1 else ''}">
75 <tr id="chg_${cnt+1}" class="container ${'mergerow' if len(cs.parents) > 1 else ''}">
76 <td class="checkbox-column">
76 <td class="checkbox-column">
77 %if c.changelog_for_path:
77 %if c.changelog_for_path:
78 ${h.checkbox(cs.raw_id,class_="changeset_range", disabled="disabled")}
78 ${h.checkbox(cs.raw_id,class_="changeset_range", disabled="disabled")}
79 %else:
79 %else:
80 ${h.checkbox(cs.raw_id,class_="changeset_range")}
80 ${h.checkbox(cs.raw_id,class_="changeset_range")}
81 %endif
81 %endif
82 <td class="status">
82 <td class="status">
83 %if c.statuses.get(cs.raw_id):
83 %if c.statuses.get(cs.raw_id):
84 <div class="changeset-status-ico">
84 <div class="changeset-status-ico">
85 %if c.statuses.get(cs.raw_id)[2]:
85 %if c.statuses.get(cs.raw_id)[2]:
86 <a data-toggle="tooltip" title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (c.statuses.get(cs.raw_id)[1], c.statuses.get(cs.raw_id)[5].username, c.statuses.get(cs.raw_id)[4])}" href="${h.url('pullrequest_show',repo_name=c.statuses.get(cs.raw_id)[3],pull_request_id=c.statuses.get(cs.raw_id)[2])}">
86 <a data-toggle="tooltip" title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (c.statuses.get(cs.raw_id)[1], c.statuses.get(cs.raw_id)[5].username, c.statuses.get(cs.raw_id)[4])}" href="${h.url('pullrequest_show',repo_name=c.statuses.get(cs.raw_id)[3],pull_request_id=c.statuses.get(cs.raw_id)[2])}">
87 <i class="icon-circle changeset-status-${c.statuses.get(cs.raw_id)[0]}"></i>
87 <i class="icon-circle changeset-status-${c.statuses.get(cs.raw_id)[0]}"></i>
88 </a>
88 </a>
89 %else:
89 %else:
90 <a data-toggle="tooltip" title="${_('Changeset status: %s by %s') % (c.statuses.get(cs.raw_id)[1], c.statuses.get(cs.raw_id)[5].username)}"
90 <a data-toggle="tooltip" title="${_('Changeset status: %s by %s') % (c.statuses.get(cs.raw_id)[1], c.statuses.get(cs.raw_id)[5].username)}"
91 href="${c.comments[cs.raw_id][0].url()}">
91 href="${c.comments[cs.raw_id][0].url()}">
92 <i class="icon-circle changeset-status-${c.statuses.get(cs.raw_id)[0]}"></i>
92 <i class="icon-circle changeset-status-${c.statuses.get(cs.raw_id)[0]}"></i>
93 </a>
93 </a>
94 %endif
94 %endif
95 </div>
95 </div>
96 %endif
96 %endif
97 </td>
97 </td>
98 <td class="author">
98 <td class="author">
99 ${h.gravatar(h.email_or_none(cs.author), size=16)}
99 ${h.gravatar(h.email_or_none(cs.author), size=16)}
100 <span data-toggle="tooltip" title="${cs.author}" class="user">${h.shorter(h.person(cs.author),22)}</span>
100 <span data-toggle="tooltip" title="${cs.author}" class="user">${h.shorter(h.person(cs.author),22)}</span>
101 </td>
101 </td>
102 <td class="hash">
102 <td class="hash">
103 ${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id), class_='changeset_hash')}
103 ${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id), class_='changeset_hash')}
104 </td>
104 </td>
105 <td class="date">
105 <td class="date">
106 <div class="date" data-toggle="tooltip" title="${h.fmt_date(cs.date)}">${h.age(cs.date,True)}</div>
106 <div class="date" data-toggle="tooltip" title="${h.fmt_date(cs.date)}">${h.age(cs.date,True)}</div>
107 </td>
107 </td>
108 <td class="expand_commit" data-commit_id="${cs.raw_id}" title="${_('Expand commit message')}">
108 <td class="expand_commit" data-commit_id="${cs.raw_id}" title="${_('Expand commit message')}">
109 <i class="icon-align-left"></i>
109 <i class="icon-align-left"></i>
110 </td>
110 </td>
111 <td class="mid">
111 <td class="mid">
112 <div class="log-container">
112 <div class="log-container">
113 <div class="message" id="C-${cs.raw_id}">${h.urlify_text(cs.message, c.repo_name,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
113 <div class="message" id="C-${cs.raw_id}">${h.urlify_text(cs.message, c.repo_name,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
114 <div class="extra-container">
114 <div class="extra-container">
115 %if c.comments.get(cs.raw_id):
115 %if c.comments.get(cs.raw_id):
116 <div class="comments-container">
116 <div class="comments-container">
117 <div class="comments-cnt" data-toggle="tooltip" title="${_('Changeset has comments')}">
117 <div class="comments-cnt" data-toggle="tooltip" title="${_('Changeset has comments')}">
118 <a href="${c.comments[cs.raw_id][0].url()}">
118 <a href="${c.comments[cs.raw_id][0].url()}">
119 ${len(c.comments[cs.raw_id])}
119 ${len(c.comments[cs.raw_id])}
120 <i class="icon-comment-discussion"></i>
120 <i class="icon-comment-discussion"></i>
121 </a>
121 </a>
122 </div>
122 </div>
123 </div>
123 </div>
124 %endif
124 %endif
125 %if cs.bumped:
125 %if cs.bumped:
126 <span class="bumpedtag" title="Bumped">
126 <span class="bumpedtag" title="Bumped">
127 Bumped
127 Bumped
128 </span>
128 </span>
129 %endif
129 %endif
130 %if cs.divergent:
130 %if cs.divergent:
131 <span class="divergenttag" title="Divergent">
131 <span class="divergenttag" title="Divergent">
132 Divergent
132 Divergent
133 </span>
133 </span>
134 %endif
134 %endif
135 %if cs.extinct:
135 %if cs.extinct:
136 <span class="extincttag" title="Extinct">
136 <span class="extincttag" title="Extinct">
137 Extinct
137 Extinct
138 </span>
138 </span>
139 %endif
139 %endif
140 %if cs.unstable:
140 %if cs.unstable:
141 <span class="unstabletag" title="Unstable">
141 <span class="unstabletag" title="Unstable">
142 Unstable
142 Unstable
143 </span>
143 </span>
144 %endif
144 %endif
145 %if cs.phase:
145 %if cs.phase:
146 <span class="phasetag" title="Phase">
146 <span class="phasetag" title="Phase">
147 ${cs.phase}
147 ${cs.phase}
148 </span>
148 </span>
149 %endif
149 %endif
150 %if h.is_hg(c.db_repo_scm_instance):
150 %if h.is_hg(c.db_repo_scm_instance):
151 %for book in cs.bookmarks:
151 %for book in cs.bookmarks:
152 <span class="booktag" title="${_('Bookmark %s') % book}">
152 <span class="booktag" title="${_('Bookmark %s') % book}">
153 ${h.link_to(book,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
153 ${h.link_to(book,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
154 </span>
154 </span>
155 %endfor
155 %endfor
156 %endif
156 %endif
157 %for tag in cs.tags:
157 %for tag in cs.tags:
158 <span class="tagtag" title="${_('Tag %s') % tag}">
158 <span class="tagtag" title="${_('Tag %s') % tag}">
159 ${h.link_to(tag,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
159 ${h.link_to(tag,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
160 </span>
160 </span>
161 %endfor
161 %endfor
162 %if (not c.branch_name) and cs.branch:
162 %if (not c.branch_name) and cs.branch:
163 <span class="branchtag" title="${_('Branch %s' % cs.branch)}">
163 <span class="branchtag" title="${_('Branch %s' % cs.branch)}">
164 ${h.link_to(cs.branch,h.url('changelog_home',repo_name=c.repo_name,branch=cs.branch))}
164 ${h.link_to(cs.branch,h.url('changelog_home',repo_name=c.repo_name,branch=cs.branch))}
165 </span>
165 </span>
166 %endif
166 %endif
167 </div>
167 </div>
168 </div>
168 </div>
169 </td>
169 </td>
170 </tr>
170 </tr>
171 %endfor
171 %endfor
172 </tbody>
172 </tbody>
173 </table>
173 </table>
174
174
175 <input type="checkbox" id="singlerange" style="display:none"/>
175 <input type="checkbox" id="singlerange" style="display:none"/>
176
176
177 </div>
177 </div>
178
178
179 <ul class="pagination">
179 <ul class="pagination">
180 ${c.pagination.pager()}
180 ${c.pagination.pager()}
181 </ul>
181 </ul>
182
182
183 <script type="text/javascript" src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
183 <script type="text/javascript" src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
184 <script type="text/javascript">
184 <script type="text/javascript">
185 var jsdata = ${h.js(c.jsdata)};
186 var graph = new BranchRenderer('graph_canvas', 'graph_content', 'chg_');
187
185 $(document).ready(function(){
188 $(document).ready(function(){
186 var $checkboxes = $('.changeset_range');
189 var $checkboxes = $('.changeset_range');
187
190
188 pyroutes.register('changeset_home', ${h.js(h.url('changeset_home', repo_name='%(repo_name)s', revision='%(revision)s'))}, ['repo_name', 'revision']);
191 pyroutes.register('changeset_home', ${h.js(h.url('changeset_home', repo_name='%(repo_name)s', revision='%(revision)s'))}, ['repo_name', 'revision']);
189
192
190 var checkbox_checker = function(e) {
193 var checkbox_checker = function(e) {
191 var $checked_checkboxes = $checkboxes.filter(':checked');
194 var $checked_checkboxes = $checkboxes.filter(':checked');
192 var $singlerange = $('#singlerange');
195 var $singlerange = $('#singlerange');
193
196
194 $('#rev_range_container').hide();
197 $('#rev_range_container').hide();
195 $checkboxes.show();
198 $checkboxes.show();
196 $singlerange.show();
199 $singlerange.show();
197
200
198 if ($checked_checkboxes.length > 0) {
201 if ($checked_checkboxes.length > 0) {
199 $checked_checkboxes.first().parent('td').append($singlerange);
202 $checked_checkboxes.first().parent('td').append($singlerange);
200 var singlerange = $singlerange.prop('checked');
203 var singlerange = $singlerange.prop('checked');
201 var rev_end = $checked_checkboxes.first().prop('name');
204 var rev_end = $checked_checkboxes.first().prop('name');
202 if ($checked_checkboxes.length > 1 || singlerange) {
205 if ($checked_checkboxes.length > 1 || singlerange) {
203 var rev_start = $checked_checkboxes.last().prop('name');
206 var rev_start = $checked_checkboxes.last().prop('name');
204 $('#rev_range_container').prop('href',
207 $('#rev_range_container').prop('href',
205 pyroutes.url('changeset_home', {'repo_name': ${h.js(c.repo_name)},
208 pyroutes.url('changeset_home', {'repo_name': ${h.js(c.repo_name)},
206 'revision': rev_start + '...' + rev_end}));
209 'revision': rev_start + '...' + rev_end}));
207 $('#rev_range_container').html(
210 $('#rev_range_container').html(
208 _TM['Show Selected Changesets {0} &rarr; {1}'].format(rev_start.substr(0, 12), rev_end.substr(0, 12)));
211 _TM['Show Selected Changesets {0} &rarr; {1}'].format(rev_start.substr(0, 12), rev_end.substr(0, 12)));
209 $('#rev_range_container').show();
212 $('#rev_range_container').show();
210 $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
213 $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
211 {'repo_name': ${h.js(c.repo_name)},
214 {'repo_name': ${h.js(c.repo_name)},
212 'rev_start': rev_start,
215 'rev_start': rev_start,
213 'rev_end': rev_end}));
216 'rev_end': rev_end}));
214 $('#open_new_pr').html(_TM['Open New Pull Request for {0} &rarr; {1}'].format(rev_start.substr(0, 12), rev_end.substr(0, 12)));
217 $('#open_new_pr').html(_TM['Open New Pull Request for {0} &rarr; {1}'].format(rev_start.substr(0, 12), rev_end.substr(0, 12)));
215 } else {
218 } else {
216 $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
219 $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
217 {'repo_name': ${h.js(c.repo_name)},
220 {'repo_name': ${h.js(c.repo_name)},
218 'rev_end': rev_end}));
221 'rev_end': rev_end}));
219 $('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(rev_end.substr(0, 12)));
222 $('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(rev_end.substr(0, 12)));
220 }
223 }
221 $('#rev_range_clear').show();
224 $('#rev_range_clear').show();
222 $('#compare_fork').hide();
225 $('#compare_fork').hide();
223
226
224 var disabled = true;
227 var disabled = true;
225 $checkboxes.each(function(){
228 $checkboxes.each(function(){
226 var $this = $(this);
229 var $this = $(this);
227 if (disabled) {
230 if (disabled) {
228 if ($this.prop('checked')) {
231 if ($this.prop('checked')) {
229 $this.closest('tr').removeClass('out-of-range');
232 $this.closest('tr').removeClass('out-of-range');
230 disabled = singlerange;
233 disabled = singlerange;
231 } else {
234 } else {
232 $this.closest('tr').addClass('out-of-range');
235 $this.closest('tr').addClass('out-of-range');
233 }
236 }
234 } else {
237 } else {
235 $this.closest('tr').removeClass('out-of-range');
238 $this.closest('tr').removeClass('out-of-range');
236 disabled = $this.prop('checked');
239 disabled = $this.prop('checked');
237 }
240 }
238 });
241 });
239
242
240 if ($checked_checkboxes.length + (singlerange ? 1 : 0) >= 2) {
243 if ($checked_checkboxes.length + (singlerange ? 1 : 0) >= 2) {
241 $checkboxes.hide();
244 $checkboxes.hide();
242 $checked_checkboxes.show();
245 $checked_checkboxes.show();
243 if (!singlerange)
246 if (!singlerange)
244 $singlerange.hide();
247 $singlerange.hide();
245 }
248 }
246 } else {
249 } else {
247 $('#singlerange').hide().prop('checked', false);
250 $('#singlerange').hide().prop('checked', false);
248 $('#rev_range_clear').hide();
251 $('#rev_range_clear').hide();
249 %if c.revision:
252 %if c.revision:
250 $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
253 $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
251 {'repo_name': ${h.js(c.repo_name)},
254 {'repo_name': ${h.js(c.repo_name)},
252 'rev_end':${h.js(c.first_revision.raw_id)}}));
255 'rev_end':${h.js(c.first_revision.raw_id)}}));
253 $('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(${h.jshtml(c.revision)}));
256 $('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(${h.jshtml(c.revision)}));
254 %else:
257 %else:
255 $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
258 $('#open_new_pr').prop('href', pyroutes.url('pullrequest_home',
256 {'repo_name': ${h.js(c.repo_name)},
259 {'repo_name': ${h.js(c.repo_name)},
257 'branch':${h.js(c.first_revision.branch)}}));
260 'branch':${h.js(c.first_revision.branch)}}));
258 $('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(${h.jshtml(c.first_revision.branch)}));
261 $('#open_new_pr').html(_TM['Open New Pull Request from {0}'].format(${h.jshtml(c.first_revision.branch)}));
259 %endif
262 %endif
260 $('#compare_fork').show();
263 $('#compare_fork').show();
261 $checkboxes.closest('tr').removeClass('out-of-range');
264 $checkboxes.closest('tr').removeClass('out-of-range');
262 }
265 }
263 };
266 };
264 checkbox_checker();
267 checkbox_checker();
265 $checkboxes.click(function() {
268 $checkboxes.click(function() {
266 checkbox_checker();
269 checkbox_checker();
267 r.render(jsdata);
270 graph.render(jsdata);
268 });
271 });
269 $('#singlerange').click(checkbox_checker);
272 $('#singlerange').click(checkbox_checker);
270
273
271 $('#rev_range_clear').click(function(e){
274 $('#rev_range_clear').click(function(e){
272 $checkboxes.prop('checked', false);
275 $checkboxes.prop('checked', false);
273 checkbox_checker();
276 checkbox_checker();
274 r.render(jsdata);
277 graph.render(jsdata);
275 });
278 });
276
279
277 var $msgs = $('.message');
280 var $msgs = $('.message');
278 // get first element height
281 // get first element height
279 var el = $('#graph_content .container')[0];
282 var el = $('#graph_content .container')[0];
280 var row_h = el.clientHeight;
283 var row_h = el.clientHeight;
281 $msgs.each(function() {
284 $msgs.each(function() {
282 var m = this;
285 var m = this;
283
286
284 var h = m.clientHeight;
287 var h = m.clientHeight;
285 if(h > row_h){
288 if(h > row_h){
286 var offset = row_h - (h+12);
289 var offset = row_h - (h+12);
287 $(m.nextElementSibling).css('display', 'block');
290 $(m.nextElementSibling).css('display', 'block');
288 $(m.nextElementSibling).css('margin-top', offset+'px');
291 $(m.nextElementSibling).css('margin-top', offset+'px');
289 }
292 }
290 });
293 });
291
294
292 $('.expand_commit').on('click',function(e){
295 $('.expand_commit').on('click',function(e){
293 var cid = $(this).data('commit_id');
296 var cid = $(this).data('commit_id');
294 $('#C-'+cid).toggleClass('expanded');
297 $('#C-'+cid).toggleClass('expanded');
295
298
296 //redraw the graph, r and jsdata are bound outside function
299 //redraw the graph, r and jsdata are bound outside function
297 r.render(jsdata);
300 graph.render(jsdata);
298 });
301 });
299
302
300 // change branch filter
303 // change branch filter
301 $("#branch_filter").select2({
304 $("#branch_filter").select2({
302 dropdownAutoWidth: true,
305 dropdownAutoWidth: true,
303 maxResults: 50,
306 maxResults: 50,
304 sortResults: branchSort
307 sortResults: branchSort
305 });
308 });
306
309
307 $("#branch_filter").change(function(e){
310 $("#branch_filter").change(function(e){
308 var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value;
311 var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value;
309 if(selected_branch != ''){
312 if(selected_branch != ''){
310 window.location = pyroutes.url('changelog_home', {'repo_name': ${h.js(c.repo_name)},
313 window.location = pyroutes.url('changelog_home', {'repo_name': ${h.js(c.repo_name)},
311 'branch': selected_branch});
314 'branch': selected_branch});
312 }else{
315 }else{
313 window.location = pyroutes.url('changelog_home', {'repo_name': ${h.js(c.repo_name)}});
316 window.location = pyroutes.url('changelog_home', {'repo_name': ${h.js(c.repo_name)}});
314 }
317 }
315 $("#changelog").hide();
318 $("#changelog").hide();
316 });
319 });
317
320
318 var jsdata = ${h.js(c.jsdata)};
321 graph.render(jsdata);
319 var r = new BranchRenderer('graph_canvas', 'graph_content', 'chg_');
320 r.render(jsdata);
321 });
322 });
322
323
324 $(window).resize(function(){
325 graph.render(jsdata);
326 });
323 </script>
327 </script>
324 %else:
328 %else:
325 ${_('There are no changes yet')}
329 ${_('There are no changes yet')}
326 %endif
330 %endif
327 </div>
331 </div>
328 </div>
332 </div>
329 </%def>
333 </%def>
General Comments 0
You need to be logged in to leave comments. Login now