user_edit_my_account.html
232 lines
| 7.0 KiB
| text/html
|
HtmlLexer
r547 | ## -*- coding: utf-8 -*- | |||
<%inherit file="/base/base.html"/> | ||||
<%def name="title()"> | ||||
r3582 | ${_('My account')} ${c.rhodecode_user.username} · ${c.rhodecode_name} | |||
r547 | </%def> | |||
<%def name="breadcrumbs_links()"> | ||||
${_('My Account')} | ||||
</%def> | ||||
<%def name="page_nav()"> | ||||
Mads Kiilerich
|
r3197 | ${self.menu('admin')} | ||
r547 | </%def> | |||
<%def name="main()"> | ||||
<div class="box box-left"> | ||||
<!-- box / title --> | ||||
<div class="title"> | ||||
r1888 | ${self.breadcrumbs()} | |||
r547 | </div> | |||
<!-- end box / title --> | ||||
r2353 | ${c.form|n} | |||
r1888 | </div> | |||
r547 | ||||
<div class="box box-right"> | ||||
<!-- box / title --> | ||||
<div class="title"> | ||||
r1888 | <h5> | |||
r3665 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value="" style="display: none"/> | |||
r766 | </h5> | |||
r2624 | <ul class="links" style="color:#DADADA"> | |||
<li> | ||||
<span><a id="show_perms" class="link-white current" href="#perms">${_('My permissions')}</a> </span> | ||||
</li> | ||||
<li> | ||||
<span><a id="show_my" class="link-white" href="#my">${_('My repos')}</a> </span> | ||||
</li> | ||||
r766 | <li> | |||
r2886 | <span><a id="show_pullrequests" class="link-white" href="#pullrequests">${_('My pull requests')}</a> </span> | |||
r1888 | </li> | |||
</ul> | ||||
r547 | </div> | |||
<!-- end box / title --> | ||||
r3666 | ## permissions overview | |||
r3678 | <div id="perms_container"> | |||
r3666 | <%namespace name="p" file="/base/perms_summary.html"/> | |||
${p.perms_summary(c.perm_user.permissions)} | ||||
r3678 | </div> | |||
r2129 | ||||
r3154 | <div id="my_container" style="display:none"> | |||
<div class="table yui-skin-sam" id="repos_list_wrap"></div> | ||||
<div id="user-paginator" style="padding: 0px 0px 0px 20px"></div> | ||||
r2673 | </div> | |||
r3154 | <div id="pullrequests_container" class="table" style="display:none"> | |||
## loaded via AJAX | ||||
r3168 | ${_('Loading...')} | |||
r3154 | </div> | |||
r547 | </div> | |||
r2722 | ||||
r1653 | <script type="text/javascript"> | |||
r3404 | pyroutes.register('admin_settings_my_pullrequests', "${url('admin_settings_my_pullrequests')}", []); | |||
r2886 | ||||
var show_perms = function(e){ | ||||
YUD.addClass('show_perms', 'current'); | ||||
YUD.removeClass('show_my','current'); | ||||
YUD.removeClass('show_pullrequests','current'); | ||||
r2673 | ||||
r3154 | YUD.setStyle('my_container','display','none'); | |||
YUD.setStyle('pullrequests_container','display','none'); | ||||
YUD.setStyle('perms_container','display',''); | ||||
r2907 | YUD.setStyle('q_filter','display','none'); | |||
r2886 | } | |||
YUE.on('show_perms','click',function(e){ | ||||
show_perms(); | ||||
r2127 | }) | |||
r2886 | ||||
var show_my = function(e){ | ||||
r2624 | YUD.addClass('show_my', 'current'); | |||
YUD.removeClass('show_perms','current'); | ||||
YUD.removeClass('show_pullrequests','current'); | ||||
r2673 | ||||
r3154 | YUD.setStyle('perms_container','display','none'); | |||
YUD.setStyle('pullrequests_container','display','none'); | ||||
YUD.setStyle('my_container','display',''); | ||||
r2624 | YUD.setStyle('q_filter','display',''); | |||
r3154 | if(!YUD.hasClass('show_my', 'loaded')){ | |||
Mads Kiilerich
|
r3197 | table_renderer(${c.data |n}); | ||
r3154 | YUD.addClass('show_my', 'loaded'); | |||
} | ||||
r2886 | } | |||
YUE.on('show_my','click',function(e){ | ||||
Mads Kiilerich
|
r3197 | show_my(e); | ||
r2624 | }) | |||
r2886 | ||||
var show_pullrequests = function(e){ | ||||
r2624 | YUD.addClass('show_pullrequests', 'current'); | |||
YUD.removeClass('show_my','current'); | ||||
YUD.removeClass('show_perms','current'); | ||||
r3154 | YUD.setStyle('my_container','display','none'); | |||
YUD.setStyle('perms_container','display','none'); | ||||
YUD.setStyle('pullrequests_container','display',''); | ||||
r2624 | YUD.setStyle('q_filter','display','none'); | |||
r2907 | ||||
r3404 | var url = pyroutes.url('admin_settings_my_pullrequests'); | |||
if(YUD.get('show_closed') && YUD.get('show_closed').checked) { | ||||
r3449 | var url = pyroutes.url('admin_settings_my_pullrequests', {'pr_show_closed': '1'}); | |||
r3404 | } | |||
ypjax(url, 'pullrequests_container', function(){ | ||||
YUE.on('show_closed','change',function (e) { | ||||
show_pullrequests(e); | ||||
r3413 | }); | |||
r3404 | }); | |||
r2886 | } | |||
YUE.on('show_pullrequests','click',function(e){ | ||||
Mads Kiilerich
|
r3197 | show_pullrequests(e) | ||
r2127 | }) | |||
r2886 | var tabs = { | |||
'perms': show_perms, | ||||
'my': show_my, | ||||
'pullrequests': show_pullrequests | ||||
} | ||||
r2907 | var url = location.href.split('#'); | |||
if (url[1]) { | ||||
//We have a hash | ||||
r2886 | var tabHash = url[1]; | |||
r3120 | var func = tabs[tabHash] | |||
if (func){ | ||||
func(); | ||||
} | ||||
r2886 | } | |||
r3154 | function table_renderer(data){ | |||
Mads Kiilerich
|
r3198 | var myDataSource = new YAHOO.util.DataSource(data); | ||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; | ||||
r3154 | ||||
Mads Kiilerich
|
r3198 | myDataSource.responseSchema = { | ||
resultsList: "records", | ||||
fields: [ | ||||
{key:"menu"}, | ||||
{key:"raw_name"}, | ||||
{key:"name"}, | ||||
{key:"last_changeset"}, | ||||
{key:"action"}, | ||||
] | ||||
}; | ||||
myDataSource.doBeforeCallback = function(req,raw,res,cb) { | ||||
// This is the filter function | ||||
var data = res.results || [], | ||||
filtered = [], | ||||
i,l; | ||||
r3154 | ||||
Mads Kiilerich
|
r3198 | if (req) { | ||
req = req.toLowerCase(); | ||||
for (i = 0; i<data.length; i++) { | ||||
var pos = data[i].raw_name.toLowerCase().indexOf(req) | ||||
if (pos != -1) { | ||||
filtered.push(data[i]); | ||||
} | ||||
} | ||||
res.results = filtered; | ||||
} | ||||
return res; | ||||
} | ||||
r3168 | ||||
Mads Kiilerich
|
r3197 | // main table sorting | ||
var myColumnDefs = [ | ||||
{key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, | ||||
{key:"name",label:"${_('Name')}",sortable:true, | ||||
sortOptions: { sortFunction: nameSort }}, | ||||
{key:"last_changeset",label:"${_('Tip')}",sortable:true, | ||||
sortOptions: { sortFunction: revisionSort }}, | ||||
{key:"action",label:"${_('Action')}",sortable:false}, | ||||
]; | ||||
r2127 | ||||
Mads Kiilerich
|
r3197 | var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{ | ||
sortedBy:{key:"name",dir:"asc"}, | ||||
r3776 | paginator: YUI_paginator(50, ['user-paginator']), | |||
r3154 | ||||
Mads Kiilerich
|
r3197 | MSG_SORTASC:"${_('Click to sort ascending')}", | ||
MSG_SORTDESC:"${_('Click to sort descending')}", | ||||
MSG_EMPTY:"${_('No records found.')}", | ||||
MSG_ERROR:"${_('Data error.')}", | ||||
MSG_LOADING:"${_('Loading...')}", | ||||
} | ||||
); | ||||
myDataTable.subscribe('postRenderEvent',function(oArgs) { | ||||
tooltip_activate(); | ||||
quick_repo_menu(); | ||||
}); | ||||
r3154 | ||||
Mads Kiilerich
|
r3197 | var filterTimeout = null; | ||
r2127 | ||||
Mads Kiilerich
|
r3197 | updateFilter = function() { | ||
// Reset timeout | ||||
filterTimeout = null; | ||||
r2127 | ||||
Mads Kiilerich
|
r3197 | // Reset sort | ||
var state = myDataTable.getState(); | ||||
state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC}; | ||||
r2127 | ||||
Mads Kiilerich
|
r3197 | // Get filtered data | ||
myDataSource.sendRequest(YUD.get('q_filter').value,{ | ||||
success : myDataTable.onDataReturnInitializeTable, | ||||
failure : myDataTable.onDataReturnInitializeTable, | ||||
scope : myDataTable, | ||||
argument: state | ||||
}); | ||||
r2127 | ||||
Mads Kiilerich
|
r3197 | }; | ||
YUE.on('q_filter','click',function(){ | ||||
if(!YUD.hasClass('q_filter', 'loaded')){ | ||||
//TODO: load here full list later to do search within groups | ||||
YUD.addClass('q_filter', 'loaded'); | ||||
} | ||||
}); | ||||
r2127 | ||||
Mads Kiilerich
|
r3197 | YUE.on('q_filter','keyup',function (e) { | ||
clearTimeout(filterTimeout); | ||||
filterTimeout = setTimeout(updateFilter,600); | ||||
}); | ||||
r3404 | ||||
Mads Kiilerich
|
r4000 | if(YUD.get('q_filter').value) { | ||
updateFilter(); | ||||
} | ||||
Mads Kiilerich
|
r3197 | } | ||
r1653 | </script> | |||
r1888 | </%def> | |||