##// END OF EJS Templates
fixed bookmarks error on git
marcink -
r3541:8fae9388 beta
parent child Browse files
Show More
@@ -1,264 +1,265 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 65 <td class="hash">
66 66 <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}">
67 67 <span class="changeset_hash">${h.short_id(cs.raw_id)}</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">&darr; ${_('Show more')} &darr;</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 %if h.is_hg(c.rhodecode_repo):
87 88 %for book in cs.bookmarks:
88 89 <div class="bookbook" title="${'%s %s' % (_('bookmark'),book)}">
89 90 ${h.link_to(h.shorter(book),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
90 91 </div>
91
92 92 %endfor
93 %endif
93 94 %for tag in cs.tags:
94 95 <div class="tagtag" title="${'%s %s' % (_('tag'),tag)}">
95 96 ${h.link_to(h.shorter(tag),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}
96 97 </div>
97 98 %endfor
98 99 %if (not c.branch_name) and cs.branch:
99 100 <div class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}">
100 101 ${h.link_to(h.shorter(cs.branch),h.url('changelog_home',repo_name=c.repo_name,branch=cs.branch))}
101 102 </div>
102 103 %endif
103 104 </div>
104 105 </div>
105 106 </td>
106 107 </tr>
107 108 %endfor
108 109 </tbody>
109 110 </table>
110 111
111 112
112 113 <div class="pagination-wh pagination-left">
113 114 ${c.pagination.pager('$link_previous ~2~ $link_next')}
114 115 </div>
115 116 </div>
116 117 </div>
117 118
118 119 <script type="text/javascript" src="${h.url('/js/graph.js')}"></script>
119 120 <script type="text/javascript">
120 121 YAHOO.util.Event.onDOMReady(function(){
121 122
122 123 //Monitor range checkboxes and build a link to changesets
123 124 //ranges
124 125 var checkboxes = YUD.getElementsByClassName('changeset_range');
125 126 var url_tmpl = "${h.url('changeset_home',repo_name=c.repo_name,revision='__REVRANGE__')}";
126 127 var pr_tmpl = "${h.url('pullrequest_home',repo_name=c.repo_name)}";
127 128
128 129 var checkbox_checker = function(e){
129 130 var checked_checkboxes = [];
130 131 for (pos in checkboxes){
131 132 if(checkboxes[pos].checked){
132 133 checked_checkboxes.push(checkboxes[pos]);
133 134 }
134 135 }
135 136 if(YUD.get('open_new_pr')){
136 137 if(checked_checkboxes.length>1){
137 138 YUD.setStyle('open_new_pr','display','none');
138 139 } else {
139 140 YUD.setStyle('open_new_pr','display','');
140 141 if(checked_checkboxes.length>0){
141 142 YUD.get('open_new_pr').innerHTML = _TM['Open new pull request for selected changesets'];
142 143 }else{
143 144 YUD.get('open_new_pr').innerHTML = _TM['Open new pull request'];
144 145 }
145 146 }
146 147 }
147 148
148 149 if(checked_checkboxes.length>0){
149 150 var rev_end = checked_checkboxes[0].name;
150 151 var rev_start = checked_checkboxes[checked_checkboxes.length-1].name;
151 152 var url = url_tmpl.replace('__REVRANGE__',
152 153 rev_start+'...'+rev_end);
153 154
154 155 var link = (rev_start == rev_end)
155 156 ? _TM['Show selected change __S']
156 157 : _TM['Show selected changes __S -> __E'];
157 158
158 159 link = link.replace('__S',rev_start.substr(0,6));
159 160 link = link.replace('__E',rev_end.substr(0,6));
160 161 YUD.get('rev_range_container').href = url;
161 162 YUD.get('rev_range_container').innerHTML = link;
162 163 YUD.setStyle('rev_range_container','display','');
163 164 YUD.setStyle('rev_range_clear','display','');
164 165
165 166 YUD.get('open_new_pr').href = pr_tmpl + '?rev_start={0}&rev_end={1}'.format(rev_start,rev_end);
166 167 YUD.setStyle('compare_fork','display','none');
167 168 } else{
168 169 YUD.setStyle('rev_range_container','display','none');
169 170 YUD.setStyle('rev_range_clear','display','none');
170 171 if (checkboxes){
171 172 YUD.get('open_new_pr').href = pr_tmpl + '?rev_end={0}'.format(checkboxes[0].name);
172 173 }
173 174 YUD.setStyle('compare_fork','display','');
174 175 }
175 176 };
176 177 YUE.onDOMReady(checkbox_checker);
177 178 YUE.on(checkboxes,'click', checkbox_checker);
178 179
179 180 YUE.on('rev_range_clear','click',function(e){
180 181 for (var i=0; i<checkboxes.length; i++){
181 182 var cb = checkboxes[i];
182 183 cb.checked = false;
183 184 }
184 185 checkbox_checker();
185 186 YUE.preventDefault(e);
186 187 });
187 188
188 189 var msgs = YUQ('.message');
189 190 // get first element height
190 191 var el = YUQ('#graph_content .container')[0];
191 192 var row_h = el.clientHeight;
192 193 for(var i=0;i<msgs.length;i++){
193 194 var m = msgs[i];
194 195
195 196 var h = m.clientHeight;
196 197 var pad = YUD.getStyle(m,'padding');
197 198 if(h > row_h){
198 199 var offset = row_h - (h+12);
199 200 YUD.setStyle(m.nextElementSibling,'display','block');
200 201 YUD.setStyle(m.nextElementSibling,'margin-top',offset+'px');
201 202 };
202 203 }
203 204 YUE.on(YUQ('.expand'),'click',function(e){
204 205 var elem = e.currentTarget.parentNode.parentNode;
205 206 YUD.setStyle(e.currentTarget,'display','none');
206 207 YUD.setStyle(elem,'height','auto');
207 208
208 209 //redraw the graph, line_count and jsdata are global vars
209 210 set_canvas(100);
210 211
211 212 var r = new BranchRenderer();
212 213 r.render(jsdata,100,line_count);
213 214
214 215 });
215 216
216 217 // change branch filter
217 218 YUE.on(YUD.get('branch_filter'),'change',function(e){
218 219 var selected_branch = e.currentTarget.options[e.currentTarget.selectedIndex].value;
219 220 var url_main = "${h.url('changelog_home',repo_name=c.repo_name)}";
220 221 var url = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}";
221 222 var url = url.replace('__BRANCH__',selected_branch);
222 223 if(selected_branch != ''){
223 224 window.location = url;
224 225 }else{
225 226 window.location = url_main;
226 227 }
227 228
228 229 });
229 230
230 231 function set_canvas(width) {
231 232 var c = document.getElementById('graph_nodes');
232 233 var t = document.getElementById('graph_content');
233 234 canvas = document.getElementById('graph_canvas');
234 235 var div_h = t.clientHeight;
235 236 //c.style.height=div_h+'px';
236 237 canvas.setAttribute('height',div_h);
237 238 //c.style.height=width+'px';
238 239 canvas.setAttribute('width',width);
239 240 };
240 241 var heads = 1;
241 242 var line_count = 0;
242 243 var jsdata = ${c.jsdata|n};
243 244
244 245 for (var i=0;i<jsdata.length;i++) {
245 246 var in_l = jsdata[i][2];
246 247 for (var j in in_l) {
247 248 var m = in_l[j][1];
248 249 if (m > line_count)
249 250 line_count = m;
250 251 }
251 252 }
252 253 set_canvas(100);
253 254
254 255 var r = new BranchRenderer();
255 256 r.render(jsdata,100,line_count);
256 257
257 258 });
258 259 </script>
259 260 %else:
260 261 ${_('There are no changes yet')}
261 262 %endif
262 263 </div>
263 264 </div>
264 265 </%def>
@@ -1,736 +1,736 b''
1 1 <%inherit file="/base/base.html"/>
2 2
3 3 <%def name="title()">
4 4 ${_('%s Summary') % c.repo_name} - ${c.rhodecode_name}
5 5 </%def>
6 6
7 7 <%def name="breadcrumbs_links()">
8 8 ${_('Summary')}
9 9 </%def>
10 10
11 11 <%def name="page_nav()">
12 12 ${self.menu('summary')}
13 13 </%def>
14 14
15 15 <%def name="head_extra()">
16 16 <link href="${h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('repo %s ATOM feed') % c.repo_name}" type="application/atom+xml" />
17 17 <link href="${h.url('rss_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('repo %s RSS feed') % c.repo_name}" type="application/rss+xml" />
18 18 </%def>
19 19
20 20 <%def name="main()">
21 21 ${self.context_bar('summary')}
22 22 <%
23 23 summary = lambda n:{False:'summary-short'}.get(n)
24 24 %>
25 25 %if c.show_stats:
26 26 <div class="box box-left">
27 27 %else:
28 28 <div class="box">
29 29 %endif
30 30 <!-- box / title -->
31 31 <div class="title">
32 32 ${self.breadcrumbs()}
33 33 </div>
34 34 <!-- end box / title -->
35 35 <div class="form">
36 36 <div id="summary" class="fields">
37 37
38 38 <div class="field">
39 39 <div class="label-summary">
40 40 <label>${_('Name')}:</label>
41 41 </div>
42 42 <div class="input ${summary(c.show_stats)}">
43 43
44 44 ## locking icon
45 45 %if c.rhodecode_db_repo.enable_locking:
46 46 %if c.rhodecode_db_repo.locked[0]:
47 47 <span class="locking_locked tooltip" title="${_('Repository locked by %s') % h.person_by_id(c.rhodecode_db_repo.locked[0])}"></span>
48 48 %else:
49 49 <span class="locking_unlocked tooltip" title="${_('Repository unlocked')}"></span>
50 50 %endif
51 51 %endif
52 52 ##REPO TYPE
53 53 %if h.is_hg(c.dbrepo):
54 54 <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
55 55 %endif
56 56 %if h.is_git(c.dbrepo):
57 57 <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
58 58 %endif
59 59
60 60 ##PUBLIC/PRIVATE
61 61 %if c.dbrepo.private:
62 62 <img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url('/images/icons/lock.png')}"/>
63 63 %else:
64 64 <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url('/images/icons/lock_open.png')}"/>
65 65 %endif
66 66
67 67 ##REPO NAME
68 68 <span class="repo_name" title="${_('Non changable ID %s') % c.dbrepo.repo_id}">${h.repo_link(c.dbrepo.groups_and_repo)}</span>
69 69
70 70 ##FORK
71 71 %if c.dbrepo.fork:
72 72 <div style="margin-top:5px;clear:both">
73 73 <a href="${h.url('summary_home',repo_name=c.dbrepo.fork.repo_name)}"><img class="icon" alt="${_('public')}" title="${_('Fork of')} ${c.dbrepo.fork.repo_name}" src="${h.url('/images/icons/arrow_divide.png')}"/>
74 74 ${_('Fork of')} ${c.dbrepo.fork.repo_name}
75 75 </a>
76 76 </div>
77 77 %endif
78 78 ##REMOTE
79 79 %if c.dbrepo.clone_uri:
80 80 <div style="margin-top:5px;clear:both">
81 81 <a href="${h.url(str(h.hide_credentials(c.dbrepo.clone_uri)))}"><img class="icon" alt="${_('remote clone')}" title="${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}" src="${h.url('/images/icons/connect.png')}"/>
82 82 ${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}
83 83 </a>
84 84 </div>
85 85 %endif
86 86 </div>
87 87 </div>
88 88
89 89 <div class="field">
90 90 <div class="label-summary">
91 91 <label>${_('Description')}:</label>
92 92 </div>
93 93 %if c.visual.stylify_metatags:
94 94 <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(h.desc_stylize(c.dbrepo.description))}</div>
95 95 %else:
96 96 <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(c.dbrepo.description)}</div>
97 97 %endif
98 98 </div>
99 99
100 100 <div class="field">
101 101 <div class="label-summary">
102 102 <label>${_('Contact')}:</label>
103 103 </div>
104 104 <div class="input ${summary(c.show_stats)}">
105 105 <div class="gravatar">
106 106 <img alt="gravatar" src="${h.gravatar_url(c.dbrepo.user.email)}"/>
107 107 </div>
108 108 ${_('Username')}: ${c.dbrepo.user.username}<br/>
109 109 ${_('Name')}: ${c.dbrepo.user.name} ${c.dbrepo.user.lastname}<br/>
110 110 ${_('Email')}: <a href="mailto:${c.dbrepo.user.email}">${c.dbrepo.user.email}</a>
111 111 </div>
112 112 </div>
113 113
114 114 <div class="field">
115 115 <div class="label-summary">
116 116 <label>${_('Clone url')}:</label>
117 117 </div>
118 118 <div class="input ${summary(c.show_stats)}">
119 119 <input style="width:80%" type="text" id="clone_url" readonly="readonly" value="${c.clone_repo_url}"/>
120 120 <input style="display:none;width:80%" type="text" id="clone_url_id" readonly="readonly" value="${c.clone_repo_url_id}"/>
121 121 <div style="display:none" id="clone_by_name" class="ui-btn clone">${_('Show by Name')}</div>
122 122 <div id="clone_by_id" class="ui-btn clone">${_('Show by ID')}</div>
123 123 </div>
124 124 </div>
125 125
126 126 <div class="field">
127 127 <div class="label-summary">
128 128 <label>${_('Trending files')}:</label>
129 129 </div>
130 130 <div class="input ${summary(c.show_stats)}">
131 131 %if c.show_stats:
132 132 <div id="lang_stats"></div>
133 133 %else:
134 134 ${_('Statistics are disabled for this repository')}
135 135 %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
136 136 ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")}
137 137 %endif
138 138 %endif
139 139 </div>
140 140 </div>
141 141
142 142 <div class="field">
143 143 <div class="label-summary">
144 144 <label>${_('Download')}:</label>
145 145 </div>
146 146 <div class="input ${summary(c.show_stats)}">
147 147 %if len(c.rhodecode_repo.revisions) == 0:
148 148 ${_('There are no downloads yet')}
149 149 %elif c.enable_downloads is False:
150 150 ${_('Downloads are disabled for this repository')}
151 151 %if h.HasPermissionAll('hg.admin')('enable downloads on from summary'):
152 152 ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")}
153 153 %endif
154 154 %else:
155 155 ${h.select('download_options',c.rhodecode_repo.get_changeset().raw_id,c.download_options)}
156 156 <span id="${'zip_link'}">${h.link_to(_('Download as zip'), h.url('files_archive_home',repo_name=c.dbrepo.repo_name,fname='tip.zip'),class_="archive_icon ui-btn")}</span>
157 157 <span style="vertical-align: bottom">
158 158 <input id="archive_subrepos" type="checkbox" name="subrepos" />
159 159 <label for="archive_subrepos" class="tooltip" title="${h.tooltip(_('Check this to download archive with subrepos'))}" >${_('with subrepos')}</label>
160 160 </span>
161 161 %endif
162 162 </div>
163 163 </div>
164 164 </div>
165 165 <div id="summary-menu-stats">
166 166 <ul>
167 167 <li>
168 168 <a class="followers" title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}">
169 169 ${_('Followers')}
170 170 <span id="current_followers_count">${c.repository_followers}</span>
171 171 </a>
172 172 </li>
173 173 <li>
174 174 <a class="forks" title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}">
175 175 ${_('Forks')}
176 176 <span>${c.repository_forks}</span>
177 177 </a>
178 178 </li>
179 179 <li>
180 180 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
181 181 %if h.HasPermissionAll('hg.admin')('access settings on repository'):
182 182 ${h.link_to(_('Settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}
183 183 %else:
184 184 ${h.link_to(_('Settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}
185 185 %endif
186 186 %endif
187 187 </li>
188 188 <li>
189 189 %if c.rhodecode_user.username != 'default':
190 190 ${h.link_to(_('Feed'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='feed')}
191 191 %else:
192 192 ${h.link_to(_('Feed'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name),class_='feed')}
193 193 %endif
194 194 </li>
195 195 %if c.rhodecode_user.username != 'default':
196 196 <li class="repo_size">
197 <a href="#" class="repo-size" onclick="javascript:showRepoSize('repo_size_2','${c.dbrepo.repo_name}','${str(h.get_token())}')">Calculate Repository Size</a>
197 <a href="#" class="repo-size" onclick="javascript:showRepoSize('repo_size_2','${c.dbrepo.repo_name}','${str(h.get_token())}')">Repository Size</a>
198 198 <span id="repo_size_2"></span>
199 199 </li>
200 200 %endif
201 201 </ul>
202 202 </div>
203 203 </div>
204 204 </div>
205 205
206 206 %if c.show_stats:
207 207 <div class="box box-right" style="min-height:455px">
208 208 <!-- box / title -->
209 209 <div class="title">
210 210 <h5>${_('Commit activity by day / author')}</h5>
211 211 </div>
212 212
213 213 <div class="graph">
214 214 <div style="padding:0 10px 10px 17px;">
215 215 %if c.no_data:
216 216 ${c.no_data_msg}
217 217 %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
218 218 ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")}
219 219 %endif
220 220 %else:
221 221 ${_('Stats gathered: ')} ${c.stats_percentage}%
222 222 %endif
223 223 </div>
224 224 <div id="commit_history" style="width:450px;height:300px;float:left"></div>
225 225 <div style="clear: both;height: 10px"></div>
226 226 <div id="overview" style="width:450px;height:100px;float:left"></div>
227 227
228 228 <div id="legend_data" style="clear:both;margin-top:10px;">
229 229 <div id="legend_container"></div>
230 230 <div id="legend_choices">
231 231 <table id="legend_choices_tables" class="noborder" style="font-size:smaller;color:#545454"></table>
232 232 </div>
233 233 </div>
234 234 </div>
235 235 </div>
236 236 %endif
237 237
238 238 <div class="box">
239 239 <div class="title">
240 240 <div class="breadcrumbs">
241 241 %if c.repo_changesets:
242 242 ${h.link_to(_('Latest changes'),h.url('changelog_home',repo_name=c.repo_name))}
243 243 %else:
244 244 ${_('Quick start')}
245 245 %endif
246 246 </div>
247 247 </div>
248 248 <div class="table">
249 249 <div id="shortlog_data">
250 250 <%include file='../shortlog/shortlog_data.html'/>
251 251 </div>
252 252 </div>
253 253 </div>
254 254
255 255 %if c.readme_data:
256 256 <div id="readme" class="anchor">
257 257 <div class="box" style="background-color: #FAFAFA">
258 258 <div class="title" title="${_("Readme file at revision '%s'" % c.rhodecode_db_repo.landing_rev)}">
259 259 <div class="breadcrumbs">
260 260 <a href="${h.url('files_home',repo_name=c.repo_name,revision='tip',f_path=c.readme_file)}">${c.readme_file}</a>
261 261 <a class="permalink" href="#readme" title="${_('Permalink to this readme')}">&para;</a>
262 262 </div>
263 263 </div>
264 264 <div class="readme">
265 265 <div class="readme_box">
266 266 ${c.readme_data|n}
267 267 </div>
268 268 </div>
269 269 </div>
270 270 </div>
271 271 %endif
272 272
273 273 <script type="text/javascript">
274 274 var clone_url = 'clone_url';
275 275 YUE.on(clone_url,'click',function(e){
276 276 if(YUD.hasClass(clone_url,'selected')){
277 277 return
278 278 }
279 279 else{
280 280 YUD.addClass(clone_url,'selected');
281 281 YUD.get(clone_url).select();
282 282 }
283 283 })
284 284
285 285 YUE.on('clone_by_name','click',function(e){
286 286 // show url by name and hide name button
287 287 YUD.setStyle('clone_url','display','');
288 288 YUD.setStyle('clone_by_name','display','none');
289 289
290 290 // hide url by id and show name button
291 291 YUD.setStyle('clone_by_id','display','');
292 292 YUD.setStyle('clone_url_id','display','none');
293 293
294 294 })
295 295 YUE.on('clone_by_id','click',function(e){
296 296
297 297 // show url by id and hide id button
298 298 YUD.setStyle('clone_by_id','display','none');
299 299 YUD.setStyle('clone_url_id','display','');
300 300
301 301 // hide url by name and show id button
302 302 YUD.setStyle('clone_by_name','display','');
303 303 YUD.setStyle('clone_url','display','none');
304 304 })
305 305
306 306
307 307 var tmpl_links = {};
308 308 %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
309 309 tmpl_links["${archive['type']}"] = '${h.link_to('__NAME__', h.url('files_archive_home',repo_name=c.dbrepo.repo_name, fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_='archive_icon ui-btn')}';
310 310 %endfor
311 311
312 312 YUE.on(['download_options','archive_subrepos'],'change',function(e){
313 313 var sm = YUD.get('download_options');
314 314 var new_cs = sm.options[sm.selectedIndex];
315 315
316 316 for(k in tmpl_links){
317 317 var s = YUD.get(k+'_link');
318 318 if(s){
319 319 var title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}";
320 320 title_tmpl= title_tmpl.replace('__CS_NAME__',new_cs.text);
321 321 title_tmpl = title_tmpl.replace('__CS_EXT__',k);
322 322
323 323 var url = tmpl_links[k].replace('__CS__',new_cs.value);
324 324 var subrepos = YUD.get('archive_subrepos').checked;
325 325 url = url.replace('__SUB__',subrepos);
326 326 url = url.replace('__NAME__',title_tmpl);
327 327 s.innerHTML = url
328 328 }
329 329 }
330 330 });
331 331 </script>
332 332 %if c.show_stats:
333 333 <script type="text/javascript">
334 334 var data = ${c.trending_languages|n};
335 335 var total = 0;
336 336 var no_data = true;
337 337 var tbl = document.createElement('table');
338 338 tbl.setAttribute('class','trending_language_tbl');
339 339 var cnt = 0;
340 340 for (var i=0;i<data.length;i++){
341 341 total+= data[i][1].count;
342 342 }
343 343 for (var i=0;i<data.length;i++){
344 344 cnt += 1;
345 345 no_data = false;
346 346
347 347 var hide = cnt>2;
348 348 var tr = document.createElement('tr');
349 349 if (hide){
350 350 tr.setAttribute('style','display:none');
351 351 tr.setAttribute('class','stats_hidden');
352 352 }
353 353 var k = data[i][0];
354 354 var obj = data[i][1];
355 355 var percentage = Math.round((obj.count/total*100),2);
356 356
357 357 var td1 = document.createElement('td');
358 358 td1.width = 150;
359 359 var trending_language_label = document.createElement('div');
360 360 trending_language_label.innerHTML = obj.desc+" ("+k+")";
361 361 td1.appendChild(trending_language_label);
362 362
363 363 var td2 = document.createElement('td');
364 364 td2.setAttribute('style','padding-right:14px !important');
365 365 var trending_language = document.createElement('div');
366 366 var nr_files = obj.count+" ${_('files')}";
367 367
368 368 trending_language.title = k+" "+nr_files;
369 369
370 370 if (percentage>22){
371 371 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>";
372 372 }
373 373 else{
374 374 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>";
375 375 }
376 376
377 377 trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner');
378 378 trending_language.style.width=percentage+"%";
379 379 td2.appendChild(trending_language);
380 380
381 381 tr.appendChild(td1);
382 382 tr.appendChild(td2);
383 383 tbl.appendChild(tr);
384 384 if(cnt == 3){
385 385 var show_more = document.createElement('tr');
386 386 var td = document.createElement('td');
387 387 lnk = document.createElement('a');
388 388
389 389 lnk.href='#';
390 390 lnk.innerHTML = "${_('show more')}";
391 391 lnk.id='code_stats_show_more';
392 392 td.appendChild(lnk);
393 393
394 394 show_more.appendChild(td);
395 395 show_more.appendChild(document.createElement('td'));
396 396 tbl.appendChild(show_more);
397 397 }
398 398
399 399 }
400 400
401 401 YUD.get('lang_stats').appendChild(tbl);
402 402 YUE.on('code_stats_show_more','click',function(){
403 403 l = YUD.getElementsByClassName('stats_hidden')
404 404 for (e in l){
405 405 YUD.setStyle(l[e],'display','');
406 406 };
407 407 YUD.setStyle(YUD.get('code_stats_show_more'),
408 408 'display','none');
409 409 });
410 410 </script>
411 411 <script type="text/javascript">
412 412 /**
413 413 * Plots summary graph
414 414 *
415 415 * @class SummaryPlot
416 416 * @param {from} initial from for detailed graph
417 417 * @param {to} initial to for detailed graph
418 418 * @param {dataset}
419 419 * @param {overview_dataset}
420 420 */
421 421 function SummaryPlot(from,to,dataset,overview_dataset) {
422 422 var initial_ranges = {
423 423 "xaxis":{
424 424 "from":from,
425 425 "to":to,
426 426 },
427 427 };
428 428 var dataset = dataset;
429 429 var overview_dataset = [overview_dataset];
430 430 var choiceContainer = YUD.get("legend_choices");
431 431 var choiceContainerTable = YUD.get("legend_choices_tables");
432 432 var plotContainer = YUD.get('commit_history');
433 433 var overviewContainer = YUD.get('overview');
434 434
435 435 var plot_options = {
436 436 bars: {show:true,align:'center',lineWidth:4},
437 437 legend: {show:true, container:"legend_container"},
438 438 points: {show:true,radius:0,fill:false},
439 439 yaxis: {tickDecimals:0,},
440 440 xaxis: {
441 441 mode: "time",
442 442 timeformat: "%d/%m",
443 443 min:from,
444 444 max:to,
445 445 },
446 446 grid: {
447 447 hoverable: true,
448 448 clickable: true,
449 449 autoHighlight:true,
450 450 color: "#999"
451 451 },
452 452 //selection: {mode: "x"}
453 453 };
454 454 var overview_options = {
455 455 legend:{show:false},
456 456 bars: {show:true,barWidth: 2,},
457 457 shadowSize: 0,
458 458 xaxis: {mode: "time", timeformat: "%d/%m/%y",},
459 459 yaxis: {ticks: 3, min: 0,tickDecimals:0,},
460 460 grid: {color: "#999",},
461 461 selection: {mode: "x"}
462 462 };
463 463
464 464 /**
465 465 *get dummy data needed in few places
466 466 */
467 467 function getDummyData(label){
468 468 return {"label":label,
469 469 "data":[{"time":0,
470 470 "commits":0,
471 471 "added":0,
472 472 "changed":0,
473 473 "removed":0,
474 474 }],
475 475 "schema":["commits"],
476 476 "color":'#ffffff',
477 477 }
478 478 }
479 479
480 480 /**
481 481 * generate checkboxes accordindly to data
482 482 * @param keys
483 483 * @returns
484 484 */
485 485 function generateCheckboxes(data) {
486 486 //append checkboxes
487 487 var i = 0;
488 488 choiceContainerTable.innerHTML = '';
489 489 for(var pos in data) {
490 490
491 491 data[pos].color = i;
492 492 i++;
493 493 if(data[pos].label != ''){
494 494 choiceContainerTable.innerHTML +=
495 495 '<tr><td><input type="checkbox" id="id_user_{0}" name="{0}" checked="checked" /> \
496 496 <label for="id_user_{0}">{0}</label></td></tr>'.format(data[pos].label);
497 497 }
498 498 }
499 499 }
500 500
501 501 /**
502 502 * ToolTip show
503 503 */
504 504 function showTooltip(x, y, contents) {
505 505 var div=document.getElementById('tooltip');
506 506 if(!div) {
507 507 div = document.createElement('div');
508 508 div.id="tooltip";
509 509 div.style.position="absolute";
510 510 div.style.border='1px solid #fdd';
511 511 div.style.padding='2px';
512 512 div.style.backgroundColor='#fee';
513 513 document.body.appendChild(div);
514 514 }
515 515 YUD.setStyle(div, 'opacity', 0);
516 516 div.innerHTML = contents;
517 517 div.style.top=(y + 5) + "px";
518 518 div.style.left=(x + 5) + "px";
519 519
520 520 var anim = new YAHOO.util.Anim(div, {opacity: {to: 0.8}}, 0.2);
521 521 anim.animate();
522 522 }
523 523
524 524 /**
525 525 * This function will detect if selected period has some changesets
526 526 for this user if it does this data is then pushed for displaying
527 527 Additionally it will only display users that are selected by the checkbox
528 528 */
529 529 function getDataAccordingToRanges(ranges) {
530 530
531 531 var data = [];
532 532 var new_dataset = {};
533 533 var keys = [];
534 534 var max_commits = 0;
535 535 for(var key in dataset){
536 536
537 537 for(var ds in dataset[key].data){
538 538 commit_data = dataset[key].data[ds];
539 539 if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
540 540
541 541 if(new_dataset[key] === undefined){
542 542 new_dataset[key] = {data:[],schema:["commits"],label:key};
543 543 }
544 544 new_dataset[key].data.push(commit_data);
545 545 }
546 546 }
547 547 if (new_dataset[key] !== undefined){
548 548 data.push(new_dataset[key]);
549 549 }
550 550 }
551 551
552 552 if (data.length > 0){
553 553 return data;
554 554 }
555 555 else{
556 556 //just return dummy data for graph to plot itself
557 557 return [getDummyData('')];
558 558 }
559 559 }
560 560
561 561 /**
562 562 * redraw using new checkbox data
563 563 */
564 564 function plotchoiced(e,args){
565 565 var cur_data = args[0];
566 566 var cur_ranges = args[1];
567 567
568 568 var new_data = [];
569 569 var inputs = choiceContainer.getElementsByTagName("input");
570 570
571 571 //show only checked labels
572 572 for(var i=0; i<inputs.length; i++) {
573 573 var checkbox_key = inputs[i].name;
574 574
575 575 if(inputs[i].checked){
576 576 for(var d in cur_data){
577 577 if(cur_data[d].label == checkbox_key){
578 578 new_data.push(cur_data[d]);
579 579 }
580 580 }
581 581 }
582 582 else{
583 583 //push dummy data to not hide the label
584 584 new_data.push(getDummyData(checkbox_key));
585 585 }
586 586 }
587 587
588 588 var new_options = YAHOO.lang.merge(plot_options, {
589 589 xaxis: {
590 590 min: cur_ranges.xaxis.from,
591 591 max: cur_ranges.xaxis.to,
592 592 mode:"time",
593 593 timeformat: "%d/%m",
594 594 },
595 595 });
596 596 if (!new_data){
597 597 new_data = [[0,1]];
598 598 }
599 599 // do the zooming
600 600 plot = YAHOO.widget.Flot(plotContainer, new_data, new_options);
601 601
602 602 plot.subscribe("plotselected", plotselected);
603 603
604 604 //resubscribe plothover
605 605 plot.subscribe("plothover", plothover);
606 606
607 607 // don't fire event on the overview to prevent eternal loop
608 608 overview.setSelection(cur_ranges, true);
609 609
610 610 }
611 611
612 612 /**
613 613 * plot only selected items from overview
614 614 * @param ranges
615 615 * @returns
616 616 */
617 617 function plotselected(ranges,cur_data) {
618 618 //updates the data for new plot
619 619 var data = getDataAccordingToRanges(ranges);
620 620 generateCheckboxes(data);
621 621
622 622 var new_options = YAHOO.lang.merge(plot_options, {
623 623 xaxis: {
624 624 min: ranges.xaxis.from,
625 625 max: ranges.xaxis.to,
626 626 mode:"time",
627 627 timeformat: "%d/%m",
628 628 },
629 629 });
630 630 // do the zooming
631 631 plot = YAHOO.widget.Flot(plotContainer, data, new_options);
632 632
633 633 plot.subscribe("plotselected", plotselected);
634 634
635 635 //resubscribe plothover
636 636 plot.subscribe("plothover", plothover);
637 637
638 638 // don't fire event on the overview to prevent eternal loop
639 639 overview.setSelection(ranges, true);
640 640
641 641 //resubscribe choiced
642 642 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]);
643 643 }
644 644
645 645 var previousPoint = null;
646 646
647 647 function plothover(o) {
648 648 var pos = o.pos;
649 649 var item = o.item;
650 650
651 651 //YUD.get("x").innerHTML = pos.x.toFixed(2);
652 652 //YUD.get("y").innerHTML = pos.y.toFixed(2);
653 653 if (item) {
654 654 if (previousPoint != item.datapoint) {
655 655 previousPoint = item.datapoint;
656 656
657 657 var tooltip = YUD.get("tooltip");
658 658 if(tooltip) {
659 659 tooltip.parentNode.removeChild(tooltip);
660 660 }
661 661 var x = item.datapoint.x.toFixed(2);
662 662 var y = item.datapoint.y.toFixed(2);
663 663
664 664 if (!item.series.label){
665 665 item.series.label = 'commits';
666 666 }
667 667 var d = new Date(x*1000);
668 668 var fd = d.toDateString()
669 669 var nr_commits = parseInt(y);
670 670
671 671 var cur_data = dataset[item.series.label].data[item.dataIndex];
672 672 var added = cur_data.added;
673 673 var changed = cur_data.changed;
674 674 var removed = cur_data.removed;
675 675
676 676 var nr_commits_suffix = " ${_('commits')} ";
677 677 var added_suffix = " ${_('files added')} ";
678 678 var changed_suffix = " ${_('files changed')} ";
679 679 var removed_suffix = " ${_('files removed')} ";
680 680
681 681
682 682 if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";}
683 683 if(added==1){added_suffix=" ${_('file added')} ";}
684 684 if(changed==1){changed_suffix=" ${_('file changed')} ";}
685 685 if(removed==1){removed_suffix=" ${_('file removed')} ";}
686 686
687 687 showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd
688 688 +'<br/>'+
689 689 nr_commits + nr_commits_suffix+'<br/>'+
690 690 added + added_suffix +'<br/>'+
691 691 changed + changed_suffix + '<br/>'+
692 692 removed + removed_suffix + '<br/>');
693 693 }
694 694 }
695 695 else {
696 696 var tooltip = YUD.get("tooltip");
697 697
698 698 if(tooltip) {
699 699 tooltip.parentNode.removeChild(tooltip);
700 700 }
701 701 previousPoint = null;
702 702 }
703 703 }
704 704
705 705 /**
706 706 * MAIN EXECUTION
707 707 */
708 708
709 709 var data = getDataAccordingToRanges(initial_ranges);
710 710 generateCheckboxes(data);
711 711
712 712 //main plot
713 713 var plot = YAHOO.widget.Flot(plotContainer,data,plot_options);
714 714
715 715 //overview
716 716 var overview = YAHOO.widget.Flot(overviewContainer,
717 717 overview_dataset, overview_options);
718 718
719 719 //show initial selection on overview
720 720 overview.setSelection(initial_ranges);
721 721
722 722 plot.subscribe("plotselected", plotselected);
723 723 plot.subscribe("plothover", plothover)
724 724
725 725 overview.subscribe("plotselected", function (ranges) {
726 726 plot.setSelection(ranges);
727 727 });
728 728
729 729 // user choices on overview
730 730 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
731 731 }
732 732 SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n});
733 733 </script>
734 734 %endif
735 735
736 736 </%def>
General Comments 0
You need to be logged in to leave comments. Login now