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