##// END OF EJS Templates
fixed my account page tabs
marcink -
r3678:a0a692cb beta
parent child Browse files
Show More
@@ -1,239 +1,241 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 ${_('My account')} ${c.rhodecode_user.username} &middot; ${c.rhodecode_name}
5 ${_('My account')} ${c.rhodecode_user.username} &middot; ${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" placeholder="${_('quick filter...')}" value="" style="display: none"/>
31 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value="" 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 </ul>
43 </ul>
44 </div>
44 </div>
45 <!-- end box / title -->
45 <!-- end box / title -->
46 ## permissions overview
46 ## permissions overview
47 <div id="perms_container">
47 <%namespace name="p" file="/base/perms_summary.html"/>
48 <%namespace name="p" file="/base/perms_summary.html"/>
48 ${p.perms_summary(c.perm_user.permissions)}
49 ${p.perms_summary(c.perm_user.permissions)}
50 </div>
49
51
50 <div id="my_container" style="display:none">
52 <div id="my_container" style="display:none">
51 <div class="table yui-skin-sam" id="repos_list_wrap"></div>
53 <div class="table yui-skin-sam" id="repos_list_wrap"></div>
52 <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div>
54 <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div>
53 </div>
55 </div>
54 <div id="pullrequests_container" class="table" style="display:none">
56 <div id="pullrequests_container" class="table" style="display:none">
55 ## loaded via AJAX
57 ## loaded via AJAX
56 ${_('Loading...')}
58 ${_('Loading...')}
57 </div>
59 </div>
58 </div>
60 </div>
59
61
60 <script type="text/javascript">
62 <script type="text/javascript">
61 pyroutes.register('admin_settings_my_pullrequests', "${url('admin_settings_my_pullrequests')}", []);
63 pyroutes.register('admin_settings_my_pullrequests', "${url('admin_settings_my_pullrequests')}", []);
62
64
63 var show_perms = function(e){
65 var show_perms = function(e){
64 YUD.addClass('show_perms', 'current');
66 YUD.addClass('show_perms', 'current');
65 YUD.removeClass('show_my','current');
67 YUD.removeClass('show_my','current');
66 YUD.removeClass('show_pullrequests','current');
68 YUD.removeClass('show_pullrequests','current');
67
69
68 YUD.setStyle('my_container','display','none');
70 YUD.setStyle('my_container','display','none');
69 YUD.setStyle('pullrequests_container','display','none');
71 YUD.setStyle('pullrequests_container','display','none');
70 YUD.setStyle('perms_container','display','');
72 YUD.setStyle('perms_container','display','');
71 YUD.setStyle('q_filter','display','none');
73 YUD.setStyle('q_filter','display','none');
72 }
74 }
73 YUE.on('show_perms','click',function(e){
75 YUE.on('show_perms','click',function(e){
74 show_perms();
76 show_perms();
75 })
77 })
76
78
77 var show_my = function(e){
79 var show_my = function(e){
78 YUD.addClass('show_my', 'current');
80 YUD.addClass('show_my', 'current');
79 YUD.removeClass('show_perms','current');
81 YUD.removeClass('show_perms','current');
80 YUD.removeClass('show_pullrequests','current');
82 YUD.removeClass('show_pullrequests','current');
81
83
82 YUD.setStyle('perms_container','display','none');
84 YUD.setStyle('perms_container','display','none');
83 YUD.setStyle('pullrequests_container','display','none');
85 YUD.setStyle('pullrequests_container','display','none');
84 YUD.setStyle('my_container','display','');
86 YUD.setStyle('my_container','display','');
85 YUD.setStyle('q_filter','display','');
87 YUD.setStyle('q_filter','display','');
86 if(!YUD.hasClass('show_my', 'loaded')){
88 if(!YUD.hasClass('show_my', 'loaded')){
87 table_renderer(${c.data |n});
89 table_renderer(${c.data |n});
88 YUD.addClass('show_my', 'loaded');
90 YUD.addClass('show_my', 'loaded');
89 }
91 }
90 }
92 }
91 YUE.on('show_my','click',function(e){
93 YUE.on('show_my','click',function(e){
92 show_my(e);
94 show_my(e);
93 })
95 })
94
96
95 var show_pullrequests = function(e){
97 var show_pullrequests = function(e){
96 YUD.addClass('show_pullrequests', 'current');
98 YUD.addClass('show_pullrequests', 'current');
97 YUD.removeClass('show_my','current');
99 YUD.removeClass('show_my','current');
98 YUD.removeClass('show_perms','current');
100 YUD.removeClass('show_perms','current');
99
101
100 YUD.setStyle('my_container','display','none');
102 YUD.setStyle('my_container','display','none');
101 YUD.setStyle('perms_container','display','none');
103 YUD.setStyle('perms_container','display','none');
102 YUD.setStyle('pullrequests_container','display','');
104 YUD.setStyle('pullrequests_container','display','');
103 YUD.setStyle('q_filter','display','none');
105 YUD.setStyle('q_filter','display','none');
104
106
105 var url = pyroutes.url('admin_settings_my_pullrequests');
107 var url = pyroutes.url('admin_settings_my_pullrequests');
106 if(YUD.get('show_closed') && YUD.get('show_closed').checked) {
108 if(YUD.get('show_closed') && YUD.get('show_closed').checked) {
107 var url = pyroutes.url('admin_settings_my_pullrequests', {'pr_show_closed': '1'});
109 var url = pyroutes.url('admin_settings_my_pullrequests', {'pr_show_closed': '1'});
108 }
110 }
109 ypjax(url, 'pullrequests_container', function(){
111 ypjax(url, 'pullrequests_container', function(){
110 YUE.on('show_closed','change',function (e) {
112 YUE.on('show_closed','change',function (e) {
111 show_pullrequests(e);
113 show_pullrequests(e);
112 });
114 });
113 });
115 });
114 }
116 }
115 YUE.on('show_pullrequests','click',function(e){
117 YUE.on('show_pullrequests','click',function(e){
116 show_pullrequests(e)
118 show_pullrequests(e)
117 })
119 })
118
120
119 var tabs = {
121 var tabs = {
120 'perms': show_perms,
122 'perms': show_perms,
121 'my': show_my,
123 'my': show_my,
122 'pullrequests': show_pullrequests
124 'pullrequests': show_pullrequests
123 }
125 }
124 var url = location.href.split('#');
126 var url = location.href.split('#');
125 if (url[1]) {
127 if (url[1]) {
126 //We have a hash
128 //We have a hash
127 var tabHash = url[1];
129 var tabHash = url[1];
128 var func = tabs[tabHash]
130 var func = tabs[tabHash]
129 if (func){
131 if (func){
130 func();
132 func();
131 }
133 }
132 }
134 }
133
135
134 function table_renderer(data){
136 function table_renderer(data){
135 var myDataSource = new YAHOO.util.DataSource(data);
137 var myDataSource = new YAHOO.util.DataSource(data);
136 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
138 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
137
139
138 myDataSource.responseSchema = {
140 myDataSource.responseSchema = {
139 resultsList: "records",
141 resultsList: "records",
140 fields: [
142 fields: [
141 {key:"menu"},
143 {key:"menu"},
142 {key:"raw_name"},
144 {key:"raw_name"},
143 {key:"name"},
145 {key:"name"},
144 {key:"last_changeset"},
146 {key:"last_changeset"},
145 {key:"action"},
147 {key:"action"},
146 ]
148 ]
147 };
149 };
148 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
150 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
149 // This is the filter function
151 // This is the filter function
150 var data = res.results || [],
152 var data = res.results || [],
151 filtered = [],
153 filtered = [],
152 i,l;
154 i,l;
153
155
154 if (req) {
156 if (req) {
155 req = req.toLowerCase();
157 req = req.toLowerCase();
156 for (i = 0; i<data.length; i++) {
158 for (i = 0; i<data.length; i++) {
157 var pos = data[i].raw_name.toLowerCase().indexOf(req)
159 var pos = data[i].raw_name.toLowerCase().indexOf(req)
158 if (pos != -1) {
160 if (pos != -1) {
159 filtered.push(data[i]);
161 filtered.push(data[i]);
160 }
162 }
161 }
163 }
162 res.results = filtered;
164 res.results = filtered;
163 }
165 }
164 return res;
166 return res;
165 }
167 }
166
168
167 // main table sorting
169 // main table sorting
168 var myColumnDefs = [
170 var myColumnDefs = [
169 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
171 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
170 {key:"name",label:"${_('Name')}",sortable:true,
172 {key:"name",label:"${_('Name')}",sortable:true,
171 sortOptions: { sortFunction: nameSort }},
173 sortOptions: { sortFunction: nameSort }},
172 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
174 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
173 sortOptions: { sortFunction: revisionSort }},
175 sortOptions: { sortFunction: revisionSort }},
174 {key:"action",label:"${_('Action')}",sortable:false},
176 {key:"action",label:"${_('Action')}",sortable:false},
175 ];
177 ];
176
178
177 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
179 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
178 sortedBy:{key:"name",dir:"asc"},
180 sortedBy:{key:"name",dir:"asc"},
179 paginator: new YAHOO.widget.Paginator({
181 paginator: new YAHOO.widget.Paginator({
180 rowsPerPage: 50,
182 rowsPerPage: 50,
181 alwaysVisible: false,
183 alwaysVisible: false,
182 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
184 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
183 pageLinks: 5,
185 pageLinks: 5,
184 containerClass: 'pagination-wh',
186 containerClass: 'pagination-wh',
185 currentPageClass: 'pager_curpage',
187 currentPageClass: 'pager_curpage',
186 pageLinkClass: 'pager_link',
188 pageLinkClass: 'pager_link',
187 nextPageLinkLabel: '&gt;',
189 nextPageLinkLabel: '&gt;',
188 previousPageLinkLabel: '&lt;',
190 previousPageLinkLabel: '&lt;',
189 firstPageLinkLabel: '&lt;&lt;',
191 firstPageLinkLabel: '&lt;&lt;',
190 lastPageLinkLabel: '&gt;&gt;',
192 lastPageLinkLabel: '&gt;&gt;',
191 containers:['user-paginator']
193 containers:['user-paginator']
192 }),
194 }),
193
195
194 MSG_SORTASC:"${_('Click to sort ascending')}",
196 MSG_SORTASC:"${_('Click to sort ascending')}",
195 MSG_SORTDESC:"${_('Click to sort descending')}",
197 MSG_SORTDESC:"${_('Click to sort descending')}",
196 MSG_EMPTY:"${_('No records found.')}",
198 MSG_EMPTY:"${_('No records found.')}",
197 MSG_ERROR:"${_('Data error.')}",
199 MSG_ERROR:"${_('Data error.')}",
198 MSG_LOADING:"${_('Loading...')}",
200 MSG_LOADING:"${_('Loading...')}",
199 }
201 }
200 );
202 );
201 myDataTable.subscribe('postRenderEvent',function(oArgs) {
203 myDataTable.subscribe('postRenderEvent',function(oArgs) {
202 tooltip_activate();
204 tooltip_activate();
203 quick_repo_menu();
205 quick_repo_menu();
204 });
206 });
205
207
206 var filterTimeout = null;
208 var filterTimeout = null;
207
209
208 updateFilter = function() {
210 updateFilter = function() {
209 // Reset timeout
211 // Reset timeout
210 filterTimeout = null;
212 filterTimeout = null;
211
213
212 // Reset sort
214 // Reset sort
213 var state = myDataTable.getState();
215 var state = myDataTable.getState();
214 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
216 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
215
217
216 // Get filtered data
218 // Get filtered data
217 myDataSource.sendRequest(YUD.get('q_filter').value,{
219 myDataSource.sendRequest(YUD.get('q_filter').value,{
218 success : myDataTable.onDataReturnInitializeTable,
220 success : myDataTable.onDataReturnInitializeTable,
219 failure : myDataTable.onDataReturnInitializeTable,
221 failure : myDataTable.onDataReturnInitializeTable,
220 scope : myDataTable,
222 scope : myDataTable,
221 argument: state
223 argument: state
222 });
224 });
223
225
224 };
226 };
225 YUE.on('q_filter','click',function(){
227 YUE.on('q_filter','click',function(){
226 if(!YUD.hasClass('q_filter', 'loaded')){
228 if(!YUD.hasClass('q_filter', 'loaded')){
227 //TODO: load here full list later to do search within groups
229 //TODO: load here full list later to do search within groups
228 YUD.addClass('q_filter', 'loaded');
230 YUD.addClass('q_filter', 'loaded');
229 }
231 }
230 });
232 });
231
233
232 YUE.on('q_filter','keyup',function (e) {
234 YUE.on('q_filter','keyup',function (e) {
233 clearTimeout(filterTimeout);
235 clearTimeout(filterTimeout);
234 filterTimeout = setTimeout(updateFilter,600);
236 filterTimeout = setTimeout(updateFilter,600);
235 });
237 });
236
238
237 }
239 }
238 </script>
240 </script>
239 </%def>
241 </%def>
General Comments 0
You need to be logged in to leave comments. Login now