Changeset - 7a46d67c263c
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 14 years ago 2011-07-22 20:06:40
marcin@python-works.com
added welcome message if no repositories are present in current view
2 files changed with 27 insertions and 12 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/scm.py
Show inline comments
 
@@ -27,14 +27,13 @@ import time
 
import traceback
 
import logging
 

	
 
from sqlalchemy.exc import DatabaseError
 

	
 
from vcs import get_backend
 
from vcs.utils.helpers import get_scm
 
from vcs.exceptions import RepositoryError, VCSError
 
from vcs.exceptions import RepositoryError
 
from vcs.utils.lazy import LazyProperty
 
from vcs.nodes import FileNode
 

	
 
from rhodecode import BACKENDS
 
from rhodecode.lib import helpers as h
 
from rhodecode.lib import safe_str
 
@@ -80,27 +79,24 @@ class CachedRepoList(object):
 

	
 
    def __iter__(self):
 
        for dbr in self.db_repo_list:
 

	
 
            scmr = dbr.scm_instance_cached
 

	
 
            #check permission at this level
 
            if not HasRepoPermissionAny('repository.read',
 
                                        'repository.write',
 
            # check permission at this level
 
            if not HasRepoPermissionAny('repository.read', 'repository.write',
 
                                        'repository.admin')(dbr.repo_name,
 
                                                            'get repo check'):
 
                continue
 

	
 

	
 
            if scmr is None:
 
                log.error('%s this repository is present in database but it '
 
                          'cannot be created as an scm instance',
 
                          dbr.repo_name)
 
                continue
 

	
 

	
 
            last_change = scmr.last_change
 
            tip = h.get_changeset_safe(scmr, 'tip')
 

	
 
            tmp_d = {}
 
            tmp_d['name'] = dbr.repo_name
 
            tmp_d['name_sort'] = tmp_d['name'].lower()
rhodecode/templates/index_base.html
Show inline comments
 
@@ -37,13 +37,13 @@
 
           % if c.groups:
 
            <table>
 
                <thead>
 
                    <tr>
 
                        <th class="left"><a href="#">${_('Group name')}</a></th>
 
                        <th class="left"><a href="#">${_('Description')}</a></th>
 
                        <th class="left"><a href="#">${_('Number of repositories')}</a></th>
 
                        ##<th class="left"><a href="#">${_('Number of repositories')}</a></th>
 
                    </tr>
 
                </thead>
 
                
 
                ## REPO GROUPS
 
                
 
                % for gr in c.groups:
 
@@ -52,20 +52,23 @@
 
                          <div style="white-space: nowrap">
 
                          <img class="icon" alt="${_('Repositories group')}" src="${h.url('/images/icons/database_link.png')}"/>
 
                          ${h.link_to(gr.group_name,url('repos_group',id=gr.group_id))}
 
                          </div>
 
                      </td>
 
                      <td>${gr.group_description}</td>
 
                      <td><b>${gr.repositories.count()}</b></td>
 
                      ##<td><b>${gr.repositories.count()}</b></td>
 
                  </tr>
 
                % endfor
 
                
 
            </table>
 
            <div style="height: 20px"></div>
 
            % endif
 
            <table>
 
            <div id="welcome" style="display:none;text-align:center">
 
                <h1><a href="${h.url('home')}">${c.rhodecode_name} ${c.rhodecode_version}</a></h1>
 
            </div>
 
            <table id="repos_list">
 
            <thead>
 
                <tr>
 
                    <th class="left"></th>
 
                    <th class="left">${get_sort(_('Name'))}</th>
 
                    <th class="left">${get_sort(_('Description'))}</th>
 
                    <th class="left">${get_sort(_('Last change'))}</th>
 
@@ -187,15 +190,31 @@
 
     E.on(q_filter,'click',function(){
 
        q_filter.value = '';
 
     });
 

	
 
     F.filterTimeout = null;
 
     
 
     function set_count(count){
 
    
 
    	 if(count == 0){
 
    		 YUD.setStyle('repos_list','display','none');
 
    		 YUD.setStyle('welcome','display','');
 
    	 }
 
    	 else{
 
    		 YUD.setStyle('repos_list','display','');
 
    		 YUD.setStyle('welcome','display','none');
 
    	 }
 
    	 YUD.get('repo_count').innerHTML = count;
 
    	 
 
     }
 
     
 
     
 
     //set initial count for repos
 
     var nodes = S.query('div.table tr td div a.repo_name');
 
     YUD.get('repo_count').innerHTML = nodes.length;
 
     
 
     set_count(nodes.length)
 
     F.updateFilter  = function() { 
 
        // Reset timeout 
 
        F.filterTimeout = null;
 
        
 
        var obsolete = [];
 
        nodes = S.query('div.table tr td div a.repo_name');
 
@@ -213,13 +232,13 @@
 
                for (n in obsolete){
 
                    D.setStyle(obsolete[n].parentNode.parentNode.parentNode,'display','none');
 
                }
 
            }
 
        }
 
        // set new count into dashboard
 
        YUD.get('repo_count').innerHTML = nodes.length - obsolete.length;      
 
        set_count(nodes.length - obsolete.length)
 
     }
 
     
 
     E.on(q_filter,'keyup',function(e){
 
         clearTimeout(F.filterTimeout); 
 
         setTimeout(F.updateFilter,600); 
 
     });
0 comments (0 inline, 0 general)