changeset 1437:7a46d67c263c beta

added welcome message if no repositories are present in current view
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 22 Jul 2011 20:06:40 +0200
parents 88d13c1c6a55
children 002f4f465b58
files rhodecode/model/scm.py rhodecode/templates/index_base.html
diffstat 2 files changed, 27 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/model/scm.py	Wed Jul 20 01:47:56 2011 +0200
+++ b/rhodecode/model/scm.py	Fri Jul 22 20:06:40 2011 +0200
@@ -30,8 +30,7 @@
 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
 
@@ -83,21 +82,18 @@
 
             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')
 
--- a/rhodecode/templates/index_base.html	Wed Jul 20 01:47:56 2011 +0200
+++ b/rhodecode/templates/index_base.html	Fri Jul 22 20:06:40 2011 +0200
@@ -40,7 +40,7 @@
                     <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>
                 
@@ -55,14 +55,17 @@
                           </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>
@@ -190,9 +193,25 @@
 
      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;
@@ -216,7 +235,7 @@
             }
         }
         // 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){