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