# HG changeset patch # User Marcin Kuzminski # Date 2012-09-30 13:30:03 # Node ID 1f2c4bf348ad7b48ac24baa0097557c23d372988 # Parent 28d742d71d4e647d834311eaf490cb4b90fad659 remember selected tab in my account page diff --git a/rhodecode/templates/admin/users/user_edit_my_account.html b/rhodecode/templates/admin/users/user_edit_my_account.html --- a/rhodecode/templates/admin/users/user_edit_my_account.html +++ b/rhodecode/templates/admin/users/user_edit_my_account.html @@ -38,7 +38,7 @@ ${_('My repos')}
  • - ${_('My pull requests')} + ${_('My pull requests')}
  • %if h.HasPermissionAny('hg.admin','hg.create.repository')():
  • @@ -109,18 +109,22 @@ var filter_activate = function(){ } q_filter('q_filter',YUQ('#my tr td a.repo_name'),func); } -YUE.on('show_perms','click',function(e){ - YUD.addClass('show_perms', 'current'); - YUD.removeClass('show_my','current'); - YUD.removeClass('show_pullrequests','current'); + +var show_perms = function(e){ + YUD.addClass('show_perms', 'current'); + YUD.removeClass('show_my','current'); + YUD.removeClass('show_pullrequests','current'); YUD.setStyle('my','display','none'); YUD.setStyle('pullrequests','display','none'); YUD.setStyle('perms','display',''); - YUD.setStyle('q_filter','display','none'); - YUE.preventDefault(e); + YUD.setStyle('q_filter','display','none'); +} +YUE.on('show_perms','click',function(e){ + show_perms(); }) -YUE.on('show_my','click',function(e){ + +var show_my = function(e){ YUD.addClass('show_my', 'current'); YUD.removeClass('show_perms','current'); YUD.removeClass('show_pullrequests','current'); @@ -130,14 +134,18 @@ YUE.on('show_my','click',function(e){ YUD.setStyle('my','display',''); YUD.setStyle('q_filter','display',''); - YUE.preventDefault(e); + var url = "${h.url('admin_settings_my_repos')}"; ypjax(url, 'my', function(){ - table_sort(); - filter_activate(); - }); + table_sort(); + filter_activate(); + }); +} +YUE.on('show_my','click',function(e){ + show_my(e); }) -YUE.on('show_pullrequests','click',function(e){ + +var show_pullrequests = function(e){ YUD.addClass('show_pullrequests', 'current'); YUD.removeClass('show_my','current'); YUD.removeClass('show_perms','current'); @@ -146,11 +154,27 @@ YUE.on('show_pullrequests','click',funct YUD.setStyle('perms','display','none'); YUD.setStyle('pullrequests','display',''); YUD.setStyle('q_filter','display','none'); - YUE.preventDefault(e); + var url = "${h.url('admin_settings_my_pullrequests')}"; - ypjax(url, 'pullrequests'); + ypjax(url, 'pullrequests'); +} +YUE.on('show_pullrequests','click',function(e){ + show_pullrequests(e) }) +var tabs = { + 'perms': show_perms, + 'my': show_my, + 'pullrequests': show_pullrequests +} +var url = location.href.split('#'); +if (url[1]) { + //We have a hash + var tabHash = url[1]; + console.log(tabs, tabHash) + tabs[tabHash](); +} + // main table sorting var myColumnDefs = [ {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},