Show More
@@ -1,340 +1,340 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')() or h.HasReposGroupPermissionAny('group.write', 'group.admin')(c.group.group_name if c.group else None): |
|
11 | 11 | <li> |
|
12 | 12 | %if c.group: |
|
13 | 13 | <span>${h.link_to(_('Add repository'),h.url('admin_settings_create_repository',parent_group=c.group.group_id))}</span> |
|
14 | 14 | %if h.HasPermissionAny('hg.admin')() or h.HasReposGroupPermissionAny('group.admin')(c.group.group_name): |
|
15 | 15 | <span>${h.link_to(_(u'Add group'),h.url('new_repos_group', parent_group=c.group.group_id))}</span> |
|
16 | 16 | %endif |
|
17 | 17 | %else: |
|
18 | 18 | <span>${h.link_to(_('Add repository'),h.url('admin_settings_create_repository'))}</span> |
|
19 | 19 | %if h.HasPermissionAny('hg.admin')(): |
|
20 | 20 | <span>${h.link_to(_(u'Add group'),h.url('new_repos_group'))}</span> |
|
21 | 21 | %endif |
|
22 | 22 | %endif |
|
23 | 23 | </li> |
|
24 | 24 | %endif |
|
25 | 25 | %if c.group and h.HasReposGroupPermissionAny('group.admin')(c.group.group_name): |
|
26 | 26 | <li> |
|
27 | 27 | <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> |
|
28 | 28 | </li> |
|
29 | 29 | %endif |
|
30 | 30 | </ul> |
|
31 | 31 | %endif |
|
32 | 32 | </div> |
|
33 | 33 | <!-- end box / title --> |
|
34 | 34 | <div class="table"> |
|
35 | 35 | % if c.groups: |
|
36 | 36 | <div id='groups_list_wrap' class="yui-skin-sam"> |
|
37 | 37 | <table id="groups_list"> |
|
38 | 38 | <thead> |
|
39 | 39 | <tr> |
|
40 | 40 | <th class="left"><a href="#">${_('Group name')}</a></th> |
|
41 | 41 | <th class="left"><a href="#">${_('Description')}</a></th> |
|
42 | 42 | ##<th class="left"><a href="#">${_('Number of repositories')}</a></th> |
|
43 | 43 | </tr> |
|
44 | 44 | </thead> |
|
45 | 45 | |
|
46 | 46 | ## REPO GROUPS |
|
47 | 47 | % for gr in c.groups: |
|
48 | 48 | <tr> |
|
49 | 49 | <td> |
|
50 | 50 | <div style="white-space: nowrap"> |
|
51 | 51 | <img class="icon" alt="${_('Repositories group')}" src="${h.url('/images/icons/database_link.png')}"/> |
|
52 | 52 | ${h.link_to(gr.name,url('repos_group_home',group_name=gr.group_name))} |
|
53 | 53 | </div> |
|
54 | 54 | </td> |
|
55 | 55 | %if c.visual.stylify_metatags: |
|
56 | 56 | <td>${h.urlify_text(h.desc_stylize(gr.group_description))}</td> |
|
57 | 57 | %else: |
|
58 | 58 | <td>${gr.group_description}</td> |
|
59 | 59 | %endif |
|
60 | 60 | ## this is commented out since for multi nested repos can be HEAVY! |
|
61 | 61 | ## in number of executed queries during traversing uncomment at will |
|
62 | 62 | ##<td><b>${gr.repositories_recursive_count}</b></td> |
|
63 | 63 | </tr> |
|
64 | 64 | % endfor |
|
65 | 65 | </table> |
|
66 | 66 | </div> |
|
67 | 67 | <div id="group-user-paginator" style="padding: 0px 0px 0px 0px"></div> |
|
68 | 68 | <div style="height: 20px"></div> |
|
69 | 69 | % endif |
|
70 | 70 | <div id="welcome" style="display:none;text-align:center"> |
|
71 | 71 | <h1><a href="${h.url('home')}">${c.rhodecode_name} ${c.rhodecode_version}</a></h1> |
|
72 | 72 | </div> |
|
73 | 73 | <%cnt=0%> |
|
74 | 74 | <%namespace name="dt" file="/data_table/_dt_elements.html"/> |
|
75 | 75 | % if c.visual.lightweight_dashboard is False: |
|
76 | 76 | ## old full detailed version |
|
77 | 77 | <div id='repos_list_wrap' class="yui-skin-sam"> |
|
78 | 78 | <table id="repos_list"> |
|
79 | 79 | <thead> |
|
80 | 80 | <tr> |
|
81 | 81 | <th class="left"></th> |
|
82 | 82 | <th class="left">${_('Name')}</th> |
|
83 | 83 | <th class="left">${_('Description')}</th> |
|
84 | 84 | <th class="left">${_('Last change')}</th> |
|
85 | 85 | <th class="left">${_('Tip')}</th> |
|
86 | 86 | <th class="left">${_('Owner')}</th> |
|
87 | 87 | <th class="left">${_('Atom')}</th> |
|
88 | 88 | </tr> |
|
89 | 89 | </thead> |
|
90 | 90 | <tbody> |
|
91 | 91 | %for cnt,repo in enumerate(c.repos_list): |
|
92 | 92 | <tr class="parity${(cnt+1)%2}"> |
|
93 | 93 | ##QUICK MENU |
|
94 | 94 | <td class="quick_repo_menu"> |
|
95 | 95 | ${dt.quick_menu(repo['name'])} |
|
96 | 96 | </td> |
|
97 | 97 | ##REPO NAME AND ICONS |
|
98 | 98 | <td class="reponame"> |
|
99 | 99 | ${dt.repo_name(repo['name'],repo['dbrepo']['repo_type'],repo['dbrepo']['private'],h.AttributeDict(repo['dbrepo_fork']),pageargs.get('short_repo_names'))} |
|
100 | 100 | </td> |
|
101 | 101 | ##DESCRIPTION |
|
102 | 102 | <td><span class="tooltip" title="${h.tooltip(repo['description'])}"> |
|
103 | 103 | %if c.visual.stylify_metatags: |
|
104 | 104 | ${h.urlify_text(h.desc_stylize(h.truncate(repo['description'],60)))}</span> |
|
105 | 105 | %else: |
|
106 | 106 | ${h.truncate(repo['description'],60)}</span> |
|
107 | 107 | %endif |
|
108 | 108 | </td> |
|
109 | 109 | ##LAST CHANGE DATE |
|
110 | 110 | <td> |
|
111 | 111 | ${dt.last_change(repo['last_change'])} |
|
112 | 112 | </td> |
|
113 | 113 | ##LAST REVISION |
|
114 | 114 | <td> |
|
115 | 115 | ${dt.revision(repo['name'],repo['rev'],repo['tip'],repo['author'],repo['last_msg'])} |
|
116 | 116 | </td> |
|
117 | 117 | ## |
|
118 | 118 | <td title="${repo['contact']}">${h.person(repo['contact'])}</td> |
|
119 | 119 | <td> |
|
120 | 120 | ${dt.atom(repo['name'])} |
|
121 | 121 | </td> |
|
122 | 122 | </tr> |
|
123 | 123 | %endfor |
|
124 | 124 | </tbody> |
|
125 | 125 | </table> |
|
126 | 126 | </div> |
|
127 | 127 | % else: |
|
128 | 128 | ## lightweight version |
|
129 | 129 | <div class="yui-skin-sam" id="repos_list_wrap"></div> |
|
130 | 130 | <div id="user-paginator" style="padding: 0px 0px 0px 0px"></div> |
|
131 | 131 | % endif |
|
132 | 132 | </div> |
|
133 | 133 | </div> |
|
134 | 134 | % if c.visual.lightweight_dashboard is False: |
|
135 | 135 | <script> |
|
136 | 136 | YUD.get('repo_count').innerHTML = ${cnt+1 if cnt else 0}; |
|
137 | 137 | |
|
138 | 138 | // groups table sorting |
|
139 | 139 | var myColumnDefs = [ |
|
140 | 140 | {key:"name",label:"${_('Group name')}",sortable:true, |
|
141 | 141 | sortOptions: { sortFunction: groupNameSort }}, |
|
142 | 142 | {key:"desc",label:"${_('Description')}",sortable:true}, |
|
143 | 143 | ]; |
|
144 | 144 | |
|
145 | 145 | var myDataSource = new YAHOO.util.DataSource(YUD.get("groups_list")); |
|
146 | 146 | |
|
147 | 147 | myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE; |
|
148 | 148 | myDataSource.responseSchema = { |
|
149 | 149 | fields: [ |
|
150 | 150 | {key:"name"}, |
|
151 | 151 | {key:"desc"}, |
|
152 | 152 | ] |
|
153 | 153 | }; |
|
154 | 154 | |
|
155 | 155 | var myDataTable = new YAHOO.widget.DataTable("groups_list_wrap", myColumnDefs, myDataSource,{ |
|
156 | 156 | sortedBy:{key:"name",dir:"asc"}, |
|
157 | 157 | paginator: new YAHOO.widget.Paginator({ |
|
158 | 158 | rowsPerPage: 50, |
|
159 | 159 | alwaysVisible: false, |
|
160 | 160 | template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}", |
|
161 | 161 | pageLinks: 5, |
|
162 | 162 | containerClass: 'pagination-wh', |
|
163 | 163 | currentPageClass: 'pager_curpage', |
|
164 | 164 | pageLinkClass: 'pager_link', |
|
165 | 165 | nextPageLinkLabel: '>', |
|
166 | 166 | previousPageLinkLabel: '<', |
|
167 | 167 | firstPageLinkLabel: '<<', |
|
168 | 168 | lastPageLinkLabel: '>>', |
|
169 | 169 | containers:['group-user-paginator'] |
|
170 | 170 | }), |
|
171 | 171 | MSG_SORTASC:"${_('Click to sort ascending')}", |
|
172 | 172 | MSG_SORTDESC:"${_('Click to sort descending')}" |
|
173 | 173 | }); |
|
174 | 174 | |
|
175 | 175 | // main table sorting |
|
176 | 176 | var myColumnDefs = [ |
|
177 | 177 | {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, |
|
178 | 178 | {key:"name",label:"${_('Name')}",sortable:true, |
|
179 | 179 | sortOptions: { sortFunction: nameSort }}, |
|
180 | 180 | {key:"desc",label:"${_('Description')}",sortable:true}, |
|
181 | 181 | {key:"last_change",label:"${_('Last Change')}",sortable:true, |
|
182 | 182 | sortOptions: { sortFunction: ageSort }}, |
|
183 | 183 | {key:"tip",label:"${_('Tip')}",sortable:true, |
|
184 | 184 | sortOptions: { sortFunction: revisionSort }}, |
|
185 | 185 | {key:"owner",label:"${_('Owner')}",sortable:true}, |
|
186 | 186 | {key:"atom",label:"",sortable:false}, |
|
187 | 187 | ]; |
|
188 | 188 | |
|
189 | 189 | var myDataSource = new YAHOO.util.DataSource(YUD.get("repos_list")); |
|
190 | 190 | |
|
191 | 191 | myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE; |
|
192 | 192 | |
|
193 | 193 | myDataSource.responseSchema = { |
|
194 | 194 | fields: [ |
|
195 | 195 | {key:"menu"}, |
|
196 | 196 | //{key:"raw_name"}, |
|
197 | 197 | {key:"name"}, |
|
198 | 198 | {key:"desc"}, |
|
199 | 199 | {key:"last_change"}, |
|
200 | 200 | {key:"tip"}, |
|
201 | 201 | {key:"owner"}, |
|
202 | 202 | {key:"atom"}, |
|
203 | 203 | ] |
|
204 | 204 | }; |
|
205 | 205 | |
|
206 | 206 | var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource, |
|
207 | 207 | { |
|
208 | 208 | sortedBy:{key:"name",dir:"asc"}, |
|
209 | 209 | MSG_SORTASC:"${_('Click to sort ascending')}", |
|
210 | 210 | MSG_SORTDESC:"${_('Click to sort descending')}", |
|
211 | 211 | MSG_EMPTY:"${_('No records found.')}", |
|
212 | 212 | MSG_ERROR:"${_('Data error.')}", |
|
213 | 213 | MSG_LOADING:"${_('Loading...')}", |
|
214 | 214 | } |
|
215 | 215 | ); |
|
216 | 216 | myDataTable.subscribe('postRenderEvent',function(oArgs) { |
|
217 | 217 | tooltip_activate(); |
|
218 | 218 | quick_repo_menu(); |
|
219 | 219 | var func = function(node){ |
|
220 | 220 | return node.parentNode.parentNode.parentNode.parentNode; |
|
221 | 221 | } |
|
222 | 222 | q_filter('q_filter',YUQ('div.table tr td a.repo_name'),func); |
|
223 | 223 | }); |
|
224 | 224 | |
|
225 | 225 | </script> |
|
226 | 226 | % else: |
|
227 | 227 | <script> |
|
228 | 228 | var data = ${c.data|n}; |
|
229 | 229 | var myDataSource = new YAHOO.util.DataSource(data); |
|
230 | 230 | myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; |
|
231 | 231 | |
|
232 | 232 | myDataSource.responseSchema = { |
|
233 | 233 | resultsList: "records", |
|
234 | 234 | fields: [ |
|
235 | 235 | {key:"menu"}, |
|
236 | 236 | {key:"raw_name"}, |
|
237 | 237 | {key:"name"}, |
|
238 | 238 | {key:"desc"}, |
|
239 | 239 | {key:"last_change"}, |
|
240 | 240 | {key:"last_changeset"}, |
|
241 | 241 | {key:"owner"}, |
|
242 | 242 | {key:"atom"}, |
|
243 | 243 | ] |
|
244 | 244 | }; |
|
245 | 245 | myDataSource.doBeforeCallback = function(req,raw,res,cb) { |
|
246 | 246 | // This is the filter function |
|
247 | 247 | var data = res.results || [], |
|
248 | 248 | filtered = [], |
|
249 | 249 | i,l; |
|
250 | 250 | |
|
251 | 251 | if (req) { |
|
252 | 252 | req = req.toLowerCase(); |
|
253 | 253 | for (i = 0; i<data.length; i++) { |
|
254 | 254 | var pos = data[i].raw_name.toLowerCase().indexOf(req) |
|
255 | 255 | if (pos != -1) { |
|
256 | 256 | filtered.push(data[i]); |
|
257 | 257 | } |
|
258 | 258 | } |
|
259 | 259 | res.results = filtered; |
|
260 | 260 | } |
|
261 | 261 | YUD.get('repo_count').innerHTML = res.results.length; |
|
262 | 262 | return res; |
|
263 | 263 | } |
|
264 | 264 | |
|
265 | 265 | // main table sorting |
|
266 | 266 | var myColumnDefs = [ |
|
267 | 267 | {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, |
|
268 | 268 | {key:"name",label:"${_('Name')}",sortable:true, |
|
269 | 269 | sortOptions: { sortFunction: nameSort }}, |
|
270 | 270 | {key:"desc",label:"${_('Description')}",sortable:true}, |
|
271 | 271 | {key:"last_change",label:"${_('Last Change')}",sortable:true, |
|
272 | 272 | sortOptions: { sortFunction: ageSort }}, |
|
273 | 273 | {key:"last_changeset",label:"${_('Tip')}",sortable:true, |
|
274 | 274 | sortOptions: { sortFunction: revisionSort }}, |
|
275 | 275 | {key:"owner",label:"${_('Owner')}",sortable:true}, |
|
276 | 276 | {key:"atom",label:"",sortable:false}, |
|
277 | 277 | ]; |
|
278 | 278 | |
|
279 | 279 | var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{ |
|
280 | 280 | sortedBy:{key:"name",dir:"asc"}, |
|
281 | 281 | paginator: new YAHOO.widget.Paginator({ |
|
282 | 282 | rowsPerPage: ${c.visual.lightweight_dashboard_items}, |
|
283 | 283 | alwaysVisible: false, |
|
284 | 284 | template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}", |
|
285 | 285 | pageLinks: 5, |
|
286 | 286 | containerClass: 'pagination-wh', |
|
287 | 287 | currentPageClass: 'pager_curpage', |
|
288 | 288 | pageLinkClass: 'pager_link', |
|
289 | 289 | nextPageLinkLabel: '>', |
|
290 | 290 | previousPageLinkLabel: '<', |
|
291 | 291 | firstPageLinkLabel: '<<', |
|
292 | 292 | lastPageLinkLabel: '>>', |
|
293 | 293 | containers:['user-paginator'] |
|
294 | 294 | }), |
|
295 | 295 | |
|
296 | 296 | MSG_SORTASC:"${_('Click to sort ascending')}", |
|
297 | 297 | MSG_SORTDESC:"${_('Click to sort descending')}", |
|
298 |
MSG_EMPTY:"${_('No re |
|
|
298 | MSG_EMPTY:"${_('No repositories found.')}", | |
|
299 | 299 | MSG_ERROR:"${_('Data error.')}", |
|
300 | 300 | MSG_LOADING:"${_('Loading...')}", |
|
301 | 301 | } |
|
302 | 302 | ); |
|
303 | 303 | myDataTable.subscribe('postRenderEvent',function(oArgs) { |
|
304 | 304 | tooltip_activate(); |
|
305 | 305 | quick_repo_menu(); |
|
306 | 306 | }); |
|
307 | 307 | |
|
308 | 308 | var filterTimeout = null; |
|
309 | 309 | |
|
310 | 310 | updateFilter = function () { |
|
311 | 311 | // Reset timeout |
|
312 | 312 | filterTimeout = null; |
|
313 | 313 | |
|
314 | 314 | // Reset sort |
|
315 | 315 | var state = myDataTable.getState(); |
|
316 | 316 | state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC}; |
|
317 | 317 | |
|
318 | 318 | // Get filtered data |
|
319 | 319 | myDataSource.sendRequest(YUD.get('q_filter').value,{ |
|
320 | 320 | success : myDataTable.onDataReturnInitializeTable, |
|
321 | 321 | failure : myDataTable.onDataReturnInitializeTable, |
|
322 | 322 | scope : myDataTable, |
|
323 | 323 | argument: state |
|
324 | 324 | }); |
|
325 | 325 | |
|
326 | 326 | }; |
|
327 | 327 | YUE.on('q_filter','click',function(){ |
|
328 | 328 | if(!YUD.hasClass('q_filter', 'loaded')){ |
|
329 | 329 | YUD.get('q_filter').value = ''; |
|
330 | 330 | //TODO: load here full list later to do search within groups |
|
331 | 331 | YUD.addClass('q_filter', 'loaded'); |
|
332 | 332 | } |
|
333 | 333 | }); |
|
334 | 334 | |
|
335 | 335 | YUE.on('q_filter','keyup',function (e) { |
|
336 | 336 | clearTimeout(filterTimeout); |
|
337 | 337 | filterTimeout = setTimeout(updateFilter,600); |
|
338 | 338 | }); |
|
339 | 339 | </script> |
|
340 | 340 | % endif |
General Comments 0
You need to be logged in to leave comments.
Login now