Show More
@@ -1,23 +1,23 b'' | |||
|
1 | 1 | ## -*- coding: utf-8 -*- |
|
2 | 2 | <%inherit file="/base/base.html"/> |
|
3 | 3 | <%def name="title()"> |
|
4 | 4 | ${_('%s Group Dashboard') % c.group.group_name} · ${c.rhodecode_name} |
|
5 | 5 | </%def> |
|
6 | 6 | |
|
7 | 7 | <%def name="breadcrumbs()"> |
|
8 | 8 | <span class="groups_breadcrumbs"> |
|
9 | 9 | ${h.link_to(_(u'Home'),h.url('/'))} |
|
10 | 10 | %if c.group.parent_group: |
|
11 | 11 | » ${h.link_to(c.group.parent_group.name,h.url('repos_group_home',group_name=c.group.parent_group.group_name))} |
|
12 | 12 | %endif |
|
13 | 13 | » "${c.group.name}" ${_('with')} |
|
14 | 14 | </span> |
|
15 | 15 | </%def> |
|
16 | 16 | |
|
17 | 17 | <%def name="page_nav()"> |
|
18 | 18 | ${self.menu('repositories')} |
|
19 | 19 | </%def> |
|
20 | 20 | |
|
21 | 21 | <%def name="main()"> |
|
22 |
<%include file="/index_base.html" args="parent=self, |
|
|
22 | <%include file="/index_base.html" args="parent=self,group_name=c.group.group_name"/> | |
|
23 | 23 | </%def> |
@@ -1,178 +1,178 b'' | |||
|
1 | <%page args="parent" /> | |
|
1 | <%page args="parent,group_name=''" /> | |
|
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" placeholder="${_('quick filter...')}" value=""/> ${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('new_repo',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 repository 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('new_repo'))}</span> |
|
19 | 19 | %if h.HasPermissionAny('hg.admin')(): |
|
20 | 20 | <span>${h.link_to(_(u'Add repository 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 repository 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="${_('Repository 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 | <div class="yui-skin-sam" id="repos_list_wrap"></div> |
|
76 | 76 | <div id="user-paginator" style="padding: 0px 0px 0px 0px"></div> |
|
77 | 77 | </div> |
|
78 | 78 | </div> |
|
79 | 79 | |
|
80 | 80 | <script> |
|
81 | 81 | var data = ${c.data|n}; |
|
82 | 82 | var myDataSource = new YAHOO.util.DataSource(data); |
|
83 | 83 | myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; |
|
84 | 84 | |
|
85 | 85 | myDataSource.responseSchema = { |
|
86 | 86 | resultsList: "records", |
|
87 | 87 | fields: [ |
|
88 | 88 | {key:"menu"}, |
|
89 | 89 | {key:"raw_name"}, |
|
90 | 90 | {key:"name"}, |
|
91 | 91 | {key:"desc"}, |
|
92 | 92 | {key:"last_change"}, |
|
93 | 93 | {key:"last_changeset"}, |
|
94 | 94 | {key:"owner"}, |
|
95 | 95 | {key:"atom"}, |
|
96 | 96 | ] |
|
97 | 97 | }; |
|
98 | 98 | myDataSource.doBeforeCallback = function(req,raw,res,cb) { |
|
99 | 99 | // This is the filter function |
|
100 | 100 | var data = res.results || [], |
|
101 | 101 | filtered = [], |
|
102 | 102 | i,l; |
|
103 | 103 | |
|
104 | 104 | if (req) { |
|
105 | 105 | req = req.toLowerCase(); |
|
106 | 106 | for (i = 0; i<data.length; i++) { |
|
107 | var pos = data[i].raw_name.toLowerCase().indexOf(req) | |
|
107 | var pos = data[i].raw_name.toLowerCase().indexOf(req, ${len(group_name)}) | |
|
108 | 108 | if (pos != -1) { |
|
109 | 109 | filtered.push(data[i]); |
|
110 | 110 | } |
|
111 | 111 | } |
|
112 | 112 | res.results = filtered; |
|
113 | 113 | } |
|
114 | 114 | YUD.get('repo_count').innerHTML = res.results.length; |
|
115 | 115 | return res; |
|
116 | 116 | } |
|
117 | 117 | |
|
118 | 118 | // main table sorting |
|
119 | 119 | var myColumnDefs = [ |
|
120 | 120 | {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, |
|
121 | 121 | {key:"name",label:"${_('Name')}",sortable:true, |
|
122 | 122 | sortOptions: { sortFunction: nameSort }}, |
|
123 | 123 | {key:"desc",label:"${_('Description')}",sortable:true}, |
|
124 | 124 | {key:"last_change",label:"${_('Last Change')}",sortable:true, |
|
125 | 125 | sortOptions: { sortFunction: ageSort }}, |
|
126 | 126 | {key:"last_changeset",label:"${_('Tip')}",sortable:true, |
|
127 | 127 | sortOptions: { sortFunction: revisionSort }}, |
|
128 | 128 | {key:"owner",label:"${_('Owner')}",sortable:true}, |
|
129 | 129 | {key:"atom",label:"",sortable:false}, |
|
130 | 130 | ]; |
|
131 | 131 | |
|
132 | 132 | var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{ |
|
133 | 133 | sortedBy:{key:"name",dir:"asc"}, |
|
134 | 134 | paginator: YUI_paginator(${c.visual.dashboard_items},['user-paginator']), |
|
135 | 135 | |
|
136 | 136 | MSG_SORTASC:"${_('Click to sort ascending')}", |
|
137 | 137 | MSG_SORTDESC:"${_('Click to sort descending')}", |
|
138 | 138 | MSG_EMPTY:"${_('No repositories found.')}", |
|
139 | 139 | MSG_ERROR:"${_('Data error.')}", |
|
140 | 140 | MSG_LOADING:"${_('Loading...')}", |
|
141 | 141 | } |
|
142 | 142 | ); |
|
143 | 143 | myDataTable.subscribe('postRenderEvent',function(oArgs) { |
|
144 | 144 | tooltip_activate(); |
|
145 | 145 | quick_repo_menu(); |
|
146 | 146 | }); |
|
147 | 147 | |
|
148 | 148 | var filterTimeout = null; |
|
149 | 149 | |
|
150 | 150 | updateFilter = function () { |
|
151 | 151 | // Reset timeout |
|
152 | 152 | filterTimeout = null; |
|
153 | 153 | |
|
154 | 154 | // Reset sort |
|
155 | 155 | var state = myDataTable.getState(); |
|
156 | 156 | state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC}; |
|
157 | 157 | |
|
158 | 158 | // Get filtered data |
|
159 | 159 | myDataSource.sendRequest(YUD.get('q_filter').value,{ |
|
160 | 160 | success : myDataTable.onDataReturnInitializeTable, |
|
161 | 161 | failure : myDataTable.onDataReturnInitializeTable, |
|
162 | 162 | scope : myDataTable, |
|
163 | 163 | argument: state |
|
164 | 164 | }); |
|
165 | 165 | |
|
166 | 166 | }; |
|
167 | 167 | YUE.on('q_filter','click',function(){ |
|
168 | 168 | if(!YUD.hasClass('q_filter', 'loaded')){ |
|
169 | 169 | //TODO: load here full list later to do search within groups |
|
170 | 170 | YUD.addClass('q_filter', 'loaded'); |
|
171 | 171 | } |
|
172 | 172 | }); |
|
173 | 173 | |
|
174 | 174 | YUE.on('q_filter','keyup',function (e) { |
|
175 | 175 | clearTimeout(filterTimeout); |
|
176 | 176 | filterTimeout = setTimeout(updateFilter,600); |
|
177 | 177 | }); |
|
178 | 178 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now