##// END OF EJS Templates
repo group index: clarify that it is repo group that can be created/edited
Mads Kiilerich -
r3990:d690d0ea default
parent child Browse files
Show More
@@ -1,84 +1,84 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('Repository groups administration')} &middot; ${c.rhodecode_name}
5 ${_('Repository groups administration')} &middot; ${c.rhodecode_name}
6 </%def>
6 </%def>
7
7
8
8
9 <%def name="breadcrumbs_links()">
9 <%def name="breadcrumbs_links()">
10 %if h.HasPermissionAny('hg.admin')():
10 %if h.HasPermissionAny('hg.admin')():
11 ${h.link_to(_('Admin'),h.url('admin_home'))}
11 ${h.link_to(_('Admin'),h.url('admin_home'))}
12 %else:
12 %else:
13 ${_('Admin')}
13 ${_('Admin')}
14 %endif
14 %endif
15 &raquo;
15 &raquo;
16 ${_('Repository groups')}
16 ${_('Repository groups')}
17 </%def>
17 </%def>
18
18
19 <%def name="page_nav()">
19 <%def name="page_nav()">
20 ${self.menu('admin')}
20 ${self.menu('admin')}
21 </%def>
21 </%def>
22
22
23 <%def name="main()">
23 <%def name="main()">
24 <div class="box">
24 <div class="box">
25 <!-- box / title -->
25 <!-- box / title -->
26 <div class="title">
26 <div class="title">
27 ${self.breadcrumbs()}
27 ${self.breadcrumbs()}
28 <ul class="links">
28 <ul class="links">
29 <li>
29 <li>
30 %if h.HasPermissionAny('hg.admin')():
30 %if h.HasPermissionAny('hg.admin')():
31 <span>${h.link_to(_(u'Add group'),h.url('new_repos_group'))}</span>
31 <span>${h.link_to(_(u'Add repository group'),h.url('new_repos_group'))}</span>
32 %endif
32 %endif
33 </li>
33 </li>
34 </ul>
34 </ul>
35 </div>
35 </div>
36 <!-- end box / title -->
36 <!-- end box / title -->
37 <div class="table">
37 <div class="table">
38 % if c.groups:
38 % if c.groups:
39 <table class="table_disp">
39 <table class="table_disp">
40
40
41 <thead>
41 <thead>
42 <tr>
42 <tr>
43 <th class="left"><a href="#">${_('Group name')}</a></th>
43 <th class="left"><a href="#">${_('Group name')}</a></th>
44 <th class="left"><a href="#">${_('Description')}</a></th>
44 <th class="left"><a href="#">${_('Description')}</a></th>
45 <th class="left"><a href="#">${_('Number of toplevel repositories')}</a></th>
45 <th class="left"><a href="#">${_('Number of toplevel repositories')}</a></th>
46 <th class="left" colspan="2">${_('Action')}</th>
46 <th class="left" colspan="2">${_('Action')}</th>
47 </tr>
47 </tr>
48 </thead>
48 </thead>
49
49
50 ## REPO GROUPS
50 ## REPO GROUPS
51
51
52 % for gr in c.groups:
52 % for gr in c.groups:
53 <% gr_cn = gr.repositories.count() %>
53 <% gr_cn = gr.repositories.count() %>
54 <tr>
54 <tr>
55 <td>
55 <td>
56 <div style="white-space: nowrap">
56 <div style="white-space: nowrap">
57 <img class="icon" alt="${_('Repository group')}" src="${h.url('/images/icons/database_link.png')}"/>
57 <img class="icon" alt="${_('Repository group')}" src="${h.url('/images/icons/database_link.png')}"/>
58 ${h.link_to(h.literal(' &raquo; '.join(map(h.safe_unicode,[g.name for g in gr.parents+[gr]]))), url('repos_group_home',group_name=gr.group_name))}
58 ${h.link_to(h.literal(' &raquo; '.join(map(h.safe_unicode,[g.name for g in gr.parents+[gr]]))), url('repos_group_home',group_name=gr.group_name))}
59 </div>
59 </div>
60 </td>
60 </td>
61 <td>${gr.group_description}</td>
61 <td>${gr.group_description}</td>
62 <td><b>${gr_cn}</b></td>
62 <td><b>${gr_cn}</b></td>
63 <td>
63 <td>
64 <a href="${h.url('edit_repos_group',group_name=gr.group_name)}" title="${_('Edit')}">
64 <a href="${h.url('edit_repos_group',group_name=gr.group_name)}" title="${_('Edit')}">
65 ${h.submit('edit_%s' % gr.group_name,_('edit'),class_="edit_icon action_button")}
65 ${h.submit('edit_%s' % gr.group_name,_('edit'),class_="edit_icon action_button")}
66 </a>
66 </a>
67 </td>
67 </td>
68 <td>
68 <td>
69 ${h.form(url('repos_group', group_name=gr.group_name),method='delete')}
69 ${h.form(url('repos_group', group_name=gr.group_name),method='delete')}
70 ${h.submit('remove_%s' % gr.name,_('delete'),class_="delete_icon action_button",onclick="return confirm('"+ungettext('Confirm to delete this group: %s with %s repository','Confirm to delete this group: %s with %s repositories',gr_cn) % (gr.name,gr_cn)+"');")}
70 ${h.submit('remove_%s' % gr.name,_('delete'),class_="delete_icon action_button",onclick="return confirm('"+ungettext('Confirm to delete this group: %s with %s repository','Confirm to delete this group: %s with %s repositories',gr_cn) % (gr.name,gr_cn)+"');")}
71 ${h.end_form()}
71 ${h.end_form()}
72 </td>
72 </td>
73 </tr>
73 </tr>
74 % endfor
74 % endfor
75
75
76 </table>
76 </table>
77 % else:
77 % else:
78 ${_('There are no repository groups yet')}
78 ${_('There are no repository groups yet')}
79 % endif
79 % endif
80
80
81 </div>
81 </div>
82 </div>
82 </div>
83
83
84 </%def>
84 </%def>
@@ -1,178 +1,178 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" 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 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 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 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)
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