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