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