##// END OF EJS Templates
don't show rss links - atom is the present and the future...
Mads Kiilerich -
r3295:2e618376 beta
parent child Browse files
Show More
@@ -1,344 +1,336 b''
1 1 <%page args="parent" />
2 2 <div class="box">
3 3 <!-- box / title -->
4 4 <div class="title">
5 5 <h5>
6 6 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}"/> ${parent.breadcrumbs()} <span id="repo_count">0</span> ${_('repositories')}
7 7 </h5>
8 8 %if c.rhodecode_user.username != 'default':
9 9 <ul class="links">
10 10 %if h.HasPermissionAny('hg.admin','hg.create.repository')():
11 11 <li>
12 12 %if c.group:
13 13 %if h.HasReposGroupPermissionAny('group.write', 'group.admin')(c.group.group_name):
14 14 <span>${h.link_to(_('Add repository'),h.url('admin_settings_create_repository',parent_group=c.group.group_id))}</span>
15 15 %endif
16 16 %else:
17 17 <span>${h.link_to(_('Add repository'),h.url('admin_settings_create_repository'))}</span>
18 18 %endif
19 19 </li>
20 20 %endif
21 21 %if c.group and h.HasReposGroupPermissionAny('group.admin')(c.group.group_name):
22 22 <li>
23 23 <span>${h.link_to(_('Edit group'),h.url('edit_repos_group',group_name=c.group.group_name), title=_('You have admin right to this group, and can edit it'))}</span>
24 24 </li>
25 25 %endif
26 26 </ul>
27 27 %endif
28 28 </div>
29 29 <!-- end box / title -->
30 30 <div class="table">
31 31 % if c.groups:
32 32 <div id='groups_list_wrap' class="yui-skin-sam">
33 33 <table id="groups_list">
34 34 <thead>
35 35 <tr>
36 36 <th class="left"><a href="#">${_('Group name')}</a></th>
37 37 <th class="left"><a href="#">${_('Description')}</a></th>
38 38 ##<th class="left"><a href="#">${_('Number of repositories')}</a></th>
39 39 </tr>
40 40 </thead>
41 41
42 42 ## REPO GROUPS
43 43 % for gr in c.groups:
44 44 <tr>
45 45 <td>
46 46 <div style="white-space: nowrap">
47 47 <img class="icon" alt="${_('Repositories group')}" src="${h.url('/images/icons/database_link.png')}"/>
48 48 ${h.link_to(gr.name,url('repos_group_home',group_name=gr.group_name))}
49 49 </div>
50 50 </td>
51 51 %if c.visual.stylify_metatags:
52 52 <td>${h.urlify_text(h.desc_stylize(gr.group_description))}</td>
53 53 %else:
54 54 <td>${gr.group_description}</td>
55 55 %endif
56 56 ## this is commented out since for multi nested repos can be HEAVY!
57 57 ## in number of executed queries during traversing uncomment at will
58 58 ##<td><b>${gr.repositories_recursive_count}</b></td>
59 59 </tr>
60 60 % endfor
61 61 </table>
62 62 </div>
63 63 <div id="group-user-paginator" style="padding: 0px 0px 0px 0px"></div>
64 64 <div style="height: 20px"></div>
65 65 % endif
66 66 <div id="welcome" style="display:none;text-align:center">
67 67 <h1><a href="${h.url('home')}">${c.rhodecode_name} ${c.rhodecode_version}</a></h1>
68 68 </div>
69 69 <%cnt=0%>
70 70 <%namespace name="dt" file="/data_table/_dt_elements.html"/>
71 71 % if c.visual.lightweight_dashboard is False:
72 72 ## old full detailed version
73 73 <div id='repos_list_wrap' class="yui-skin-sam">
74 74 <table id="repos_list">
75 75 <thead>
76 76 <tr>
77 77 <th class="left"></th>
78 78 <th class="left">${_('Name')}</th>
79 79 <th class="left">${_('Description')}</th>
80 80 <th class="left">${_('Last change')}</th>
81 81 <th class="left">${_('Tip')}</th>
82 82 <th class="left">${_('Owner')}</th>
83 <th class="left">${_('RSS')}</th>
84 83 <th class="left">${_('Atom')}</th>
85 84 </tr>
86 85 </thead>
87 86 <tbody>
88 87 %for cnt,repo in enumerate(c.repos_list):
89 88 <tr class="parity${(cnt+1)%2}">
90 89 ##QUICK MENU
91 90 <td class="quick_repo_menu">
92 91 ${dt.quick_menu(repo['name'])}
93 92 </td>
94 93 ##REPO NAME AND ICONS
95 94 <td class="reponame">
96 95 ${dt.repo_name(repo['name'],repo['dbrepo']['repo_type'],repo['dbrepo']['private'],h.AttributeDict(repo['dbrepo_fork']),pageargs.get('short_repo_names'))}
97 96 </td>
98 97 ##DESCRIPTION
99 98 <td><span class="tooltip" title="${h.tooltip(repo['description'])}">
100 99 %if c.visual.stylify_metatags:
101 100 ${h.urlify_text(h.desc_stylize(h.truncate(repo['description'],60)))}</span>
102 101 %else:
103 102 ${h.truncate(repo['description'],60)}</span>
104 103 %endif
105 104 </td>
106 105 ##LAST CHANGE DATE
107 106 <td>
108 107 ${dt.last_change(repo['last_change'])}
109 108 </td>
110 109 ##LAST REVISION
111 110 <td>
112 111 ${dt.revision(repo['name'],repo['rev'],repo['tip'],repo['author'],repo['last_msg'])}
113 112 </td>
114 113 ##
115 114 <td title="${repo['contact']}">${h.person(repo['contact'])}</td>
116 115 <td>
117 ${dt.rss(repo['name'])}
118 </td>
119 <td>
120 116 ${dt.atom(repo['name'])}
121 117 </td>
122 118 </tr>
123 119 %endfor
124 120 </tbody>
125 121 </table>
126 122 </div>
127 123 % else:
128 124 ## lightweight version
129 125 <div class="yui-skin-sam" id="repos_list_wrap"></div>
130 126 <div id="user-paginator" style="padding: 0px 0px 0px 0px"></div>
131 127 % endif
132 128 </div>
133 129 </div>
134 130 % if c.visual.lightweight_dashboard is False:
135 131 <script>
136 132 YUD.get('repo_count').innerHTML = ${cnt+1 if cnt else 0};
137 133
138 134 // groups table sorting
139 135 var myColumnDefs = [
140 136 {key:"name",label:"${_('Group name')}",sortable:true,
141 137 sortOptions: { sortFunction: groupNameSort }},
142 138 {key:"desc",label:"${_('Description')}",sortable:true},
143 139 ];
144 140
145 141 var myDataSource = new YAHOO.util.DataSource(YUD.get("groups_list"));
146 142
147 143 myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
148 144 myDataSource.responseSchema = {
149 145 fields: [
150 146 {key:"name"},
151 147 {key:"desc"},
152 148 ]
153 149 };
154 150
155 151 var myDataTable = new YAHOO.widget.DataTable("groups_list_wrap", myColumnDefs, myDataSource,{
156 152 sortedBy:{key:"name",dir:"asc"},
157 153 paginator: new YAHOO.widget.Paginator({
158 154 rowsPerPage: 50,
159 155 alwaysVisible: false,
160 156 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
161 157 pageLinks: 5,
162 158 containerClass: 'pagination-wh',
163 159 currentPageClass: 'pager_curpage',
164 160 pageLinkClass: 'pager_link',
165 161 nextPageLinkLabel: '&gt;',
166 162 previousPageLinkLabel: '&lt;',
167 163 firstPageLinkLabel: '&lt;&lt;',
168 164 lastPageLinkLabel: '&gt;&gt;',
169 165 containers:['group-user-paginator']
170 166 }),
171 167 MSG_SORTASC:"${_('Click to sort ascending')}",
172 168 MSG_SORTDESC:"${_('Click to sort descending')}"
173 169 });
174 170
175 171 // main table sorting
176 172 var myColumnDefs = [
177 173 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
178 174 {key:"name",label:"${_('Name')}",sortable:true,
179 175 sortOptions: { sortFunction: nameSort }},
180 176 {key:"desc",label:"${_('Description')}",sortable:true},
181 177 {key:"last_change",label:"${_('Last Change')}",sortable:true,
182 178 sortOptions: { sortFunction: ageSort }},
183 179 {key:"tip",label:"${_('Tip')}",sortable:true,
184 180 sortOptions: { sortFunction: revisionSort }},
185 181 {key:"owner",label:"${_('Owner')}",sortable:true},
186 {key:"rss",label:"",sortable:false},
187 182 {key:"atom",label:"",sortable:false},
188 183 ];
189 184
190 185 var myDataSource = new YAHOO.util.DataSource(YUD.get("repos_list"));
191 186
192 187 myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
193 188
194 189 myDataSource.responseSchema = {
195 190 fields: [
196 191 {key:"menu"},
197 192 //{key:"raw_name"},
198 193 {key:"name"},
199 194 {key:"desc"},
200 195 {key:"last_change"},
201 196 {key:"tip"},
202 197 {key:"owner"},
203 {key:"rss"},
204 198 {key:"atom"},
205 199 ]
206 200 };
207 201
208 202 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,
209 203 {
210 204 sortedBy:{key:"name",dir:"asc"},
211 205 MSG_SORTASC:"${_('Click to sort ascending')}",
212 206 MSG_SORTDESC:"${_('Click to sort descending')}",
213 207 MSG_EMPTY:"${_('No records found.')}",
214 208 MSG_ERROR:"${_('Data error.')}",
215 209 MSG_LOADING:"${_('Loading...')}",
216 210 }
217 211 );
218 212 myDataTable.subscribe('postRenderEvent',function(oArgs) {
219 213 tooltip_activate();
220 214 quick_repo_menu();
221 215 var func = function(node){
222 216 return node.parentNode.parentNode.parentNode.parentNode;
223 217 }
224 218 q_filter('q_filter',YUQ('div.table tr td a.repo_name'),func);
225 219 });
226 220
227 221 </script>
228 222 % else:
229 223 <script>
230 224 var data = ${c.data|n};
231 225 var myDataSource = new YAHOO.util.DataSource(data);
232 226 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
233 227
234 228 myDataSource.responseSchema = {
235 229 resultsList: "records",
236 230 fields: [
237 231 {key:"menu"},
238 232 {key:"raw_name"},
239 233 {key:"name"},
240 234 {key:"desc"},
241 235 {key:"last_change"},
242 236 {key:"last_changeset"},
243 237 {key:"owner"},
244 {key:"rss"},
245 238 {key:"atom"},
246 239 ]
247 240 };
248 241 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
249 242 // This is the filter function
250 243 var data = res.results || [],
251 244 filtered = [],
252 245 i,l;
253 246
254 247 if (req) {
255 248 req = req.toLowerCase();
256 249 for (i = 0; i<data.length; i++) {
257 250 var pos = data[i].raw_name.toLowerCase().indexOf(req)
258 251 if (pos != -1) {
259 252 filtered.push(data[i]);
260 253 }
261 254 }
262 255 res.results = filtered;
263 256 }
264 257 YUD.get('repo_count').innerHTML = res.results.length;
265 258 return res;
266 259 }
267 260
268 261 // main table sorting
269 262 var myColumnDefs = [
270 263 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
271 264 {key:"name",label:"${_('Name')}",sortable:true,
272 265 sortOptions: { sortFunction: nameSort }},
273 266 {key:"desc",label:"${_('Description')}",sortable:true},
274 267 {key:"last_change",label:"${_('Last Change')}",sortable:true,
275 268 sortOptions: { sortFunction: ageSort }},
276 269 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
277 270 sortOptions: { sortFunction: revisionSort }},
278 271 {key:"owner",label:"${_('Owner')}",sortable:true},
279 {key:"rss",label:"",sortable:false},
280 272 {key:"atom",label:"",sortable:false},
281 273 ];
282 274
283 275 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
284 276 sortedBy:{key:"name",dir:"asc"},
285 277 paginator: new YAHOO.widget.Paginator({
286 278 rowsPerPage: ${c.visual.lightweight_dashboard_items},
287 279 alwaysVisible: false,
288 280 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
289 281 pageLinks: 5,
290 282 containerClass: 'pagination-wh',
291 283 currentPageClass: 'pager_curpage',
292 284 pageLinkClass: 'pager_link',
293 285 nextPageLinkLabel: '&gt;',
294 286 previousPageLinkLabel: '&lt;',
295 287 firstPageLinkLabel: '&lt;&lt;',
296 288 lastPageLinkLabel: '&gt;&gt;',
297 289 containers:['user-paginator']
298 290 }),
299 291
300 292 MSG_SORTASC:"${_('Click to sort ascending')}",
301 293 MSG_SORTDESC:"${_('Click to sort descending')}",
302 294 MSG_EMPTY:"${_('No records found.')}",
303 295 MSG_ERROR:"${_('Data error.')}",
304 296 MSG_LOADING:"${_('Loading...')}",
305 297 }
306 298 );
307 299 myDataTable.subscribe('postRenderEvent',function(oArgs) {
308 300 tooltip_activate();
309 301 quick_repo_menu();
310 302 });
311 303
312 304 var filterTimeout = null;
313 305
314 306 updateFilter = function () {
315 307 // Reset timeout
316 308 filterTimeout = null;
317 309
318 310 // Reset sort
319 311 var state = myDataTable.getState();
320 312 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
321 313
322 314 // Get filtered data
323 315 myDataSource.sendRequest(YUD.get('q_filter').value,{
324 316 success : myDataTable.onDataReturnInitializeTable,
325 317 failure : myDataTable.onDataReturnInitializeTable,
326 318 scope : myDataTable,
327 319 argument: state
328 320 });
329 321
330 322 };
331 323 YUE.on('q_filter','click',function(){
332 324 if(!YUD.hasClass('q_filter', 'loaded')){
333 325 YUD.get('q_filter').value = '';
334 326 //TODO: load here full list later to do search within groups
335 327 YUD.addClass('q_filter', 'loaded');
336 328 }
337 329 });
338 330
339 331 YUE.on('q_filter','keyup',function (e) {
340 332 clearTimeout(filterTimeout);
341 333 filterTimeout = setTimeout(updateFilter,600);
342 334 });
343 335 </script>
344 336 % endif
@@ -1,370 +1,367 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.html"/>
3 3 <%def name="title()">
4 4 ${_('Journal')} - ${c.rhodecode_name}
5 5 </%def>
6 6 <%def name="breadcrumbs()">
7 7 <h5>
8 8 <form id="filter_form">
9 9 <input class="q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term or _('quick filter...')}"/>
10 10 <span class="tooltip" title="${h.tooltip(h.journal_filter_help())}">?</span>
11 11 <input type='submit' value="${_('filter')}" class="ui-btn" style="padding:0px 2px 0px 2px;margin:0px"/>
12 12 ${_('journal')} - ${ungettext('%s entry', '%s entries', c.journal_pager.item_count) % (c.journal_pager.item_count)}
13 13 </form>
14 14 ${h.end_form()}
15 15 </h5>
16 16 </%def>
17 17 <%def name="page_nav()">
18 18 ${self.menu('journal')}
19 19 </%def>
20 20 <%def name="head_extra()">
21 21 <link href="${h.url('journal_atom', api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" />
22 22 <link href="${h.url('journal_rss', api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" />
23 23 </%def>
24 24 <%def name="main()">
25 25
26 26 <div class="box box-left">
27 27 <!-- box / title -->
28 28 <div class="title">
29 29 ${self.breadcrumbs()}
30 30 <ul class="links">
31 31 <li>
32 32 <span><a id="refresh" href="${h.url('journal')}"><img class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/></a></span>
33 33 </li>
34 34 <li>
35 <span><a href="${h.url('journal_rss', api_key=c.rhodecode_user.api_key)}"><img class="icon" title="${_('RSS feed')}" alt="${_('RSS feed')}" src="${h.url('/images/icons/rss_16.png')}"/></a></span>
36 </li>
37 <li>
38 <span><a href="${h.url('journal_atom', api_key=c.rhodecode_user.api_key)}"><img class="icon" title="${_('ATOM feed')}" alt="${_('ATOM feed')}" src="${h.url('/images/icons/atom.png')}"/></a></span>
35 <span><a href="${h.url('journal_atom', api_key=c.rhodecode_user.api_key)}"><img class="icon" title="${_('ATOM feed')}" alt="${_('ATOM feed')}" src="${h.url('/images/icons/rss_16.png')}"/></a></span>
39 36 </li>
40 37 </ul>
41 38 </div>
42 39 <div id="journal">${c.journal_data}</div>
43 40 </div>
44 41 <div class="box box-right">
45 42 <!-- box / title -->
46 43
47 44 <div class="title">
48 45 <h5>
49 46 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/>
50 47 <input class="q_filter_box" id="q_filter_watched" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/>
51 48 </h5>
52 49 <ul class="links" style="color:#DADADA">
53 50 <li>
54 51 <span><a id="show_watched" class="link-white current" href="#watched">${_('Watched')}</a> </span>
55 52 </li>
56 53 <li>
57 54 <span><a id="show_my" class="link-white" href="#my">${_('My repos')}</a> </span>
58 55 </li>
59 56 </ul>
60 57 </div>
61 58
62 59 <!-- end box / title -->
63 60 <div id="my_container" style="display:none">
64 61 <div class="table yui-skin-sam" id="repos_list_wrap"></div>
65 62 <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div>
66 63 </div>
67 64
68 65 <div id="watched_container">
69 66 <div class="table yui-skin-sam" id="watched_repos_list_wrap"></div>
70 67 <div id="watched-user-paginator" style="padding: 0px 0px 0px 20px"></div>
71 68 </div>
72 69 </div>
73 70
74 71 <script type="text/javascript">
75 72
76 73 YUE.on('j_filter','click',function(){
77 74 var jfilter = YUD.get('j_filter');
78 75 if(YUD.hasClass(jfilter, 'initial')){
79 76 jfilter.value = '';
80 77 }
81 78 });
82 79 var fix_j_filter_width = function(len){
83 80 YUD.setStyle(YUD.get('j_filter'),'width',Math.max(80, len*6.50)+'px');
84 81 }
85 82 YUE.on('j_filter','keyup',function(){
86 83 fix_j_filter_width(YUD.get('j_filter').value.length);
87 84 });
88 85 YUE.on('filter_form','submit',function(e){
89 86 YUE.preventDefault(e)
90 87 var val = YUD.get('j_filter').value;
91 88 window.location = "${url.current(filter='__FILTER__')}".replace('__FILTER__',val);
92 89 });
93 90 fix_j_filter_width(YUD.get('j_filter').value.length);
94 91
95 92 YUE.on('refresh','click',function(e){
96 93 ypjax("${h.url.current(filter=c.search_term)}","journal",function(){
97 94 show_more_event();
98 95 tooltip_activate();
99 96 show_changeset_tooltip();
100 97 });
101 98 YUE.preventDefault(e);
102 99 });
103 100
104 101 var show_my = function(e){
105 102 YUD.setStyle('watched_container','display','none');
106 103 YUD.setStyle('my_container','display','');
107 104 YUD.setStyle('q_filter','display','');
108 105 YUD.setStyle('q_filter_watched','display','none');
109 106
110 107 YUD.addClass('show_my', 'current');
111 108 YUD.removeClass('show_watched','current');
112 109
113 110 if(!YUD.hasClass('show_my', 'loaded')){
114 111 table_renderer(${c.data |n});
115 112 YUD.addClass('show_my', 'loaded');
116 113 }
117 114 }
118 115 YUE.on('show_my','click',function(e){
119 116 show_my(e);
120 117 })
121 118 var show_watched = function(e){
122 119 YUD.setStyle('my_container','display','none');
123 120 YUD.setStyle('watched_container','display','');
124 121 YUD.setStyle('q_filter_watched','display','');
125 122 YUD.setStyle('q_filter','display','none');
126 123
127 124 YUD.addClass('show_watched', 'current');
128 125 YUD.removeClass('show_my','current');
129 126 if(!YUD.hasClass('show_watched', 'loaded')){
130 127 watched_renderer(${c.watched_data |n});
131 128 YUD.addClass('show_watched', 'loaded');
132 129 }
133 130
134 131 return
135 132 var nodes = YUQ('#watched_container .watched_repo a');
136 133 var target = 'q_filter';
137 134 var func = function(node){
138 135 return node.parentNode.parentNode;
139 136 }
140 137 q_filter(target,nodes,func);
141 138 }
142 139 YUE.on('show_watched','click',function(e){
143 140 show_watched(e);
144 141 })
145 142 //init watched
146 143 show_watched();
147 144
148 145 var tabs = {
149 146 'watched': show_watched,
150 147 'my': show_my,
151 148 }
152 149 var url = location.href.split('#');
153 150 if (url[1]) {
154 151 //We have a hash
155 152 var tabHash = url[1];
156 153 var func = tabs[tabHash]
157 154 if (func){
158 155 func();
159 156 }
160 157 }
161 158 function watched_renderer(data){
162 159 var myDataSource = new YAHOO.util.DataSource(data);
163 160 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
164 161
165 162 myDataSource.responseSchema = {
166 163 resultsList: "records",
167 164 fields: [
168 165 {key:"menu"},
169 166 {key:"raw_name"},
170 167 {key:"name"},
171 168 {key:"last_changeset"},
172 169 {key:"action"},
173 170 ]
174 171 };
175 172 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
176 173 // This is the filter function
177 174 var data = res.results || [],
178 175 filtered = [],
179 176 i,l;
180 177
181 178 if (req) {
182 179 req = req.toLowerCase();
183 180 for (i = 0; i<data.length; i++) {
184 181 var pos = data[i].raw_name.toLowerCase().indexOf(req)
185 182 if (pos != -1) {
186 183 filtered.push(data[i]);
187 184 }
188 185 }
189 186 res.results = filtered;
190 187 }
191 188 return res;
192 189 }
193 190 // main table sorting
194 191 var myColumnDefs = [
195 192 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
196 193 {key:"name",label:"${_('Name')}",sortable:true,
197 194 sortOptions: { sortFunction: nameSort }},
198 195 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
199 196 sortOptions: { sortFunction: revisionSort }},
200 197 {key:"action",label:"${_('Action')}",sortable:false},
201 198 ];
202 199
203 200 var myDataTable = new YAHOO.widget.DataTable("watched_repos_list_wrap", myColumnDefs, myDataSource,{
204 201 sortedBy:{key:"name",dir:"asc"},
205 202 paginator: new YAHOO.widget.Paginator({
206 203 rowsPerPage: 25,
207 204 alwaysVisible: false,
208 205 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
209 206 pageLinks: 5,
210 207 containerClass: 'pagination-wh',
211 208 currentPageClass: 'pager_curpage',
212 209 pageLinkClass: 'pager_link',
213 210 nextPageLinkLabel: '&gt;',
214 211 previousPageLinkLabel: '&lt;',
215 212 firstPageLinkLabel: '&lt;&lt;',
216 213 lastPageLinkLabel: '&gt;&gt;',
217 214 containers:['watched-user-paginator']
218 215 }),
219 216
220 217 MSG_SORTASC:"${_('Click to sort ascending')}",
221 218 MSG_SORTDESC:"${_('Click to sort descending')}",
222 219 MSG_EMPTY:"${_('No records found.')}",
223 220 MSG_ERROR:"${_('Data error.')}",
224 221 MSG_LOADING:"${_('Loading...')}",
225 222 }
226 223 );
227 224 myDataTable.subscribe('postRenderEvent',function(oArgs) {
228 225 tooltip_activate();
229 226 quick_repo_menu();
230 227 });
231 228
232 229 var filterTimeout = null;
233 230
234 231 updateFilter = function () {
235 232 // Reset timeout
236 233 filterTimeout = null;
237 234
238 235 // Reset sort
239 236 var state = myDataTable.getState();
240 237 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
241 238
242 239 // Get filtered data
243 240 myDataSource.sendRequest(YUD.get('q_filter_watched').value,{
244 241 success : myDataTable.onDataReturnInitializeTable,
245 242 failure : myDataTable.onDataReturnInitializeTable,
246 243 scope : myDataTable,
247 244 argument: state
248 245 });
249 246
250 247 };
251 248 YUE.on('q_filter_watched','click',function(){
252 249 if(!YUD.hasClass('q_filter_watched', 'loaded')){
253 250 YUD.get('q_filter_watched').value = '';
254 251 //TODO: load here full list later to do search within groups
255 252 YUD.addClass('q_filter_watched', 'loaded');
256 253 }
257 254 });
258 255
259 256 YUE.on('q_filter_watched','keyup',function (e) {
260 257 clearTimeout(filterTimeout);
261 258 filterTimeout = setTimeout(updateFilter,600);
262 259 });
263 260 }
264 261
265 262 function table_renderer(data){
266 263 var myDataSource = new YAHOO.util.DataSource(data);
267 264 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
268 265
269 266 myDataSource.responseSchema = {
270 267 resultsList: "records",
271 268 fields: [
272 269 {key:"menu"},
273 270 {key:"raw_name"},
274 271 {key:"name"},
275 272 {key:"last_changeset"},
276 273 {key:"action"},
277 274 ]
278 275 };
279 276 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
280 277 // This is the filter function
281 278 var data = res.results || [],
282 279 filtered = [],
283 280 i,l;
284 281
285 282 if (req) {
286 283 req = req.toLowerCase();
287 284 for (i = 0; i<data.length; i++) {
288 285 var pos = data[i].raw_name.toLowerCase().indexOf(req)
289 286 if (pos != -1) {
290 287 filtered.push(data[i]);
291 288 }
292 289 }
293 290 res.results = filtered;
294 291 }
295 292 return res;
296 293 }
297 294 // main table sorting
298 295 var myColumnDefs = [
299 296 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
300 297 {key:"name",label:"${_('Name')}",sortable:true,
301 298 sortOptions: { sortFunction: nameSort }},
302 299 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
303 300 sortOptions: { sortFunction: revisionSort }},
304 301 {key:"action",label:"${_('Action')}",sortable:false},
305 302 ];
306 303
307 304 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
308 305 sortedBy:{key:"name",dir:"asc"},
309 306 paginator: new YAHOO.widget.Paginator({
310 307 rowsPerPage: 25,
311 308 alwaysVisible: false,
312 309 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
313 310 pageLinks: 5,
314 311 containerClass: 'pagination-wh',
315 312 currentPageClass: 'pager_curpage',
316 313 pageLinkClass: 'pager_link',
317 314 nextPageLinkLabel: '&gt;',
318 315 previousPageLinkLabel: '&lt;',
319 316 firstPageLinkLabel: '&lt;&lt;',
320 317 lastPageLinkLabel: '&gt;&gt;',
321 318 containers:['user-paginator']
322 319 }),
323 320
324 321 MSG_SORTASC:"${_('Click to sort ascending')}",
325 322 MSG_SORTDESC:"${_('Click to sort descending')}",
326 323 MSG_EMPTY:"${_('No records found.')}",
327 324 MSG_ERROR:"${_('Data error.')}",
328 325 MSG_LOADING:"${_('Loading...')}",
329 326 }
330 327 );
331 328 myDataTable.subscribe('postRenderEvent',function(oArgs) {
332 329 tooltip_activate();
333 330 quick_repo_menu();
334 331 });
335 332
336 333 var filterTimeout = null;
337 334
338 335 updateFilter = function () {
339 336 // Reset timeout
340 337 filterTimeout = null;
341 338
342 339 // Reset sort
343 340 var state = myDataTable.getState();
344 341 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
345 342
346 343 // Get filtered data
347 344 myDataSource.sendRequest(YUD.get('q_filter').value,{
348 345 success : myDataTable.onDataReturnInitializeTable,
349 346 failure : myDataTable.onDataReturnInitializeTable,
350 347 scope : myDataTable,
351 348 argument: state
352 349 });
353 350
354 351 };
355 352 YUE.on('q_filter','click',function(){
356 353 if(!YUD.hasClass('q_filter', 'loaded')){
357 354 YUD.get('q_filter').value = '';
358 355 //TODO: load here full list later to do search within groups
359 356 YUD.addClass('q_filter', 'loaded');
360 357 }
361 358 });
362 359
363 360 YUE.on('q_filter','keyup',function (e) {
364 361 clearTimeout(filterTimeout);
365 362 filterTimeout = setTimeout(updateFilter,600);
366 363 });
367 364 }
368 365
369 366 </script>
370 367 </%def>
@@ -1,35 +1,32 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.html"/>
3 3 <%def name="title()">
4 4 ${_('Journal')} - ${c.rhodecode_name}
5 5 </%def>
6 6 <%def name="breadcrumbs()">
7 7 ${c.rhodecode_name}
8 8 </%def>
9 9 <%def name="page_nav()">
10 10 ${self.menu('journal')}
11 11 </%def>
12 12 <%def name="head_extra()">
13 13 <link href="${h.url('public_journal_atom')}" rel="alternate" title="${_('ATOM public journal feed')}" type="application/atom+xml" />
14 14 <link href="${h.url('public_journal_rss')}" rel="alternate" title="${_('RSS public journal feed')}" type="application/rss+xml" />
15 15 </%def>
16 16 <%def name="main()">
17 17
18 18 <div class="box">
19 19 <!-- box / title -->
20 20 <div class="title">
21 21 <h5>${_('Public Journal')}</h5>
22 22 <ul class="links">
23 <li>
24 <span><a href="${h.url('public_journal_rss')}"><img class="icon" title="${_('RSS feed')}" alt="${_('RSS feed')}" src="${h.url('/images/icons/atom.png')}"/></a></span>
25 </li>
26 23 <li>
27 24 <span><a href="${h.url('public_journal_atom')}"><img class="icon" title="${_('ATOM feed')}" alt="${_('ATOM feed')}" src="${h.url('/images/icons/rss_16.png')}"/></a></span>
28 25 </li>
29 26 </ul>
30 27 </div>
31 28
32 29 <div id="journal">${c.journal_data}</div>
33 30 </div>
34 31
35 32 </%def>
@@ -1,727 +1,725 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 ${h.link_to(_(u'Home'),h.url('/'))}
9 9 &raquo;
10 10 ${h.repo_link(c.dbrepo.groups_and_repo)}
11 11 &raquo;
12 12 ${_('summary')}
13 13 </%def>
14 14
15 15 <%def name="page_nav()">
16 16 ${self.menu('summary')}
17 17 </%def>
18 18
19 19 <%def name="head_extra()">
20 20 <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" />
21 21 <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" />
22 22 </%def>
23 23
24 24 <%def name="main()">
25 25 <%
26 26 summary = lambda n:{False:'summary-short'}.get(n)
27 27 %>
28 28 %if c.show_stats:
29 29 <div class="box box-left">
30 30 %else:
31 31 <div class="box">
32 32 %endif
33 33 <!-- box / title -->
34 34 <div class="title">
35 35 ${self.breadcrumbs()}
36 36 </div>
37 37 <!-- end box / title -->
38 38 <div class="form">
39 39 <div id="summary" class="fields">
40 40
41 41 <div class="field">
42 42 <div class="label-summary">
43 43 <label>${_('Name')}:</label>
44 44 </div>
45 45 <div class="input ${summary(c.show_stats)}">
46 46 <div style="float:right;padding:5px 0px 0px 5px">
47 47 %if c.rhodecode_user.username != 'default':
48 ${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')}
49 48 ${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')}
50 49 %else:
51 ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.dbrepo.repo_name),class_='rss_icon')}
52 50 ${h.link_to(_('ATOM'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name),class_='atom_icon')}
53 51 %endif
54 52 </div>
55 53 %if c.rhodecode_user.username != 'default':
56 54 %if c.following:
57 55 <span id="follow_toggle" class="following tooltip" title="${_('Stop following this repository')}"
58 56 onclick="javascript:toggleFollowingRepo(this,${c.dbrepo.repo_id},'${str(h.get_token())}')">
59 57 </span>
60 58 %else:
61 59 <span id="follow_toggle" class="follow tooltip" title="${_('Start following this repository')}"
62 60 onclick="javascript:toggleFollowingRepo(this,${c.dbrepo.repo_id},'${str(h.get_token())}')">
63 61 </span>
64 62 %endif
65 63 <div style="float:right;padding:0px 0px 0px 0px">
66 64 <span class="reposize tooltip" title="${_('Click to show size of repository')}"
67 65 onclick="javascript:showRepoSize('repo_size','${c.dbrepo.repo_name}','${str(h.get_token())}')">
68 66 </span>
69 67 <span id="repo_size"></span>
70 68 </div>
71 69 %endif:
72 70
73 71 ## locking icon
74 72 %if c.rhodecode_db_repo.enable_locking:
75 73 %if c.rhodecode_db_repo.locked[0]:
76 74 <span class="locking_locked tooltip" title="${_('Repository locked by %s') % h.person_by_id(c.rhodecode_db_repo.locked[0])}"></span>
77 75 %else:
78 76 <span class="locking_unlocked tooltip" title="${_('Repository unlocked')}"></span>
79 77 %endif
80 78 %endif
81 79 ##REPO TYPE
82 80 %if h.is_hg(c.dbrepo):
83 81 <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
84 82 %endif
85 83 %if h.is_git(c.dbrepo):
86 84 <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
87 85 %endif
88 86
89 87 ##PUBLIC/PRIVATE
90 88 %if c.dbrepo.private:
91 89 <img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url('/images/icons/lock.png')}"/>
92 90 %else:
93 91 <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url('/images/icons/lock_open.png')}"/>
94 92 %endif
95 93
96 94 ##REPO NAME
97 95 <span class="repo_name" title="${_('Non changable ID %s') % c.dbrepo.repo_id}">${h.repo_link(c.dbrepo.groups_and_repo)}</span>
98 96
99 97 ##FORK
100 98 %if c.dbrepo.fork:
101 99 <div style="margin-top:5px;clear:both"">
102 100 <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')}"/>
103 101 ${_('Fork of')} ${c.dbrepo.fork.repo_name}
104 102 </a>
105 103 </div>
106 104 %endif
107 105 ##REMOTE
108 106 %if c.dbrepo.clone_uri:
109 107 <div style="margin-top:5px;clear:both">
110 108 <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')}"/>
111 109 ${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}
112 110 </a>
113 111 </div>
114 112 %endif
115 113 </div>
116 114 </div>
117 115
118 116 <div class="field">
119 117 <div class="label-summary">
120 118 <label>${_('Description')}:</label>
121 119 </div>
122 120 %if c.visual.stylify_metatags:
123 121 <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(h.desc_stylize(c.dbrepo.description))}</div>
124 122 %else:
125 123 <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(c.dbrepo.description)}</div>
126 124 %endif
127 125 </div>
128 126
129 127 <div class="field">
130 128 <div class="label-summary">
131 129 <label>${_('Contact')}:</label>
132 130 </div>
133 131 <div class="input ${summary(c.show_stats)}">
134 132 <div class="gravatar">
135 133 <img alt="gravatar" src="${h.gravatar_url(c.dbrepo.user.email)}"/>
136 134 </div>
137 135 ${_('Username')}: ${c.dbrepo.user.username}<br/>
138 136 ${_('Name')}: ${c.dbrepo.user.name} ${c.dbrepo.user.lastname}<br/>
139 137 ${_('Email')}: <a href="mailto:${c.dbrepo.user.email}">${c.dbrepo.user.email}</a>
140 138 </div>
141 139 </div>
142 140
143 141 <div class="field">
144 142 <div class="label-summary">
145 143 <label>${_('Clone url')}:</label>
146 144 </div>
147 145 <div class="input ${summary(c.show_stats)}">
148 146 <input style="width:80%" type="text" id="clone_url" readonly="readonly" value="${c.clone_repo_url}"/>
149 147 <input style="display:none;width:80%" type="text" id="clone_url_id" readonly="readonly" value="${c.clone_repo_url_id}"/>
150 148 <div style="display:none" id="clone_by_name" class="ui-btn clone">${_('Show by Name')}</div>
151 149 <div id="clone_by_id" class="ui-btn clone">${_('Show by ID')}</div>
152 150 </div>
153 151 </div>
154 152
155 153 <div class="field">
156 154 <div class="label-summary">
157 155 <label>${_('Trending files')}:</label>
158 156 </div>
159 157 <div class="input ${summary(c.show_stats)}">
160 158 %if c.show_stats:
161 159 <div id="lang_stats"></div>
162 160 %else:
163 161 ${_('Statistics are disabled for this repository')}
164 162 %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
165 163 ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")}
166 164 %endif
167 165 %endif
168 166 </div>
169 167 </div>
170 168
171 169 <div class="field">
172 170 <div class="label-summary">
173 171 <label>${_('Download')}:</label>
174 172 </div>
175 173 <div class="input ${summary(c.show_stats)}">
176 174 %if len(c.rhodecode_repo.revisions) == 0:
177 175 ${_('There are no downloads yet')}
178 176 %elif c.enable_downloads is False:
179 177 ${_('Downloads are disabled for this repository')}
180 178 %if h.HasPermissionAll('hg.admin')('enable downloads on from summary'):
181 179 ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")}
182 180 %endif
183 181 %else:
184 182 ${h.select('download_options',c.rhodecode_repo.get_changeset().raw_id,c.download_options)}
185 183 <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>
186 184 <span style="vertical-align: bottom">
187 185 <input id="archive_subrepos" type="checkbox" name="subrepos" />
188 186 <label for="archive_subrepos" class="tooltip" title="${h.tooltip(_('Check this to download archive with subrepos'))}" >${_('with subrepos')}</label>
189 187 </span>
190 188 %endif
191 189 </div>
192 190 </div>
193 191 </div>
194 192 </div>
195 193 </div>
196 194
197 195 %if c.show_stats:
198 196 <div class="box box-right" style="min-height:455px">
199 197 <!-- box / title -->
200 198 <div class="title">
201 199 <h5>${_('Commit activity by day / author')}</h5>
202 200 </div>
203 201
204 202 <div class="graph">
205 203 <div style="padding:0 10px 10px 17px;">
206 204 %if c.no_data:
207 205 ${c.no_data_msg}
208 206 %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
209 207 ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")}
210 208 %endif
211 209 %else:
212 210 ${_('Stats gathered: ')} ${c.stats_percentage}%
213 211 %endif
214 212 </div>
215 213 <div id="commit_history" style="width:450px;height:300px;float:left"></div>
216 214 <div style="clear: both;height: 10px"></div>
217 215 <div id="overview" style="width:450px;height:100px;float:left"></div>
218 216
219 217 <div id="legend_data" style="clear:both;margin-top:10px;">
220 218 <div id="legend_container"></div>
221 219 <div id="legend_choices">
222 220 <table id="legend_choices_tables" class="noborder" style="font-size:smaller;color:#545454"></table>
223 221 </div>
224 222 </div>
225 223 </div>
226 224 </div>
227 225 %endif
228 226
229 227 <div class="box">
230 228 <div class="title">
231 229 <div class="breadcrumbs">
232 230 %if c.repo_changesets:
233 231 ${h.link_to(_('Latest changes'),h.url('changelog_home',repo_name=c.repo_name))}
234 232 %else:
235 233 ${_('Quick start')}
236 234 %endif
237 235 </div>
238 236 </div>
239 237 <div class="table">
240 238 <div id="shortlog_data">
241 239 <%include file='../shortlog/shortlog_data.html'/>
242 240 </div>
243 241 </div>
244 242 </div>
245 243
246 244 %if c.readme_data:
247 245 <div id="readme" class="anchor">
248 246 <div class="box" style="background-color: #FAFAFA">
249 247 <div class="title" title="${_("Readme file at revision '%s'" % c.rhodecode_db_repo.landing_rev)}">
250 248 <div class="breadcrumbs">
251 249 <a href="${h.url('files_home',repo_name=c.repo_name,revision='tip',f_path=c.readme_file)}">${c.readme_file}</a>
252 250 <a class="permalink" href="#readme" title="${_('Permalink to this readme')}">&para;</a>
253 251 </div>
254 252 </div>
255 253 <div class="readme">
256 254 <div class="readme_box">
257 255 ${c.readme_data|n}
258 256 </div>
259 257 </div>
260 258 </div>
261 259 </div>
262 260 %endif
263 261
264 262 <script type="text/javascript">
265 263 var clone_url = 'clone_url';
266 264 YUE.on(clone_url,'click',function(e){
267 265 if(YUD.hasClass(clone_url,'selected')){
268 266 return
269 267 }
270 268 else{
271 269 YUD.addClass(clone_url,'selected');
272 270 YUD.get(clone_url).select();
273 271 }
274 272 })
275 273
276 274 YUE.on('clone_by_name','click',function(e){
277 275 // show url by name and hide name button
278 276 YUD.setStyle('clone_url','display','');
279 277 YUD.setStyle('clone_by_name','display','none');
280 278
281 279 // hide url by id and show name button
282 280 YUD.setStyle('clone_by_id','display','');
283 281 YUD.setStyle('clone_url_id','display','none');
284 282
285 283 })
286 284 YUE.on('clone_by_id','click',function(e){
287 285
288 286 // show url by id and hide id button
289 287 YUD.setStyle('clone_by_id','display','none');
290 288 YUD.setStyle('clone_url_id','display','');
291 289
292 290 // hide url by name and show id button
293 291 YUD.setStyle('clone_by_name','display','');
294 292 YUD.setStyle('clone_url','display','none');
295 293 })
296 294
297 295
298 296 var tmpl_links = {};
299 297 %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
300 298 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')}';
301 299 %endfor
302 300
303 301 YUE.on(['download_options','archive_subrepos'],'change',function(e){
304 302 var sm = YUD.get('download_options');
305 303 var new_cs = sm.options[sm.selectedIndex];
306 304
307 305 for(k in tmpl_links){
308 306 var s = YUD.get(k+'_link');
309 307 if(s){
310 308 var title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}";
311 309 title_tmpl= title_tmpl.replace('__CS_NAME__',new_cs.text);
312 310 title_tmpl = title_tmpl.replace('__CS_EXT__',k);
313 311
314 312 var url = tmpl_links[k].replace('__CS__',new_cs.value);
315 313 var subrepos = YUD.get('archive_subrepos').checked;
316 314 url = url.replace('__SUB__',subrepos);
317 315 url = url.replace('__NAME__',title_tmpl);
318 316 s.innerHTML = url
319 317 }
320 318 }
321 319 });
322 320 </script>
323 321 %if c.show_stats:
324 322 <script type="text/javascript">
325 323 var data = ${c.trending_languages|n};
326 324 var total = 0;
327 325 var no_data = true;
328 326 var tbl = document.createElement('table');
329 327 tbl.setAttribute('class','trending_language_tbl');
330 328 var cnt = 0;
331 329 for (var i=0;i<data.length;i++){
332 330 total+= data[i][1].count;
333 331 }
334 332 for (var i=0;i<data.length;i++){
335 333 cnt += 1;
336 334 no_data = false;
337 335
338 336 var hide = cnt>2;
339 337 var tr = document.createElement('tr');
340 338 if (hide){
341 339 tr.setAttribute('style','display:none');
342 340 tr.setAttribute('class','stats_hidden');
343 341 }
344 342 var k = data[i][0];
345 343 var obj = data[i][1];
346 344 var percentage = Math.round((obj.count/total*100),2);
347 345
348 346 var td1 = document.createElement('td');
349 347 td1.width = 150;
350 348 var trending_language_label = document.createElement('div');
351 349 trending_language_label.innerHTML = obj.desc+" ("+k+")";
352 350 td1.appendChild(trending_language_label);
353 351
354 352 var td2 = document.createElement('td');
355 353 td2.setAttribute('style','padding-right:14px !important');
356 354 var trending_language = document.createElement('div');
357 355 var nr_files = obj.count+" ${_('files')}";
358 356
359 357 trending_language.title = k+" "+nr_files;
360 358
361 359 if (percentage>22){
362 360 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>";
363 361 }
364 362 else{
365 363 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>";
366 364 }
367 365
368 366 trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner');
369 367 trending_language.style.width=percentage+"%";
370 368 td2.appendChild(trending_language);
371 369
372 370 tr.appendChild(td1);
373 371 tr.appendChild(td2);
374 372 tbl.appendChild(tr);
375 373 if(cnt == 3){
376 374 var show_more = document.createElement('tr');
377 375 var td = document.createElement('td');
378 376 lnk = document.createElement('a');
379 377
380 378 lnk.href='#';
381 379 lnk.innerHTML = "${_('show more')}";
382 380 lnk.id='code_stats_show_more';
383 381 td.appendChild(lnk);
384 382
385 383 show_more.appendChild(td);
386 384 show_more.appendChild(document.createElement('td'));
387 385 tbl.appendChild(show_more);
388 386 }
389 387
390 388 }
391 389
392 390 YUD.get('lang_stats').appendChild(tbl);
393 391 YUE.on('code_stats_show_more','click',function(){
394 392 l = YUD.getElementsByClassName('stats_hidden')
395 393 for (e in l){
396 394 YUD.setStyle(l[e],'display','');
397 395 };
398 396 YUD.setStyle(YUD.get('code_stats_show_more'),
399 397 'display','none');
400 398 });
401 399 </script>
402 400 <script type="text/javascript">
403 401 /**
404 402 * Plots summary graph
405 403 *
406 404 * @class SummaryPlot
407 405 * @param {from} initial from for detailed graph
408 406 * @param {to} initial to for detailed graph
409 407 * @param {dataset}
410 408 * @param {overview_dataset}
411 409 */
412 410 function SummaryPlot(from,to,dataset,overview_dataset) {
413 411 var initial_ranges = {
414 412 "xaxis":{
415 413 "from":from,
416 414 "to":to,
417 415 },
418 416 };
419 417 var dataset = dataset;
420 418 var overview_dataset = [overview_dataset];
421 419 var choiceContainer = YUD.get("legend_choices");
422 420 var choiceContainerTable = YUD.get("legend_choices_tables");
423 421 var plotContainer = YUD.get('commit_history');
424 422 var overviewContainer = YUD.get('overview');
425 423
426 424 var plot_options = {
427 425 bars: {show:true,align:'center',lineWidth:4},
428 426 legend: {show:true, container:"legend_container"},
429 427 points: {show:true,radius:0,fill:false},
430 428 yaxis: {tickDecimals:0,},
431 429 xaxis: {
432 430 mode: "time",
433 431 timeformat: "%d/%m",
434 432 min:from,
435 433 max:to,
436 434 },
437 435 grid: {
438 436 hoverable: true,
439 437 clickable: true,
440 438 autoHighlight:true,
441 439 color: "#999"
442 440 },
443 441 //selection: {mode: "x"}
444 442 };
445 443 var overview_options = {
446 444 legend:{show:false},
447 445 bars: {show:true,barWidth: 2,},
448 446 shadowSize: 0,
449 447 xaxis: {mode: "time", timeformat: "%d/%m/%y",},
450 448 yaxis: {ticks: 3, min: 0,tickDecimals:0,},
451 449 grid: {color: "#999",},
452 450 selection: {mode: "x"}
453 451 };
454 452
455 453 /**
456 454 *get dummy data needed in few places
457 455 */
458 456 function getDummyData(label){
459 457 return {"label":label,
460 458 "data":[{"time":0,
461 459 "commits":0,
462 460 "added":0,
463 461 "changed":0,
464 462 "removed":0,
465 463 }],
466 464 "schema":["commits"],
467 465 "color":'#ffffff',
468 466 }
469 467 }
470 468
471 469 /**
472 470 * generate checkboxes accordindly to data
473 471 * @param keys
474 472 * @returns
475 473 */
476 474 function generateCheckboxes(data) {
477 475 //append checkboxes
478 476 var i = 0;
479 477 choiceContainerTable.innerHTML = '';
480 478 for(var pos in data) {
481 479
482 480 data[pos].color = i;
483 481 i++;
484 482 if(data[pos].label != ''){
485 483 choiceContainerTable.innerHTML +=
486 484 '<tr><td><input type="checkbox" id="id_user_{0}" name="{0}" checked="checked" /> \
487 485 <label for="id_user_{0}">{0}</label></td></tr>'.format(data[pos].label);
488 486 }
489 487 }
490 488 }
491 489
492 490 /**
493 491 * ToolTip show
494 492 */
495 493 function showTooltip(x, y, contents) {
496 494 var div=document.getElementById('tooltip');
497 495 if(!div) {
498 496 div = document.createElement('div');
499 497 div.id="tooltip";
500 498 div.style.position="absolute";
501 499 div.style.border='1px solid #fdd';
502 500 div.style.padding='2px';
503 501 div.style.backgroundColor='#fee';
504 502 document.body.appendChild(div);
505 503 }
506 504 YUD.setStyle(div, 'opacity', 0);
507 505 div.innerHTML = contents;
508 506 div.style.top=(y + 5) + "px";
509 507 div.style.left=(x + 5) + "px";
510 508
511 509 var anim = new YAHOO.util.Anim(div, {opacity: {to: 0.8}}, 0.2);
512 510 anim.animate();
513 511 }
514 512
515 513 /**
516 514 * This function will detect if selected period has some changesets
517 515 for this user if it does this data is then pushed for displaying
518 516 Additionally it will only display users that are selected by the checkbox
519 517 */
520 518 function getDataAccordingToRanges(ranges) {
521 519
522 520 var data = [];
523 521 var new_dataset = {};
524 522 var keys = [];
525 523 var max_commits = 0;
526 524 for(var key in dataset){
527 525
528 526 for(var ds in dataset[key].data){
529 527 commit_data = dataset[key].data[ds];
530 528 if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
531 529
532 530 if(new_dataset[key] === undefined){
533 531 new_dataset[key] = {data:[],schema:["commits"],label:key};
534 532 }
535 533 new_dataset[key].data.push(commit_data);
536 534 }
537 535 }
538 536 if (new_dataset[key] !== undefined){
539 537 data.push(new_dataset[key]);
540 538 }
541 539 }
542 540
543 541 if (data.length > 0){
544 542 return data;
545 543 }
546 544 else{
547 545 //just return dummy data for graph to plot itself
548 546 return [getDummyData('')];
549 547 }
550 548 }
551 549
552 550 /**
553 551 * redraw using new checkbox data
554 552 */
555 553 function plotchoiced(e,args){
556 554 var cur_data = args[0];
557 555 var cur_ranges = args[1];
558 556
559 557 var new_data = [];
560 558 var inputs = choiceContainer.getElementsByTagName("input");
561 559
562 560 //show only checked labels
563 561 for(var i=0; i<inputs.length; i++) {
564 562 var checkbox_key = inputs[i].name;
565 563
566 564 if(inputs[i].checked){
567 565 for(var d in cur_data){
568 566 if(cur_data[d].label == checkbox_key){
569 567 new_data.push(cur_data[d]);
570 568 }
571 569 }
572 570 }
573 571 else{
574 572 //push dummy data to not hide the label
575 573 new_data.push(getDummyData(checkbox_key));
576 574 }
577 575 }
578 576
579 577 var new_options = YAHOO.lang.merge(plot_options, {
580 578 xaxis: {
581 579 min: cur_ranges.xaxis.from,
582 580 max: cur_ranges.xaxis.to,
583 581 mode:"time",
584 582 timeformat: "%d/%m",
585 583 },
586 584 });
587 585 if (!new_data){
588 586 new_data = [[0,1]];
589 587 }
590 588 // do the zooming
591 589 plot = YAHOO.widget.Flot(plotContainer, new_data, new_options);
592 590
593 591 plot.subscribe("plotselected", plotselected);
594 592
595 593 //resubscribe plothover
596 594 plot.subscribe("plothover", plothover);
597 595
598 596 // don't fire event on the overview to prevent eternal loop
599 597 overview.setSelection(cur_ranges, true);
600 598
601 599 }
602 600
603 601 /**
604 602 * plot only selected items from overview
605 603 * @param ranges
606 604 * @returns
607 605 */
608 606 function plotselected(ranges,cur_data) {
609 607 //updates the data for new plot
610 608 var data = getDataAccordingToRanges(ranges);
611 609 generateCheckboxes(data);
612 610
613 611 var new_options = YAHOO.lang.merge(plot_options, {
614 612 xaxis: {
615 613 min: ranges.xaxis.from,
616 614 max: ranges.xaxis.to,
617 615 mode:"time",
618 616 timeformat: "%d/%m",
619 617 },
620 618 });
621 619 // do the zooming
622 620 plot = YAHOO.widget.Flot(plotContainer, data, new_options);
623 621
624 622 plot.subscribe("plotselected", plotselected);
625 623
626 624 //resubscribe plothover
627 625 plot.subscribe("plothover", plothover);
628 626
629 627 // don't fire event on the overview to prevent eternal loop
630 628 overview.setSelection(ranges, true);
631 629
632 630 //resubscribe choiced
633 631 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]);
634 632 }
635 633
636 634 var previousPoint = null;
637 635
638 636 function plothover(o) {
639 637 var pos = o.pos;
640 638 var item = o.item;
641 639
642 640 //YUD.get("x").innerHTML = pos.x.toFixed(2);
643 641 //YUD.get("y").innerHTML = pos.y.toFixed(2);
644 642 if (item) {
645 643 if (previousPoint != item.datapoint) {
646 644 previousPoint = item.datapoint;
647 645
648 646 var tooltip = YUD.get("tooltip");
649 647 if(tooltip) {
650 648 tooltip.parentNode.removeChild(tooltip);
651 649 }
652 650 var x = item.datapoint.x.toFixed(2);
653 651 var y = item.datapoint.y.toFixed(2);
654 652
655 653 if (!item.series.label){
656 654 item.series.label = 'commits';
657 655 }
658 656 var d = new Date(x*1000);
659 657 var fd = d.toDateString()
660 658 var nr_commits = parseInt(y);
661 659
662 660 var cur_data = dataset[item.series.label].data[item.dataIndex];
663 661 var added = cur_data.added;
664 662 var changed = cur_data.changed;
665 663 var removed = cur_data.removed;
666 664
667 665 var nr_commits_suffix = " ${_('commits')} ";
668 666 var added_suffix = " ${_('files added')} ";
669 667 var changed_suffix = " ${_('files changed')} ";
670 668 var removed_suffix = " ${_('files removed')} ";
671 669
672 670
673 671 if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";}
674 672 if(added==1){added_suffix=" ${_('file added')} ";}
675 673 if(changed==1){changed_suffix=" ${_('file changed')} ";}
676 674 if(removed==1){removed_suffix=" ${_('file removed')} ";}
677 675
678 676 showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd
679 677 +'<br/>'+
680 678 nr_commits + nr_commits_suffix+'<br/>'+
681 679 added + added_suffix +'<br/>'+
682 680 changed + changed_suffix + '<br/>'+
683 681 removed + removed_suffix + '<br/>');
684 682 }
685 683 }
686 684 else {
687 685 var tooltip = YUD.get("tooltip");
688 686
689 687 if(tooltip) {
690 688 tooltip.parentNode.removeChild(tooltip);
691 689 }
692 690 previousPoint = null;
693 691 }
694 692 }
695 693
696 694 /**
697 695 * MAIN EXECUTION
698 696 */
699 697
700 698 var data = getDataAccordingToRanges(initial_ranges);
701 699 generateCheckboxes(data);
702 700
703 701 //main plot
704 702 var plot = YAHOO.widget.Flot(plotContainer,data,plot_options);
705 703
706 704 //overview
707 705 var overview = YAHOO.widget.Flot(overviewContainer,
708 706 overview_dataset, overview_options);
709 707
710 708 //show initial selection on overview
711 709 overview.setSelection(initial_ranges);
712 710
713 711 plot.subscribe("plotselected", plotselected);
714 712 plot.subscribe("plothover", plothover)
715 713
716 714 overview.subscribe("plotselected", function (ranges) {
717 715 plot.setSelection(ranges);
718 716 });
719 717
720 718 // user choices on overview
721 719 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
722 720 }
723 721 SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n});
724 722 </script>
725 723 %endif
726 724
727 725 </%def>
General Comments 0
You need to be logged in to leave comments. Login now