Changeset - e7600fe19943
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2013-01-23 22:16:54
marcin@python-works.com
Implements #734 repo switcher should be available in all views
1 file changed with 24 insertions and 31 deletions:
0 comments (0 inline, 0 general)
rhodecode/templates/base/base.html
Show inline comments
 
@@ -141,15 +141,12 @@
 
<%def name="menu(current=None)">
 
        <%
 
        def is_current(selected):
 
            if selected == current:
 
                return h.literal('class="current"')
 
        %>
 
        ## we render this menu only not for those pages 
 
        %if current not in ['home','admin', 'search', 'journal']:
 
            ##REGULAR MENU
 
            <ul id="quick">
 
                <!-- repo switcher -->
 
                <li>
 
                    <a class="menu_link" id="repo_switcher" title="${_('Switch repository')}" href="#">
 
                    <span class="icon">
 
                        <img src="${h.url('/images/icons/database.png')}" alt="${_('Products')}" />
 
@@ -159,13 +156,15 @@
 
                    <ul id="repo_switcher_list" class="repo_switcher">
 
                        <li>
 
                            <a href="#">${_('loading...')}</a>
 
                        </li>
 
                    </ul>
 
                </li>
 

	
 
        ## we render this menu only not for those pages 
 
        %if current not in ['home','admin', 'search', 'journal']:
 
            ##REGULAR MENU
 
                <li ${is_current('summary')}>
 
                   <a class="menu_link" title="${_('Summary')}" href="${h.url('summary_home',repo_name=c.repo_name)}">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/clipboard_16.png')}" alt="${_('Summary')}" />
 
                   </span>
 
                   <span>${_('Summary')}</span>
 
@@ -176,13 +175,12 @@
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/time.png')}" alt="${_('Changelog')}" />
 
                   </span>
 
                   <span>${_('Changelog')}</span>
 
                   </a>
 
                </li>
 

	
 
                <li ${is_current('switch_to')}>
 
                   <a class="menu_link" id="branch_tag_switcher" title="${_('Switch to')}" href="#">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/arrow_switch.png')}" alt="${_('Switch to')}" />
 
                   </span>
 
                   <span>${_('Switch to')}</span>
 
@@ -196,13 +194,12 @@
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/file.png')}" alt="${_('Files')}" />
 
                   </span>
 
                   <span>${_('Files')}</span>
 
                   </a>
 
                </li>
 

	
 
                <li ${is_current('options')}>
 
                   <a class="menu_link" title="${_('Options')}" href="#">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/table_gear.png')}" alt="${_('Admin')}" />
 
                   </span>
 
                   <span>${_('Options')}</span>
 
@@ -252,13 +249,12 @@
 
                        ## ADMIN MENU
 
                        ${admin_menu()}
 
                     </li>
 
                    % endif
 
                   </ul>
 
                </li>
 

	
 
                <li>
 
                    <a class="menu_link" title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}">
 
                    <span class="icon_short">
 
                        <img src="${h.url('/images/icons/heart.png')}" alt="${_('Followers')}" />
 
                    </span>
 
                    <span id="current_followers_count" class="short">${c.repository_followers}</span>
 
@@ -278,34 +274,13 @@
 
                        <img src="${h.url('/images/icons/arrow_join.png')}" alt="${_('Pull requests')}" />
 
                    </span>
 
                    <span class="short">${c.repository_pull_requests}</span>
 
                    </a>
 
                </li>
 
                ${usermenu()}
 
            </ul>
 
            <script type="text/javascript">
 
               YUE.on('repo_switcher','mouseover',function(){
 
                      function qfilter(){
 
                          var nodes = YUQ('ul#repo_switcher_list li a.repo_name');
 
                          var target = 'q_filter_rs';
 
                          var func = function(node){
 
                              return node.parentNode;
 
                          }
 
                          q_filter(target,nodes,func);
 
                      }
 
                   var loaded = YUD.hasClass('repo_switcher','loaded');
 
                   if(!loaded){
 
                       YUD.addClass('repo_switcher','loaded');
 
                       ypjax("${h.url('repo_switcher')}",'repo_switcher_list',
 
                           function(o){qfilter();},
 
                           function(o){YUD.removeClass('repo_switcher','loaded');}
 
                           ,null);
 
                   }
 
                   return false;
 
               });
 

	
 
              YUE.on('branch_tag_switcher','mouseover',function(){
 
                 var loaded = YUD.hasClass('branch_tag_switcher','loaded');
 
                 if(!loaded){
 
                     YUD.addClass('branch_tag_switcher','loaded');
 
                     ypjax("${h.url('branch_tag_switcher',repo_name=c.repo_name)}",'switch_to_list',
 
                         function(o){},
 
@@ -314,13 +289,12 @@
 
                 }
 
                 return false;
 
              });
 
            </script>
 
        %else:
 
            ##ROOT MENU
 
            <ul id="quick">
 
                <li ${is_current('home')}>
 
                    <a class="menu_link" title="${_('Home')}"  href="${h.url('home')}">
 
                    <span class="icon">
 
                        <img src="${h.url('/images/icons/home_16.png')}" alt="${_('Home')}" />
 
                    </span>
 
                    <span>${_('Home')}</span>
 
@@ -350,22 +324,41 @@
 
                    <span class="icon">
 
                        <img src="${h.url('/images/icons/search_16.png')}" alt="${_('Search')}" />
 
                    </span>
 
                    <span>${_('Search')}</span>
 
                    </a>
 
                </li>
 

	
 
                %if h.HasPermissionAll('hg.admin')('access admin main page'):
 
                <li ${is_current('admin')}>
 
                   <a class="menu_link" title="${_('Admin')}" href="${h.url('admin_home')}">
 
                   <span class="icon">
 
                       <img src="${h.url('/images/icons/cog_edit.png')}" alt="${_('Admin')}" />
 
                   </span>
 
                   <span>${_('Admin')}</span>
 
                   </a>
 
                    ${admin_menu()}
 
                </li>
 
                %endif
 
                ${usermenu()}
 
            </ul>
 
        %endif
 
  <script type="text/javascript">
 
     YUE.on('repo_switcher','mouseover',function(){
 
            function qfilter(){
 
                var nodes = YUQ('ul#repo_switcher_list li a.repo_name');
 
                var target = 'q_filter_rs';
 
                var func = function(node){
 
                    return node.parentNode;
 
                }
 
                q_filter(target,nodes,func);
 
            }
 
         var loaded = YUD.hasClass('repo_switcher','loaded');
 
         if(!loaded){
 
             YUD.addClass('repo_switcher','loaded');
 
             ypjax("${h.url('repo_switcher')}",'repo_switcher_list',
 
                 function(o){qfilter();},
 
                 function(o){YUD.removeClass('repo_switcher','loaded');}
 
                 ,null);
 
         }
 
         return false;
 
     });
 
</script>                    
 
</%def>
0 comments (0 inline, 0 general)