##// END OF EJS Templates
user edit and journal: drop "Add repo" - it has a more natural location in the "group"
Mads Kiilerich -
r3293:09ba877d beta
parent child Browse files
Show More
@@ -1,280 +1,275
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 ${_('My account')} ${c.rhodecode_user.username} - ${c.rhodecode_name}
5 ${_('My account')} ${c.rhodecode_user.username} - ${c.rhodecode_name}
6 </%def>
6 </%def>
7
7
8 <%def name="breadcrumbs_links()">
8 <%def name="breadcrumbs_links()">
9 ${_('My Account')}
9 ${_('My Account')}
10 </%def>
10 </%def>
11
11
12 <%def name="page_nav()">
12 <%def name="page_nav()">
13 ${self.menu('admin')}
13 ${self.menu('admin')}
14 </%def>
14 </%def>
15
15
16 <%def name="main()">
16 <%def name="main()">
17
17
18 <div class="box box-left">
18 <div class="box box-left">
19 <!-- box / title -->
19 <!-- box / title -->
20 <div class="title">
20 <div class="title">
21 ${self.breadcrumbs()}
21 ${self.breadcrumbs()}
22 </div>
22 </div>
23 <!-- end box / title -->
23 <!-- end box / title -->
24 ${c.form|n}
24 ${c.form|n}
25 </div>
25 </div>
26
26
27 <div class="box box-right">
27 <div class="box box-right">
28 <!-- box / title -->
28 <!-- box / title -->
29 <div class="title">
29 <div class="title">
30 <h5>
30 <h5>
31 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/>
31 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/>
32 </h5>
32 </h5>
33 <ul class="links" style="color:#DADADA">
33 <ul class="links" style="color:#DADADA">
34 <li>
34 <li>
35 <span><a id="show_perms" class="link-white current" href="#perms">${_('My permissions')}</a> </span>
35 <span><a id="show_perms" class="link-white current" href="#perms">${_('My permissions')}</a> </span>
36 </li>
36 </li>
37 <li>
37 <li>
38 <span><a id="show_my" class="link-white" href="#my">${_('My repos')}</a> </span>
38 <span><a id="show_my" class="link-white" href="#my">${_('My repos')}</a> </span>
39 </li>
39 </li>
40 <li>
40 <li>
41 <span><a id="show_pullrequests" class="link-white" href="#pullrequests">${_('My pull requests')}</a> </span>
41 <span><a id="show_pullrequests" class="link-white" href="#pullrequests">${_('My pull requests')}</a> </span>
42 </li>
42 </li>
43 %if h.HasPermissionAny('hg.admin','hg.create.repository')():
44 <li>
45 <span>${h.link_to(_('Add repo'),h.url('admin_settings_create_repository'))}</span>
46 </li>
47 %endif
48 </ul>
43 </ul>
49 </div>
44 </div>
50 <!-- end box / title -->
45 <!-- end box / title -->
51 <div id="perms_container">
46 <div id="perms_container">
52 <div id="perms" class="table">
47 <div id="perms" class="table">
53 %for section in sorted(c.rhodecode_user.permissions.keys()):
48 %for section in sorted(c.rhodecode_user.permissions.keys()):
54 <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
49 <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
55
50
56 <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
51 <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
57 <table id="tbl_list_${section}">
52 <table id="tbl_list_${section}">
58 <thead>
53 <thead>
59 <tr>
54 <tr>
60 <th class="left">${_('Name')}</th>
55 <th class="left">${_('Name')}</th>
61 <th class="left">${_('Permission')}</th>
56 <th class="left">${_('Permission')}</th>
62 </thead>
57 </thead>
63 <tbody>
58 <tbody>
64 %for k in c.rhodecode_user.permissions[section]:
59 %for k in c.rhodecode_user.permissions[section]:
65 <%
60 <%
66 if section != 'global':
61 if section != 'global':
67 section_perm = c.rhodecode_user.permissions[section].get(k)
62 section_perm = c.rhodecode_user.permissions[section].get(k)
68 _perm = section_perm.split('.')[-1]
63 _perm = section_perm.split('.')[-1]
69 else:
64 else:
70 _perm = section_perm = None
65 _perm = section_perm = None
71 %>
66 %>
72 %if _perm not in ['none']:
67 %if _perm not in ['none']:
73 <tr>
68 <tr>
74 <td>
69 <td>
75 %if section == 'repositories':
70 %if section == 'repositories':
76 <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
71 <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
77 %elif section == 'repositories_groups':
72 %elif section == 'repositories_groups':
78 <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
73 <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
79 %else:
74 %else:
80 ${k}
75 ${k}
81 %endif
76 %endif
82 </td>
77 </td>
83 <td>
78 <td>
84 %if section == 'global':
79 %if section == 'global':
85 ${h.bool2icon(True)}
80 ${h.bool2icon(True)}
86 %else:
81 %else:
87 <span class="perm_tag ${_perm}">${section_perm}</span>
82 <span class="perm_tag ${_perm}">${section_perm}</span>
88 %endif
83 %endif
89 </td>
84 </td>
90 </tr>
85 </tr>
91 %endif
86 %endif
92 %endfor
87 %endfor
93 </tbody>
88 </tbody>
94 </table>
89 </table>
95 </div>
90 </div>
96 %endfor
91 %endfor
97 </div>
92 </div>
98 </div>
93 </div>
99 <div id="my_container" style="display:none">
94 <div id="my_container" style="display:none">
100 <div class="table yui-skin-sam" id="repos_list_wrap"></div>
95 <div class="table yui-skin-sam" id="repos_list_wrap"></div>
101 <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div>
96 <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div>
102 </div>
97 </div>
103 <div id="pullrequests_container" class="table" style="display:none">
98 <div id="pullrequests_container" class="table" style="display:none">
104 ## loaded via AJAX
99 ## loaded via AJAX
105 ${_('Loading...')}
100 ${_('Loading...')}
106 </div>
101 </div>
107 </div>
102 </div>
108
103
109 <script type="text/javascript">
104 <script type="text/javascript">
110
105
111 var show_perms = function(e){
106 var show_perms = function(e){
112 YUD.addClass('show_perms', 'current');
107 YUD.addClass('show_perms', 'current');
113 YUD.removeClass('show_my','current');
108 YUD.removeClass('show_my','current');
114 YUD.removeClass('show_pullrequests','current');
109 YUD.removeClass('show_pullrequests','current');
115
110
116 YUD.setStyle('my_container','display','none');
111 YUD.setStyle('my_container','display','none');
117 YUD.setStyle('pullrequests_container','display','none');
112 YUD.setStyle('pullrequests_container','display','none');
118 YUD.setStyle('perms_container','display','');
113 YUD.setStyle('perms_container','display','');
119 YUD.setStyle('q_filter','display','none');
114 YUD.setStyle('q_filter','display','none');
120 }
115 }
121 YUE.on('show_perms','click',function(e){
116 YUE.on('show_perms','click',function(e){
122 show_perms();
117 show_perms();
123 })
118 })
124
119
125 var show_my = function(e){
120 var show_my = function(e){
126 YUD.addClass('show_my', 'current');
121 YUD.addClass('show_my', 'current');
127 YUD.removeClass('show_perms','current');
122 YUD.removeClass('show_perms','current');
128 YUD.removeClass('show_pullrequests','current');
123 YUD.removeClass('show_pullrequests','current');
129
124
130 YUD.setStyle('perms_container','display','none');
125 YUD.setStyle('perms_container','display','none');
131 YUD.setStyle('pullrequests_container','display','none');
126 YUD.setStyle('pullrequests_container','display','none');
132 YUD.setStyle('my_container','display','');
127 YUD.setStyle('my_container','display','');
133 YUD.setStyle('q_filter','display','');
128 YUD.setStyle('q_filter','display','');
134 if(!YUD.hasClass('show_my', 'loaded')){
129 if(!YUD.hasClass('show_my', 'loaded')){
135 table_renderer(${c.data |n});
130 table_renderer(${c.data |n});
136 YUD.addClass('show_my', 'loaded');
131 YUD.addClass('show_my', 'loaded');
137 }
132 }
138 }
133 }
139 YUE.on('show_my','click',function(e){
134 YUE.on('show_my','click',function(e){
140 show_my(e);
135 show_my(e);
141 })
136 })
142
137
143 var show_pullrequests = function(e){
138 var show_pullrequests = function(e){
144 YUD.addClass('show_pullrequests', 'current');
139 YUD.addClass('show_pullrequests', 'current');
145 YUD.removeClass('show_my','current');
140 YUD.removeClass('show_my','current');
146 YUD.removeClass('show_perms','current');
141 YUD.removeClass('show_perms','current');
147
142
148 YUD.setStyle('my_container','display','none');
143 YUD.setStyle('my_container','display','none');
149 YUD.setStyle('perms_container','display','none');
144 YUD.setStyle('perms_container','display','none');
150 YUD.setStyle('pullrequests_container','display','');
145 YUD.setStyle('pullrequests_container','display','');
151 YUD.setStyle('q_filter','display','none');
146 YUD.setStyle('q_filter','display','none');
152
147
153 var url = "${h.url('admin_settings_my_pullrequests')}";
148 var url = "${h.url('admin_settings_my_pullrequests')}";
154 ypjax(url, 'pullrequests_container');
149 ypjax(url, 'pullrequests_container');
155 }
150 }
156 YUE.on('show_pullrequests','click',function(e){
151 YUE.on('show_pullrequests','click',function(e){
157 show_pullrequests(e)
152 show_pullrequests(e)
158 })
153 })
159
154
160 var tabs = {
155 var tabs = {
161 'perms': show_perms,
156 'perms': show_perms,
162 'my': show_my,
157 'my': show_my,
163 'pullrequests': show_pullrequests
158 'pullrequests': show_pullrequests
164 }
159 }
165 var url = location.href.split('#');
160 var url = location.href.split('#');
166 if (url[1]) {
161 if (url[1]) {
167 //We have a hash
162 //We have a hash
168 var tabHash = url[1];
163 var tabHash = url[1];
169 var func = tabs[tabHash]
164 var func = tabs[tabHash]
170 if (func){
165 if (func){
171 func();
166 func();
172 }
167 }
173 }
168 }
174
169
175 function table_renderer(data){
170 function table_renderer(data){
176 var myDataSource = new YAHOO.util.DataSource(data);
171 var myDataSource = new YAHOO.util.DataSource(data);
177 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
172 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
178
173
179 myDataSource.responseSchema = {
174 myDataSource.responseSchema = {
180 resultsList: "records",
175 resultsList: "records",
181 fields: [
176 fields: [
182 {key:"menu"},
177 {key:"menu"},
183 {key:"raw_name"},
178 {key:"raw_name"},
184 {key:"name"},
179 {key:"name"},
185 {key:"last_changeset"},
180 {key:"last_changeset"},
186 {key:"action"},
181 {key:"action"},
187 ]
182 ]
188 };
183 };
189 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
184 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
190 // This is the filter function
185 // This is the filter function
191 var data = res.results || [],
186 var data = res.results || [],
192 filtered = [],
187 filtered = [],
193 i,l;
188 i,l;
194
189
195 if (req) {
190 if (req) {
196 req = req.toLowerCase();
191 req = req.toLowerCase();
197 for (i = 0; i<data.length; i++) {
192 for (i = 0; i<data.length; i++) {
198 var pos = data[i].raw_name.toLowerCase().indexOf(req)
193 var pos = data[i].raw_name.toLowerCase().indexOf(req)
199 if (pos != -1) {
194 if (pos != -1) {
200 filtered.push(data[i]);
195 filtered.push(data[i]);
201 }
196 }
202 }
197 }
203 res.results = filtered;
198 res.results = filtered;
204 }
199 }
205 return res;
200 return res;
206 }
201 }
207
202
208 // main table sorting
203 // main table sorting
209 var myColumnDefs = [
204 var myColumnDefs = [
210 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
205 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
211 {key:"name",label:"${_('Name')}",sortable:true,
206 {key:"name",label:"${_('Name')}",sortable:true,
212 sortOptions: { sortFunction: nameSort }},
207 sortOptions: { sortFunction: nameSort }},
213 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
208 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
214 sortOptions: { sortFunction: revisionSort }},
209 sortOptions: { sortFunction: revisionSort }},
215 {key:"action",label:"${_('Action')}",sortable:false},
210 {key:"action",label:"${_('Action')}",sortable:false},
216 ];
211 ];
217
212
218 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
213 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
219 sortedBy:{key:"name",dir:"asc"},
214 sortedBy:{key:"name",dir:"asc"},
220 paginator: new YAHOO.widget.Paginator({
215 paginator: new YAHOO.widget.Paginator({
221 rowsPerPage: 50,
216 rowsPerPage: 50,
222 alwaysVisible: false,
217 alwaysVisible: false,
223 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
218 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
224 pageLinks: 5,
219 pageLinks: 5,
225 containerClass: 'pagination-wh',
220 containerClass: 'pagination-wh',
226 currentPageClass: 'pager_curpage',
221 currentPageClass: 'pager_curpage',
227 pageLinkClass: 'pager_link',
222 pageLinkClass: 'pager_link',
228 nextPageLinkLabel: '&gt;',
223 nextPageLinkLabel: '&gt;',
229 previousPageLinkLabel: '&lt;',
224 previousPageLinkLabel: '&lt;',
230 firstPageLinkLabel: '&lt;&lt;',
225 firstPageLinkLabel: '&lt;&lt;',
231 lastPageLinkLabel: '&gt;&gt;',
226 lastPageLinkLabel: '&gt;&gt;',
232 containers:['user-paginator']
227 containers:['user-paginator']
233 }),
228 }),
234
229
235 MSG_SORTASC:"${_('Click to sort ascending')}",
230 MSG_SORTASC:"${_('Click to sort ascending')}",
236 MSG_SORTDESC:"${_('Click to sort descending')}",
231 MSG_SORTDESC:"${_('Click to sort descending')}",
237 MSG_EMPTY:"${_('No records found.')}",
232 MSG_EMPTY:"${_('No records found.')}",
238 MSG_ERROR:"${_('Data error.')}",
233 MSG_ERROR:"${_('Data error.')}",
239 MSG_LOADING:"${_('Loading...')}",
234 MSG_LOADING:"${_('Loading...')}",
240 }
235 }
241 );
236 );
242 myDataTable.subscribe('postRenderEvent',function(oArgs) {
237 myDataTable.subscribe('postRenderEvent',function(oArgs) {
243 tooltip_activate();
238 tooltip_activate();
244 quick_repo_menu();
239 quick_repo_menu();
245 });
240 });
246
241
247 var filterTimeout = null;
242 var filterTimeout = null;
248
243
249 updateFilter = function() {
244 updateFilter = function() {
250 // Reset timeout
245 // Reset timeout
251 filterTimeout = null;
246 filterTimeout = null;
252
247
253 // Reset sort
248 // Reset sort
254 var state = myDataTable.getState();
249 var state = myDataTable.getState();
255 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
250 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
256
251
257 // Get filtered data
252 // Get filtered data
258 myDataSource.sendRequest(YUD.get('q_filter').value,{
253 myDataSource.sendRequest(YUD.get('q_filter').value,{
259 success : myDataTable.onDataReturnInitializeTable,
254 success : myDataTable.onDataReturnInitializeTable,
260 failure : myDataTable.onDataReturnInitializeTable,
255 failure : myDataTable.onDataReturnInitializeTable,
261 scope : myDataTable,
256 scope : myDataTable,
262 argument: state
257 argument: state
263 });
258 });
264
259
265 };
260 };
266 YUE.on('q_filter','click',function(){
261 YUE.on('q_filter','click',function(){
267 if(!YUD.hasClass('q_filter', 'loaded')){
262 if(!YUD.hasClass('q_filter', 'loaded')){
268 YUD.get('q_filter').value = '';
263 YUD.get('q_filter').value = '';
269 //TODO: load here full list later to do search within groups
264 //TODO: load here full list later to do search within groups
270 YUD.addClass('q_filter', 'loaded');
265 YUD.addClass('q_filter', 'loaded');
271 }
266 }
272 });
267 });
273
268
274 YUE.on('q_filter','keyup',function (e) {
269 YUE.on('q_filter','keyup',function (e) {
275 clearTimeout(filterTimeout);
270 clearTimeout(filterTimeout);
276 filterTimeout = setTimeout(updateFilter,600);
271 filterTimeout = setTimeout(updateFilter,600);
277 });
272 });
278 }
273 }
279 </script>
274 </script>
280 </%def>
275 </%def>
@@ -1,375 +1,370
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 ${_('Journal')} - ${c.rhodecode_name}
4 ${_('Journal')} - ${c.rhodecode_name}
5 </%def>
5 </%def>
6 <%def name="breadcrumbs()">
6 <%def name="breadcrumbs()">
7 <h5>
7 <h5>
8 <form id="filter_form">
8 <form id="filter_form">
9 <input class="q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term or _('quick filter...')}"/>
9 <input class="q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term or _('quick filter...')}"/>
10 <span class="tooltip" title="${h.tooltip(h.journal_filter_help())}">?</span>
10 <span class="tooltip" title="${h.tooltip(h.journal_filter_help())}">?</span>
11 <input type='submit' value="${_('filter')}" class="ui-btn" style="padding:0px 2px 0px 2px;margin:0px"/>
11 <input type='submit' value="${_('filter')}" class="ui-btn" style="padding:0px 2px 0px 2px;margin:0px"/>
12 ${_('journal')} - ${ungettext('%s entry', '%s entries', c.journal_pager.item_count) % (c.journal_pager.item_count)}
12 ${_('journal')} - ${ungettext('%s entry', '%s entries', c.journal_pager.item_count) % (c.journal_pager.item_count)}
13 </form>
13 </form>
14 ${h.end_form()}
14 ${h.end_form()}
15 </h5>
15 </h5>
16 </%def>
16 </%def>
17 <%def name="page_nav()">
17 <%def name="page_nav()">
18 ${self.menu('journal')}
18 ${self.menu('journal')}
19 </%def>
19 </%def>
20 <%def name="head_extra()">
20 <%def name="head_extra()">
21 <link href="${h.url('journal_atom', api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" />
21 <link href="${h.url('journal_atom', api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" />
22 <link href="${h.url('journal_rss', api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" />
22 <link href="${h.url('journal_rss', api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" />
23 </%def>
23 </%def>
24 <%def name="main()">
24 <%def name="main()">
25
25
26 <div class="box box-left">
26 <div class="box box-left">
27 <!-- box / title -->
27 <!-- box / title -->
28 <div class="title">
28 <div class="title">
29 ${self.breadcrumbs()}
29 ${self.breadcrumbs()}
30 <ul class="links">
30 <ul class="links">
31 <li>
31 <li>
32 <span><a id="refresh" href="${h.url('journal')}"><img class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/></a></span>
32 <span><a id="refresh" href="${h.url('journal')}"><img class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/></a></span>
33 </li>
33 </li>
34 <li>
34 <li>
35 <span><a href="${h.url('journal_rss', api_key=c.rhodecode_user.api_key)}"><img class="icon" title="${_('RSS feed')}" alt="${_('RSS feed')}" src="${h.url('/images/icons/rss_16.png')}"/></a></span>
35 <span><a href="${h.url('journal_rss', api_key=c.rhodecode_user.api_key)}"><img class="icon" title="${_('RSS feed')}" alt="${_('RSS feed')}" src="${h.url('/images/icons/rss_16.png')}"/></a></span>
36 </li>
36 </li>
37 <li>
37 <li>
38 <span><a href="${h.url('journal_atom', api_key=c.rhodecode_user.api_key)}"><img class="icon" title="${_('ATOM feed')}" alt="${_('ATOM feed')}" src="${h.url('/images/icons/atom.png')}"/></a></span>
38 <span><a href="${h.url('journal_atom', api_key=c.rhodecode_user.api_key)}"><img class="icon" title="${_('ATOM feed')}" alt="${_('ATOM feed')}" src="${h.url('/images/icons/atom.png')}"/></a></span>
39 </li>
39 </li>
40 </ul>
40 </ul>
41 </div>
41 </div>
42 <div id="journal">${c.journal_data}</div>
42 <div id="journal">${c.journal_data}</div>
43 </div>
43 </div>
44 <div class="box box-right">
44 <div class="box box-right">
45 <!-- box / title -->
45 <!-- box / title -->
46
46
47 <div class="title">
47 <div class="title">
48 <h5>
48 <h5>
49 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/>
49 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/>
50 <input class="q_filter_box" id="q_filter_watched" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/>
50 <input class="q_filter_box" id="q_filter_watched" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/>
51 </h5>
51 </h5>
52 <ul class="links" style="color:#DADADA">
52 <ul class="links" style="color:#DADADA">
53 <li>
53 <li>
54 <span><a id="show_watched" class="link-white current" href="#watched">${_('Watched')}</a> </span>
54 <span><a id="show_watched" class="link-white current" href="#watched">${_('Watched')}</a> </span>
55 </li>
55 </li>
56 <li>
56 <li>
57 <span><a id="show_my" class="link-white" href="#my">${_('My repos')}</a> </span>
57 <span><a id="show_my" class="link-white" href="#my">${_('My repos')}</a> </span>
58 </li>
58 </li>
59 %if h.HasPermissionAny('hg.admin','hg.create.repository')():
60 <li>
61 <span>${h.link_to(_('Add repo'),h.url('admin_settings_create_repository'))}</span>
62 </li>
63 %endif
64 </ul>
59 </ul>
65 </div>
60 </div>
66
61
67 <!-- end box / title -->
62 <!-- end box / title -->
68 <div id="my_container" style="display:none">
63 <div id="my_container" style="display:none">
69 <div class="table yui-skin-sam" id="repos_list_wrap"></div>
64 <div class="table yui-skin-sam" id="repos_list_wrap"></div>
70 <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div>
65 <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div>
71 </div>
66 </div>
72
67
73 <div id="watched_container">
68 <div id="watched_container">
74 <div class="table yui-skin-sam" id="watched_repos_list_wrap"></div>
69 <div class="table yui-skin-sam" id="watched_repos_list_wrap"></div>
75 <div id="watched-user-paginator" style="padding: 0px 0px 0px 20px"></div>
70 <div id="watched-user-paginator" style="padding: 0px 0px 0px 20px"></div>
76 </div>
71 </div>
77 </div>
72 </div>
78
73
79 <script type="text/javascript">
74 <script type="text/javascript">
80
75
81 YUE.on('j_filter','click',function(){
76 YUE.on('j_filter','click',function(){
82 var jfilter = YUD.get('j_filter');
77 var jfilter = YUD.get('j_filter');
83 if(YUD.hasClass(jfilter, 'initial')){
78 if(YUD.hasClass(jfilter, 'initial')){
84 jfilter.value = '';
79 jfilter.value = '';
85 }
80 }
86 });
81 });
87 var fix_j_filter_width = function(len){
82 var fix_j_filter_width = function(len){
88 YUD.setStyle(YUD.get('j_filter'),'width',Math.max(80, len*6.50)+'px');
83 YUD.setStyle(YUD.get('j_filter'),'width',Math.max(80, len*6.50)+'px');
89 }
84 }
90 YUE.on('j_filter','keyup',function(){
85 YUE.on('j_filter','keyup',function(){
91 fix_j_filter_width(YUD.get('j_filter').value.length);
86 fix_j_filter_width(YUD.get('j_filter').value.length);
92 });
87 });
93 YUE.on('filter_form','submit',function(e){
88 YUE.on('filter_form','submit',function(e){
94 YUE.preventDefault(e)
89 YUE.preventDefault(e)
95 var val = YUD.get('j_filter').value;
90 var val = YUD.get('j_filter').value;
96 window.location = "${url.current(filter='__FILTER__')}".replace('__FILTER__',val);
91 window.location = "${url.current(filter='__FILTER__')}".replace('__FILTER__',val);
97 });
92 });
98 fix_j_filter_width(YUD.get('j_filter').value.length);
93 fix_j_filter_width(YUD.get('j_filter').value.length);
99
94
100 YUE.on('refresh','click',function(e){
95 YUE.on('refresh','click',function(e){
101 ypjax("${h.url.current(filter=c.search_term)}","journal",function(){
96 ypjax("${h.url.current(filter=c.search_term)}","journal",function(){
102 show_more_event();
97 show_more_event();
103 tooltip_activate();
98 tooltip_activate();
104 show_changeset_tooltip();
99 show_changeset_tooltip();
105 });
100 });
106 YUE.preventDefault(e);
101 YUE.preventDefault(e);
107 });
102 });
108
103
109 var show_my = function(e){
104 var show_my = function(e){
110 YUD.setStyle('watched_container','display','none');
105 YUD.setStyle('watched_container','display','none');
111 YUD.setStyle('my_container','display','');
106 YUD.setStyle('my_container','display','');
112 YUD.setStyle('q_filter','display','');
107 YUD.setStyle('q_filter','display','');
113 YUD.setStyle('q_filter_watched','display','none');
108 YUD.setStyle('q_filter_watched','display','none');
114
109
115 YUD.addClass('show_my', 'current');
110 YUD.addClass('show_my', 'current');
116 YUD.removeClass('show_watched','current');
111 YUD.removeClass('show_watched','current');
117
112
118 if(!YUD.hasClass('show_my', 'loaded')){
113 if(!YUD.hasClass('show_my', 'loaded')){
119 table_renderer(${c.data |n});
114 table_renderer(${c.data |n});
120 YUD.addClass('show_my', 'loaded');
115 YUD.addClass('show_my', 'loaded');
121 }
116 }
122 }
117 }
123 YUE.on('show_my','click',function(e){
118 YUE.on('show_my','click',function(e){
124 show_my(e);
119 show_my(e);
125 })
120 })
126 var show_watched = function(e){
121 var show_watched = function(e){
127 YUD.setStyle('my_container','display','none');
122 YUD.setStyle('my_container','display','none');
128 YUD.setStyle('watched_container','display','');
123 YUD.setStyle('watched_container','display','');
129 YUD.setStyle('q_filter_watched','display','');
124 YUD.setStyle('q_filter_watched','display','');
130 YUD.setStyle('q_filter','display','none');
125 YUD.setStyle('q_filter','display','none');
131
126
132 YUD.addClass('show_watched', 'current');
127 YUD.addClass('show_watched', 'current');
133 YUD.removeClass('show_my','current');
128 YUD.removeClass('show_my','current');
134 if(!YUD.hasClass('show_watched', 'loaded')){
129 if(!YUD.hasClass('show_watched', 'loaded')){
135 watched_renderer(${c.watched_data |n});
130 watched_renderer(${c.watched_data |n});
136 YUD.addClass('show_watched', 'loaded');
131 YUD.addClass('show_watched', 'loaded');
137 }
132 }
138
133
139 return
134 return
140 var nodes = YUQ('#watched_container .watched_repo a');
135 var nodes = YUQ('#watched_container .watched_repo a');
141 var target = 'q_filter';
136 var target = 'q_filter';
142 var func = function(node){
137 var func = function(node){
143 return node.parentNode.parentNode;
138 return node.parentNode.parentNode;
144 }
139 }
145 q_filter(target,nodes,func);
140 q_filter(target,nodes,func);
146 }
141 }
147 YUE.on('show_watched','click',function(e){
142 YUE.on('show_watched','click',function(e){
148 show_watched(e);
143 show_watched(e);
149 })
144 })
150 //init watched
145 //init watched
151 show_watched();
146 show_watched();
152
147
153 var tabs = {
148 var tabs = {
154 'watched': show_watched,
149 'watched': show_watched,
155 'my': show_my,
150 'my': show_my,
156 }
151 }
157 var url = location.href.split('#');
152 var url = location.href.split('#');
158 if (url[1]) {
153 if (url[1]) {
159 //We have a hash
154 //We have a hash
160 var tabHash = url[1];
155 var tabHash = url[1];
161 var func = tabs[tabHash]
156 var func = tabs[tabHash]
162 if (func){
157 if (func){
163 func();
158 func();
164 }
159 }
165 }
160 }
166 function watched_renderer(data){
161 function watched_renderer(data){
167 var myDataSource = new YAHOO.util.DataSource(data);
162 var myDataSource = new YAHOO.util.DataSource(data);
168 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
163 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
169
164
170 myDataSource.responseSchema = {
165 myDataSource.responseSchema = {
171 resultsList: "records",
166 resultsList: "records",
172 fields: [
167 fields: [
173 {key:"menu"},
168 {key:"menu"},
174 {key:"raw_name"},
169 {key:"raw_name"},
175 {key:"name"},
170 {key:"name"},
176 {key:"last_changeset"},
171 {key:"last_changeset"},
177 {key:"action"},
172 {key:"action"},
178 ]
173 ]
179 };
174 };
180 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
175 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
181 // This is the filter function
176 // This is the filter function
182 var data = res.results || [],
177 var data = res.results || [],
183 filtered = [],
178 filtered = [],
184 i,l;
179 i,l;
185
180
186 if (req) {
181 if (req) {
187 req = req.toLowerCase();
182 req = req.toLowerCase();
188 for (i = 0; i<data.length; i++) {
183 for (i = 0; i<data.length; i++) {
189 var pos = data[i].raw_name.toLowerCase().indexOf(req)
184 var pos = data[i].raw_name.toLowerCase().indexOf(req)
190 if (pos != -1) {
185 if (pos != -1) {
191 filtered.push(data[i]);
186 filtered.push(data[i]);
192 }
187 }
193 }
188 }
194 res.results = filtered;
189 res.results = filtered;
195 }
190 }
196 return res;
191 return res;
197 }
192 }
198 // main table sorting
193 // main table sorting
199 var myColumnDefs = [
194 var myColumnDefs = [
200 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
195 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
201 {key:"name",label:"${_('Name')}",sortable:true,
196 {key:"name",label:"${_('Name')}",sortable:true,
202 sortOptions: { sortFunction: nameSort }},
197 sortOptions: { sortFunction: nameSort }},
203 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
198 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
204 sortOptions: { sortFunction: revisionSort }},
199 sortOptions: { sortFunction: revisionSort }},
205 {key:"action",label:"${_('Action')}",sortable:false},
200 {key:"action",label:"${_('Action')}",sortable:false},
206 ];
201 ];
207
202
208 var myDataTable = new YAHOO.widget.DataTable("watched_repos_list_wrap", myColumnDefs, myDataSource,{
203 var myDataTable = new YAHOO.widget.DataTable("watched_repos_list_wrap", myColumnDefs, myDataSource,{
209 sortedBy:{key:"name",dir:"asc"},
204 sortedBy:{key:"name",dir:"asc"},
210 paginator: new YAHOO.widget.Paginator({
205 paginator: new YAHOO.widget.Paginator({
211 rowsPerPage: 25,
206 rowsPerPage: 25,
212 alwaysVisible: false,
207 alwaysVisible: false,
213 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
208 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
214 pageLinks: 5,
209 pageLinks: 5,
215 containerClass: 'pagination-wh',
210 containerClass: 'pagination-wh',
216 currentPageClass: 'pager_curpage',
211 currentPageClass: 'pager_curpage',
217 pageLinkClass: 'pager_link',
212 pageLinkClass: 'pager_link',
218 nextPageLinkLabel: '&gt;',
213 nextPageLinkLabel: '&gt;',
219 previousPageLinkLabel: '&lt;',
214 previousPageLinkLabel: '&lt;',
220 firstPageLinkLabel: '&lt;&lt;',
215 firstPageLinkLabel: '&lt;&lt;',
221 lastPageLinkLabel: '&gt;&gt;',
216 lastPageLinkLabel: '&gt;&gt;',
222 containers:['watched-user-paginator']
217 containers:['watched-user-paginator']
223 }),
218 }),
224
219
225 MSG_SORTASC:"${_('Click to sort ascending')}",
220 MSG_SORTASC:"${_('Click to sort ascending')}",
226 MSG_SORTDESC:"${_('Click to sort descending')}",
221 MSG_SORTDESC:"${_('Click to sort descending')}",
227 MSG_EMPTY:"${_('No records found.')}",
222 MSG_EMPTY:"${_('No records found.')}",
228 MSG_ERROR:"${_('Data error.')}",
223 MSG_ERROR:"${_('Data error.')}",
229 MSG_LOADING:"${_('Loading...')}",
224 MSG_LOADING:"${_('Loading...')}",
230 }
225 }
231 );
226 );
232 myDataTable.subscribe('postRenderEvent',function(oArgs) {
227 myDataTable.subscribe('postRenderEvent',function(oArgs) {
233 tooltip_activate();
228 tooltip_activate();
234 quick_repo_menu();
229 quick_repo_menu();
235 });
230 });
236
231
237 var filterTimeout = null;
232 var filterTimeout = null;
238
233
239 updateFilter = function () {
234 updateFilter = function () {
240 // Reset timeout
235 // Reset timeout
241 filterTimeout = null;
236 filterTimeout = null;
242
237
243 // Reset sort
238 // Reset sort
244 var state = myDataTable.getState();
239 var state = myDataTable.getState();
245 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
240 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
246
241
247 // Get filtered data
242 // Get filtered data
248 myDataSource.sendRequest(YUD.get('q_filter_watched').value,{
243 myDataSource.sendRequest(YUD.get('q_filter_watched').value,{
249 success : myDataTable.onDataReturnInitializeTable,
244 success : myDataTable.onDataReturnInitializeTable,
250 failure : myDataTable.onDataReturnInitializeTable,
245 failure : myDataTable.onDataReturnInitializeTable,
251 scope : myDataTable,
246 scope : myDataTable,
252 argument: state
247 argument: state
253 });
248 });
254
249
255 };
250 };
256 YUE.on('q_filter_watched','click',function(){
251 YUE.on('q_filter_watched','click',function(){
257 if(!YUD.hasClass('q_filter_watched', 'loaded')){
252 if(!YUD.hasClass('q_filter_watched', 'loaded')){
258 YUD.get('q_filter_watched').value = '';
253 YUD.get('q_filter_watched').value = '';
259 //TODO: load here full list later to do search within groups
254 //TODO: load here full list later to do search within groups
260 YUD.addClass('q_filter_watched', 'loaded');
255 YUD.addClass('q_filter_watched', 'loaded');
261 }
256 }
262 });
257 });
263
258
264 YUE.on('q_filter_watched','keyup',function (e) {
259 YUE.on('q_filter_watched','keyup',function (e) {
265 clearTimeout(filterTimeout);
260 clearTimeout(filterTimeout);
266 filterTimeout = setTimeout(updateFilter,600);
261 filterTimeout = setTimeout(updateFilter,600);
267 });
262 });
268 }
263 }
269
264
270 function table_renderer(data){
265 function table_renderer(data){
271 var myDataSource = new YAHOO.util.DataSource(data);
266 var myDataSource = new YAHOO.util.DataSource(data);
272 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
267 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
273
268
274 myDataSource.responseSchema = {
269 myDataSource.responseSchema = {
275 resultsList: "records",
270 resultsList: "records",
276 fields: [
271 fields: [
277 {key:"menu"},
272 {key:"menu"},
278 {key:"raw_name"},
273 {key:"raw_name"},
279 {key:"name"},
274 {key:"name"},
280 {key:"last_changeset"},
275 {key:"last_changeset"},
281 {key:"action"},
276 {key:"action"},
282 ]
277 ]
283 };
278 };
284 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
279 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
285 // This is the filter function
280 // This is the filter function
286 var data = res.results || [],
281 var data = res.results || [],
287 filtered = [],
282 filtered = [],
288 i,l;
283 i,l;
289
284
290 if (req) {
285 if (req) {
291 req = req.toLowerCase();
286 req = req.toLowerCase();
292 for (i = 0; i<data.length; i++) {
287 for (i = 0; i<data.length; i++) {
293 var pos = data[i].raw_name.toLowerCase().indexOf(req)
288 var pos = data[i].raw_name.toLowerCase().indexOf(req)
294 if (pos != -1) {
289 if (pos != -1) {
295 filtered.push(data[i]);
290 filtered.push(data[i]);
296 }
291 }
297 }
292 }
298 res.results = filtered;
293 res.results = filtered;
299 }
294 }
300 return res;
295 return res;
301 }
296 }
302 // main table sorting
297 // main table sorting
303 var myColumnDefs = [
298 var myColumnDefs = [
304 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
299 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
305 {key:"name",label:"${_('Name')}",sortable:true,
300 {key:"name",label:"${_('Name')}",sortable:true,
306 sortOptions: { sortFunction: nameSort }},
301 sortOptions: { sortFunction: nameSort }},
307 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
302 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
308 sortOptions: { sortFunction: revisionSort }},
303 sortOptions: { sortFunction: revisionSort }},
309 {key:"action",label:"${_('Action')}",sortable:false},
304 {key:"action",label:"${_('Action')}",sortable:false},
310 ];
305 ];
311
306
312 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
307 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
313 sortedBy:{key:"name",dir:"asc"},
308 sortedBy:{key:"name",dir:"asc"},
314 paginator: new YAHOO.widget.Paginator({
309 paginator: new YAHOO.widget.Paginator({
315 rowsPerPage: 25,
310 rowsPerPage: 25,
316 alwaysVisible: false,
311 alwaysVisible: false,
317 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
312 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
318 pageLinks: 5,
313 pageLinks: 5,
319 containerClass: 'pagination-wh',
314 containerClass: 'pagination-wh',
320 currentPageClass: 'pager_curpage',
315 currentPageClass: 'pager_curpage',
321 pageLinkClass: 'pager_link',
316 pageLinkClass: 'pager_link',
322 nextPageLinkLabel: '&gt;',
317 nextPageLinkLabel: '&gt;',
323 previousPageLinkLabel: '&lt;',
318 previousPageLinkLabel: '&lt;',
324 firstPageLinkLabel: '&lt;&lt;',
319 firstPageLinkLabel: '&lt;&lt;',
325 lastPageLinkLabel: '&gt;&gt;',
320 lastPageLinkLabel: '&gt;&gt;',
326 containers:['user-paginator']
321 containers:['user-paginator']
327 }),
322 }),
328
323
329 MSG_SORTASC:"${_('Click to sort ascending')}",
324 MSG_SORTASC:"${_('Click to sort ascending')}",
330 MSG_SORTDESC:"${_('Click to sort descending')}",
325 MSG_SORTDESC:"${_('Click to sort descending')}",
331 MSG_EMPTY:"${_('No records found.')}",
326 MSG_EMPTY:"${_('No records found.')}",
332 MSG_ERROR:"${_('Data error.')}",
327 MSG_ERROR:"${_('Data error.')}",
333 MSG_LOADING:"${_('Loading...')}",
328 MSG_LOADING:"${_('Loading...')}",
334 }
329 }
335 );
330 );
336 myDataTable.subscribe('postRenderEvent',function(oArgs) {
331 myDataTable.subscribe('postRenderEvent',function(oArgs) {
337 tooltip_activate();
332 tooltip_activate();
338 quick_repo_menu();
333 quick_repo_menu();
339 });
334 });
340
335
341 var filterTimeout = null;
336 var filterTimeout = null;
342
337
343 updateFilter = function () {
338 updateFilter = function () {
344 // Reset timeout
339 // Reset timeout
345 filterTimeout = null;
340 filterTimeout = null;
346
341
347 // Reset sort
342 // Reset sort
348 var state = myDataTable.getState();
343 var state = myDataTable.getState();
349 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
344 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
350
345
351 // Get filtered data
346 // Get filtered data
352 myDataSource.sendRequest(YUD.get('q_filter').value,{
347 myDataSource.sendRequest(YUD.get('q_filter').value,{
353 success : myDataTable.onDataReturnInitializeTable,
348 success : myDataTable.onDataReturnInitializeTable,
354 failure : myDataTable.onDataReturnInitializeTable,
349 failure : myDataTable.onDataReturnInitializeTable,
355 scope : myDataTable,
350 scope : myDataTable,
356 argument: state
351 argument: state
357 });
352 });
358
353
359 };
354 };
360 YUE.on('q_filter','click',function(){
355 YUE.on('q_filter','click',function(){
361 if(!YUD.hasClass('q_filter', 'loaded')){
356 if(!YUD.hasClass('q_filter', 'loaded')){
362 YUD.get('q_filter').value = '';
357 YUD.get('q_filter').value = '';
363 //TODO: load here full list later to do search within groups
358 //TODO: load here full list later to do search within groups
364 YUD.addClass('q_filter', 'loaded');
359 YUD.addClass('q_filter', 'loaded');
365 }
360 }
366 });
361 });
367
362
368 YUE.on('q_filter','keyup',function (e) {
363 YUE.on('q_filter','keyup',function (e) {
369 clearTimeout(filterTimeout);
364 clearTimeout(filterTimeout);
370 filterTimeout = setTimeout(updateFilter,600);
365 filterTimeout = setTimeout(updateFilter,600);
371 });
366 });
372 }
367 }
373
368
374 </script>
369 </script>
375 </%def>
370 </%def>
General Comments 0
You need to be logged in to leave comments. Login now