Marcin Kuzminski avatar Marcin Kuzminski committed 1f2c4bf

remember selected tab in my account page

Comments (0)

Files changed (1)

rhodecode/templates/admin/users/user_edit_my_account.html

              <span><a id="show_my" class="link-white" href="#my">${_('My repos')}</a> </span>
            </li>
            <li>
-             <span><a id="show_pullrequests" class="link-white" href="#perms">${_('My pull requests')}</a> </span>
+             <span><a id="show_pullrequests" class="link-white" href="#pullrequests">${_('My pull requests')}</a> </span>
            </li>
            %if h.HasPermissionAny('hg.admin','hg.create.repository')():
              <li>
     }
     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');
     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');
     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"},
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.