Show More
@@ -1,190 +1,190 b'' | |||||
1 | <%page args="parent,group_name=''" /> |
|
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.authuser.username != 'default': |
|
8 | %if c.authuser.username != 'default': | |
9 | <ul class="links"> |
|
9 | <ul class="links"> | |
10 | <li> |
|
10 | <li> | |
11 | <% |
|
11 | <% | |
12 | gr_name = c.group.group_name if c.group else None |
|
12 | gr_name = c.group.group_name if c.group else None | |
13 | # create repositories with write permission on group is set to true |
|
13 | # create repositories with write permission on group is set to true | |
14 | create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')() |
|
14 | create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')() | |
15 | group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'can write into group index page') |
|
15 | group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'can write into group index page') | |
16 | group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page') |
|
16 | group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page') | |
17 | %> |
|
17 | %> | |
18 | %if h.HasPermissionAny('hg.admin','hg.create.repository')() or (group_admin or (group_write and create_on_write)): |
|
18 | %if h.HasPermissionAny('hg.admin','hg.create.repository')() or (group_admin or (group_write and create_on_write)): | |
19 | %if c.group: |
|
19 | %if c.group: | |
20 |
<a href="${h.url('new_repo',parent_group=c.group.group_id)}" class="btn btn-small |
|
20 | <a href="${h.url('new_repo',parent_group=c.group.group_id)}" class="btn btn-small"><i class="icon-plus"></i> ${_('Add Repository')}</a> | |
21 | %if h.HasPermissionAny('hg.admin')() or h.HasRepoGroupPermissionAny('group.admin')(c.group.group_name): |
|
21 | %if h.HasPermissionAny('hg.admin')() or h.HasRepoGroupPermissionAny('group.admin')(c.group.group_name): | |
22 | <a href="${h.url('new_repos_group', parent_group=c.group.group_id)}" class="btn btn-small"><i class="icon-plus"></i> ${_(u'Add Repository Group')}</a> |
|
22 | <a href="${h.url('new_repos_group', parent_group=c.group.group_id)}" class="btn btn-small"><i class="icon-plus"></i> ${_(u'Add Repository Group')}</a> | |
23 | %endif |
|
23 | %endif | |
24 | %else: |
|
24 | %else: | |
25 |
<a href="${h.url('new_repo')}" class="btn btn-small |
|
25 | <a href="${h.url('new_repo')}" class="btn btn-small"><i class="icon-plus"></i> ${_('Add Repository')}</a> | |
26 | %if h.HasPermissionAny('hg.admin')(): |
|
26 | %if h.HasPermissionAny('hg.admin')(): | |
27 | <a href="${h.url('new_repos_group')}" class="btn btn-small"><i class="icon-plus"></i> ${_(u'Add Repository Group')}</a> |
|
27 | <a href="${h.url('new_repos_group')}" class="btn btn-small"><i class="icon-plus"></i> ${_(u'Add Repository Group')}</a> | |
28 | %endif |
|
28 | %endif | |
29 | %endif |
|
29 | %endif | |
30 | %endif |
|
30 | %endif | |
31 | %if c.group and h.HasRepoGroupPermissionAny('group.admin')(c.group.group_name): |
|
31 | %if c.group and h.HasRepoGroupPermissionAny('group.admin')(c.group.group_name): | |
32 | <a href="${h.url('edit_repo_group',group_name=c.group.group_name)}" title="${_('You have admin right to this group, and can edit it')}" class="btn btn-small"><i class="icon-pencil"></i> ${_('Edit Repository Group')}</a> |
|
32 | <a href="${h.url('edit_repo_group',group_name=c.group.group_name)}" title="${_('You have admin right to this group, and can edit it')}" class="btn btn-small"><i class="icon-pencil"></i> ${_('Edit Repository Group')}</a> | |
33 | %endif |
|
33 | %endif | |
34 | </li> |
|
34 | </li> | |
35 | </ul> |
|
35 | </ul> | |
36 | %endif |
|
36 | %endif | |
37 | </div> |
|
37 | </div> | |
38 | <!-- end box / title --> |
|
38 | <!-- end box / title --> | |
39 | <div class="table"> |
|
39 | <div class="table"> | |
40 | % if c.groups: |
|
40 | % if c.groups: | |
41 | <div id='groups_list_wrap' class="yui-skin-sam"> |
|
41 | <div id='groups_list_wrap' class="yui-skin-sam"> | |
42 | <table id="groups_list"> |
|
42 | <table id="groups_list"> | |
43 | <thead> |
|
43 | <thead> | |
44 | <tr> |
|
44 | <tr> | |
45 | <th class="left"><a href="#">${_('Group Name')}</a></th> |
|
45 | <th class="left"><a href="#">${_('Group Name')}</a></th> | |
46 | <th class="left"><a href="#">${_('Description')}</a></th> |
|
46 | <th class="left"><a href="#">${_('Description')}</a></th> | |
47 | ##<th class="left"><a href="#">${_('Number of Repositories')}</a></th> |
|
47 | ##<th class="left"><a href="#">${_('Number of Repositories')}</a></th> | |
48 | </tr> |
|
48 | </tr> | |
49 | </thead> |
|
49 | </thead> | |
50 |
|
50 | |||
51 | ## REPO GROUPS |
|
51 | ## REPO GROUPS | |
52 | % for gr in c.groups: |
|
52 | % for gr in c.groups: | |
53 | <tr> |
|
53 | <tr> | |
54 | <td> |
|
54 | <td> | |
55 | <div class="dt_repo"> |
|
55 | <div class="dt_repo"> | |
56 | <a href="${url('repos_group_home',group_name=gr.group_name)}"> |
|
56 | <a href="${url('repos_group_home',group_name=gr.group_name)}"> | |
57 | <i class="icon-folder"></i> |
|
57 | <i class="icon-folder"></i> | |
58 | <span class="dt_repo_name">${gr.name}</span> |
|
58 | <span class="dt_repo_name">${gr.name}</span> | |
59 | </a> |
|
59 | </a> | |
60 | </div> |
|
60 | </div> | |
61 | </td> |
|
61 | </td> | |
62 | %if c.visual.stylify_metatags: |
|
62 | %if c.visual.stylify_metatags: | |
63 | <td>${h.urlify_text(h.desc_stylize(gr.group_description))}</td> |
|
63 | <td>${h.urlify_text(h.desc_stylize(gr.group_description))}</td> | |
64 | %else: |
|
64 | %else: | |
65 | <td>${gr.group_description}</td> |
|
65 | <td>${gr.group_description}</td> | |
66 | %endif |
|
66 | %endif | |
67 | ## this is commented out since for multi nested repos can be HEAVY! |
|
67 | ## this is commented out since for multi nested repos can be HEAVY! | |
68 | ## in number of executed queries during traversing uncomment at will |
|
68 | ## in number of executed queries during traversing uncomment at will | |
69 | ##<td><b>${gr.repositories_recursive_count}</b></td> |
|
69 | ##<td><b>${gr.repositories_recursive_count}</b></td> | |
70 | </tr> |
|
70 | </tr> | |
71 | % endfor |
|
71 | % endfor | |
72 | </table> |
|
72 | </table> | |
73 | </div> |
|
73 | </div> | |
74 | <div id="group-user-paginator" style="padding: 0px 0px 0px 0px"></div> |
|
74 | <div id="group-user-paginator" style="padding: 0px 0px 0px 0px"></div> | |
75 | <div style="height: 20px"></div> |
|
75 | <div style="height: 20px"></div> | |
76 | % endif |
|
76 | % endif | |
77 | <div id="welcome" style="display:none;text-align:center"> |
|
77 | <div id="welcome" style="display:none;text-align:center"> | |
78 | <h1><a href="${h.url('home')}">${c.site_name} ${c.kallithea_version}</a></h1> |
|
78 | <h1><a href="${h.url('home')}">${c.site_name} ${c.kallithea_version}</a></h1> | |
79 | </div> |
|
79 | </div> | |
80 | <%cnt=0%> |
|
80 | <%cnt=0%> | |
81 | <%namespace name="dt" file="/data_table/_dt_elements.html"/> |
|
81 | <%namespace name="dt" file="/data_table/_dt_elements.html"/> | |
82 | <div class="yui-skin-sam" id="repos_list_wrap"></div> |
|
82 | <div class="yui-skin-sam" id="repos_list_wrap"></div> | |
83 | <div id="user-paginator" style="padding: 0px 0px 0px 0px"></div> |
|
83 | <div id="user-paginator" style="padding: 0px 0px 0px 0px"></div> | |
84 | </div> |
|
84 | </div> | |
85 | </div> |
|
85 | </div> | |
86 |
|
86 | |||
87 | <script> |
|
87 | <script> | |
88 | var data = ${c.data|n}; |
|
88 | var data = ${c.data|n}; | |
89 | var myDataSource = new YAHOO.util.DataSource(data); |
|
89 | var myDataSource = new YAHOO.util.DataSource(data); | |
90 | myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; |
|
90 | myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; | |
91 |
|
91 | |||
92 | myDataSource.responseSchema = { |
|
92 | myDataSource.responseSchema = { | |
93 | resultsList: "records", |
|
93 | resultsList: "records", | |
94 | fields: [ |
|
94 | fields: [ | |
95 | {key:"menu"}, |
|
95 | {key:"menu"}, | |
96 | {key:"raw_name"}, |
|
96 | {key:"raw_name"}, | |
97 | {key:"name"}, |
|
97 | {key:"name"}, | |
98 | {key:"desc"}, |
|
98 | {key:"desc"}, | |
99 | {key:"last_change"}, |
|
99 | {key:"last_change"}, | |
100 | {key:"last_changeset"}, |
|
100 | {key:"last_changeset"}, | |
101 | {key:"last_rev_raw"}, |
|
101 | {key:"last_rev_raw"}, | |
102 | {key:"owner"}, |
|
102 | {key:"owner"}, | |
103 | {key:"atom"} |
|
103 | {key:"atom"} | |
104 | ] |
|
104 | ] | |
105 | }; |
|
105 | }; | |
106 | myDataSource.doBeforeCallback = function(req,raw,res,cb) { |
|
106 | myDataSource.doBeforeCallback = function(req,raw,res,cb) { | |
107 | // This is the filter function |
|
107 | // This is the filter function | |
108 | var data = res.results || [], |
|
108 | var data = res.results || [], | |
109 | filtered = [], |
|
109 | filtered = [], | |
110 | i,l; |
|
110 | i,l; | |
111 |
|
111 | |||
112 | if (req) { |
|
112 | if (req) { | |
113 | req = req.toLowerCase(); |
|
113 | req = req.toLowerCase(); | |
114 | for (i = 0; i<data.length; i++) { |
|
114 | for (i = 0; i<data.length; i++) { | |
115 | var pos = data[i].raw_name.toLowerCase().indexOf(req, ${len(group_name)}) |
|
115 | var pos = data[i].raw_name.toLowerCase().indexOf(req, ${len(group_name)}) | |
116 | if (pos != -1) { |
|
116 | if (pos != -1) { | |
117 | filtered.push(data[i]); |
|
117 | filtered.push(data[i]); | |
118 | } |
|
118 | } | |
119 | } |
|
119 | } | |
120 | res.results = filtered; |
|
120 | res.results = filtered; | |
121 | } |
|
121 | } | |
122 | YUD.get('repo_count').innerHTML = res.results.length; |
|
122 | YUD.get('repo_count').innerHTML = res.results.length; | |
123 | return res; |
|
123 | return res; | |
124 | } |
|
124 | } | |
125 |
|
125 | |||
126 | // main table sorting |
|
126 | // main table sorting | |
127 | var myColumnDefs = [ |
|
127 | var myColumnDefs = [ | |
128 | {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, |
|
128 | {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, | |
129 | {key:"name",label:"${_('Name')}",sortable:true, |
|
129 | {key:"name",label:"${_('Name')}",sortable:true, | |
130 | sortOptions: { sortFunction: nameSort }}, |
|
130 | sortOptions: { sortFunction: nameSort }}, | |
131 | {key:"desc",label:"${_('Description')}",sortable:true}, |
|
131 | {key:"desc",label:"${_('Description')}",sortable:true}, | |
132 | {key:"last_change",label:"${_('Last Change')}",sortable:true, |
|
132 | {key:"last_change",label:"${_('Last Change')}",sortable:true, | |
133 | sortOptions: { sortFunction: ageSort }}, |
|
133 | sortOptions: { sortFunction: ageSort }}, | |
134 | {key:"last_changeset",label:"${_('Tip')}",sortable:true, |
|
134 | {key:"last_changeset",label:"${_('Tip')}",sortable:true, | |
135 | sortOptions: { sortFunction: revisionSort }}, |
|
135 | sortOptions: { sortFunction: revisionSort }}, | |
136 | {key:"owner",label:"${_('Owner')}",sortable:true}, |
|
136 | {key:"owner",label:"${_('Owner')}",sortable:true}, | |
137 | {key:"atom",label:"",sortable:false} |
|
137 | {key:"atom",label:"",sortable:false} | |
138 | ]; |
|
138 | ]; | |
139 |
|
139 | |||
140 | var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{ |
|
140 | var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{ | |
141 | sortedBy:{key:"name",dir:"asc"}, |
|
141 | sortedBy:{key:"name",dir:"asc"}, | |
142 | paginator: YUI_paginator(${c.visual.dashboard_items},['user-paginator']), |
|
142 | paginator: YUI_paginator(${c.visual.dashboard_items},['user-paginator']), | |
143 |
|
143 | |||
144 | MSG_SORTASC:"${_('Click to sort ascending')}", |
|
144 | MSG_SORTASC:"${_('Click to sort ascending')}", | |
145 | MSG_SORTDESC:"${_('Click to sort descending')}", |
|
145 | MSG_SORTDESC:"${_('Click to sort descending')}", | |
146 | MSG_EMPTY:"${_('No repositories found.')}", |
|
146 | MSG_EMPTY:"${_('No repositories found.')}", | |
147 | MSG_ERROR:"${_('Data error.')}", |
|
147 | MSG_ERROR:"${_('Data error.')}", | |
148 | MSG_LOADING:"${_('Loading...')}" |
|
148 | MSG_LOADING:"${_('Loading...')}" | |
149 | } |
|
149 | } | |
150 | ); |
|
150 | ); | |
151 | myDataTable.subscribe('postRenderEvent',function(oArgs) { |
|
151 | myDataTable.subscribe('postRenderEvent',function(oArgs) { | |
152 | tooltip_activate(); |
|
152 | tooltip_activate(); | |
153 | quick_repo_menu(); |
|
153 | quick_repo_menu(); | |
154 | }); |
|
154 | }); | |
155 |
|
155 | |||
156 | var filterTimeout = null; |
|
156 | var filterTimeout = null; | |
157 |
|
157 | |||
158 | updateFilter = function () { |
|
158 | updateFilter = function () { | |
159 | // Reset timeout |
|
159 | // Reset timeout | |
160 | filterTimeout = null; |
|
160 | filterTimeout = null; | |
161 |
|
161 | |||
162 | // Reset sort |
|
162 | // Reset sort | |
163 | var state = myDataTable.getState(); |
|
163 | var state = myDataTable.getState(); | |
164 | state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC}; |
|
164 | state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC}; | |
165 |
|
165 | |||
166 | // Get filtered data |
|
166 | // Get filtered data | |
167 | myDataSource.sendRequest(YUD.get('q_filter').value,{ |
|
167 | myDataSource.sendRequest(YUD.get('q_filter').value,{ | |
168 | success : myDataTable.onDataReturnInitializeTable, |
|
168 | success : myDataTable.onDataReturnInitializeTable, | |
169 | failure : myDataTable.onDataReturnInitializeTable, |
|
169 | failure : myDataTable.onDataReturnInitializeTable, | |
170 | scope : myDataTable, |
|
170 | scope : myDataTable, | |
171 | argument: state |
|
171 | argument: state | |
172 | }); |
|
172 | }); | |
173 |
|
173 | |||
174 | }; |
|
174 | }; | |
175 | $('#q_filter').click(function(){ |
|
175 | $('#q_filter').click(function(){ | |
176 | if(!$('#q_filter').hasClass('loaded')){ |
|
176 | if(!$('#q_filter').hasClass('loaded')){ | |
177 | //TODO: load here full list later to do search within groups |
|
177 | //TODO: load here full list later to do search within groups | |
178 | $('#q_filter').addClass('loaded'); |
|
178 | $('#q_filter').addClass('loaded'); | |
179 | } |
|
179 | } | |
180 | }); |
|
180 | }); | |
181 |
|
181 | |||
182 | $('#q_filter').keyup(function(){ |
|
182 | $('#q_filter').keyup(function(){ | |
183 | clearTimeout(filterTimeout); |
|
183 | clearTimeout(filterTimeout); | |
184 | filterTimeout = setTimeout(updateFilter,600); |
|
184 | filterTimeout = setTimeout(updateFilter,600); | |
185 | }); |
|
185 | }); | |
186 |
|
186 | |||
187 | if($('#q_filter').val()) { |
|
187 | if($('#q_filter').val()) { | |
188 | updateFilter(); |
|
188 | updateFilter(); | |
189 | } |
|
189 | } | |
190 | </script> |
|
190 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now