user_edit_my_account.html
246 lines
| 7.4 KiB
| text/html
|
HtmlLexer
r547 | ## -*- coding: utf-8 -*- | |||
<%inherit file="/base/base.html"/> | ||||
<%def name="title()"> | ||||
r619 | ${_('My account')} ${c.rhodecode_user.username} - ${c.rhodecode_name} | |||
r547 | </%def> | |||
<%def name="breadcrumbs_links()"> | ||||
${_('My Account')} | ||||
</%def> | ||||
<%def name="page_nav()"> | ||||
${self.menu('admin')} | ||||
</%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> | |||
r2624 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}" 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> | |||
r2624 | %if h.HasPermissionAny('hg.admin','hg.create.repository')(): | |||
<li> | ||||
<span>${h.link_to(_('Add repo'),h.url('admin_settings_create_repository'))}</span> | ||||
</li> | ||||
%endif | ||||
r1888 | </ul> | |||
r547 | </div> | |||
<!-- end box / title --> | ||||
r2624 | <div id="perms" class="table"> | |||
r2127 | %for section in sorted(c.rhodecode_user.permissions.keys()): | |||
<div class="perms_section_head">${section.replace("_"," ").capitalize()}</div> | ||||
r2129 | ||||
r2127 | <div id='tbl_list_wrap_${section}' class="yui-skin-sam"> | |||
<table id="tbl_list_${section}"> | ||||
<thead> | ||||
<tr> | ||||
<th class="left">${_('Name')}</th> | ||||
<th class="left">${_('Permission')}</th> | ||||
</thead> | ||||
<tbody> | ||||
%for k in c.rhodecode_user.permissions[section]: | ||||
r2131 | <% | |||
if section != 'global': | ||||
section_perm = c.rhodecode_user.permissions[section].get(k) | ||||
_perm = section_perm.split('.')[-1] | ||||
else: | ||||
_perm = section_perm = None | ||||
%> | ||||
%if _perm not in ['none']: | ||||
r2127 | <tr> | |||
r2128 | <td> | |||
%if section == 'repositories': | ||||
<a href="${h.url('summary_home',repo_name=k)}">${k}</a> | ||||
%elif section == 'repositories_groups': | ||||
<a href="${h.url('repos_group_home',group_name=k)}">${k}</a> | ||||
%else: | ||||
${k} | ||||
%endif | ||||
</td> | ||||
r2127 | <td> | |||
%if section == 'global': | ||||
r2128 | ${h.bool2icon(True)} | |||
r2127 | %else: | |||
r2131 | <span class="perm_tag ${_perm}">${section_perm}</span> | |||
r2127 | %endif | |||
</td> | ||||
</tr> | ||||
r2131 | %endif | |||
r2127 | %endfor | |||
</tbody> | ||||
</table> | ||||
</div> | ||||
%endfor | ||||
r547 | </div> | |||
r2624 | <div id="my" class="table" style="display:none"> | |||
r2673 | </div> | |||
r2722 | <div id="pullrequests" class="table" style="display:none"></div> | |||
r547 | </div> | |||
r2722 | ||||
r1653 | <script type="text/javascript"> | |||
r2127 | var filter_activate = function(){ | |||
var nodes = YUQ('#my tr td a.repo_name'); | ||||
var func = function(node){ | ||||
return node.parentNode.parentNode.parentNode.parentNode; | ||||
} | ||||
r2129 | q_filter('q_filter',YUQ('#my tr td a.repo_name'),func); | |||
r1653 | } | |||
r2886 | ||||
var show_perms = function(e){ | ||||
YUD.addClass('show_perms', 'current'); | ||||
YUD.removeClass('show_my','current'); | ||||
YUD.removeClass('show_pullrequests','current'); | ||||
r2673 | ||||
r2624 | YUD.setStyle('my','display','none'); | |||
YUD.setStyle('pullrequests','display','none'); | ||||
YUD.setStyle('perms','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 | ||||
r2624 | YUD.setStyle('perms','display','none'); | |||
YUD.setStyle('pullrequests','display','none'); | ||||
YUD.setStyle('my','display',''); | ||||
YUD.setStyle('q_filter','display',''); | ||||
r2673 | ||||
r2907 | ||||
r2624 | var url = "${h.url('admin_settings_my_repos')}"; | |||
ypjax(url, 'my', function(){ | ||||
r2886 | table_sort(); | |||
filter_activate(); | ||||
r2907 | }); | |||
r2886 | } | |||
YUE.on('show_my','click',function(e){ | ||||
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'); | ||||
r2127 | YUD.setStyle('my','display','none'); | |||
r2624 | YUD.setStyle('perms','display','none'); | |||
YUD.setStyle('pullrequests','display',''); | ||||
YUD.setStyle('q_filter','display','none'); | ||||
r2907 | ||||
r2624 | var url = "${h.url('admin_settings_my_pullrequests')}"; | |||
r2907 | ypjax(url, 'pullrequests'); | |||
r2886 | } | |||
YUE.on('show_pullrequests','click',function(e){ | ||||
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]; | |||
console.log(tabs, tabHash) | ||||
r2907 | tabs[tabHash](); | |||
r2886 | } | |||
r2127 | // 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:"tip",label:"${_('Tip')}",sortable:true, | ||||
sortOptions: { sortFunction: revisionSort }}, | ||||
{key:"action1",label:"",sortable:false}, | ||||
{key:"action2",label:"",sortable:false}, | ||||
]; | ||||
r2624 | function table_sort(){ | |||
r2127 | var myDataSource = new YAHOO.util.DataSource(YUD.get("repos_list")); | |||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE; | ||||
myDataSource.responseSchema = { | ||||
fields: [ | ||||
{key:"menu"}, | ||||
{key:"name"}, | ||||
{key:"tip"}, | ||||
{key:"action1"}, | ||||
{key:"action2"}, | ||||
] | ||||
}; | ||||
var trans_defs = { | ||||
sortedBy:{key:"name",dir:"asc"}, | ||||
MSG_SORTASC:"${_('Click to sort ascending')}", | ||||
MSG_SORTDESC:"${_('Click to sort descending')}", | ||||
MSG_EMPTY:"${_('No records found.')}", | ||||
MSG_ERROR:"${_('Data error.')}", | ||||
MSG_LOADING:"${_('Loading...')}", | ||||
} | ||||
var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,trans_defs); | ||||
myDataTable.subscribe('postRenderEvent',function(oArgs) { | ||||
tooltip_activate(); | ||||
quick_repo_menu(); | ||||
filter_activate(); | ||||
}); | ||||
var permsColumnDefs = [ | ||||
{key:"name",label:"${_('Name')}",sortable:true, sortOptions: { sortFunction: permNameSort }}, | ||||
{key:"perm",label:"${_('Permission')}",sortable:false,}, | ||||
]; | ||||
// perms repos table | ||||
var myDataSource2 = new YAHOO.util.DataSource(YUD.get("tbl_list_repositories")); | ||||
myDataSource2.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE; | ||||
myDataSource2.responseSchema = { | ||||
fields: [ | ||||
{key:"name"}, | ||||
{key:"perm"}, | ||||
] | ||||
}; | ||||
new YAHOO.widget.DataTable("tbl_list_wrap_repositories", permsColumnDefs, myDataSource2, trans_defs); | ||||
//perms groups table | ||||
var myDataSource3 = new YAHOO.util.DataSource(YUD.get("tbl_list_repositories_groups")); | ||||
myDataSource3.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE; | ||||
myDataSource3.responseSchema = { | ||||
fields: [ | ||||
{key:"name"}, | ||||
{key:"perm"}, | ||||
] | ||||
}; | ||||
new YAHOO.widget.DataTable("tbl_list_wrap_repositories_groups", permsColumnDefs, myDataSource3, trans_defs); | ||||
r2624 | } | |||
r1653 | </script> | |||
r1888 | </%def> | |||