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