changeset 786:2889a4446960 beta

when new repo is created make user follow it automatically, add tilte to currently logged in user.
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 28 Nov 2010 21:06:16 +0100
parents 277427ac29a9
children 4502ceec31be
files rhodecode/model/repo.py rhodecode/templates/base/base.html
diffstat 2 files changed, 35 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/model/repo.py	Sun Nov 28 05:31:05 2010 +0100
+++ b/rhodecode/model/repo.py	Sun Nov 28 21:06:16 2010 +0100
@@ -1,7 +1,15 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# model for handling repositories actions
-# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
+# -*- coding: utf-8 -*-
+"""
+    package.rhodecode.model.repo
+    ~~~~~~~~~~~~~~
+
+    Repository model for rhodecode
+    
+    :created_on: Jun 5, 2010
+    :author: marcink
+    :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
+    :license: GPLv3, see COPYING for more details.
+"""
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2
@@ -16,23 +24,22 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
-"""
-Created on Jun 5, 2010
-model for handling repositories actions
-:author: marcink
-"""
-from vcs.backends import get_backend
+import os
+import shutil
+import logging
+import traceback
 from datetime import datetime
+
 from pylons import app_globals as g
+
+from rhodecode.model import BaseModel
+from rhodecode.model.caching_query import FromCache
 from rhodecode.model.db import Repository, RepoToPerm, User, Permission, \
     Statistics
-from rhodecode.model import BaseModel
 from rhodecode.model.user import UserModel
-from rhodecode.model.caching_query import FromCache
-import logging
-import os
-import shutil
-import traceback
+
+from vcs.backends import get_backend
+
 log = logging.getLogger(__name__)
 
 class RepoModel(BaseModel):
@@ -158,6 +165,13 @@
 
             self.sa.add(repo_to_perm)
             self.sa.commit()
+
+
+            #now automatically start following this repository as owner
+            from rhodecode.model.scm import ScmModel
+            ScmModel(self.sa).toggle_following_repo(new_repo.repo_id,
+                                             cur_user.user_id)
+
             if not just_db:
                 self.__create_repo(repo_name, form_data['repo_type'])
         except:
--- a/rhodecode/templates/base/base.html	Sun Nov 28 05:31:05 2010 +0100
+++ b/rhodecode/templates/base/base.html	Sun Nov 28 21:06:16 2010 +0100
@@ -22,11 +22,9 @@
 	                </div>
 		            <div class="account">
 		            %if c.rhodecode_user.username == 'default':
-                        ##${h.link_to('%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname),h.url('register'))}<br/>
-                        ${h.link_to('anonymous',h.url('register'))}
+                        ${h.link_to('anonymous',h.url('register'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))}
                     %else:                        		            
-		            	##${h.link_to('%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname),h.url('admin_settings_my_account'))}<br/>
-		            	${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'))}
+		            	${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))}
 		            %endif
 		            </div>	
 	            </li>
@@ -36,14 +34,12 @@
                 <li>
                    <a href="${h.url('journal')}">${_('Journal')}</a> 
                    ##(${c.unread_journal})</a>
-                </li>	         
+                </li>
                 %if c.rhodecode_user.username == 'default':
                     <li class="last highlight">${h.link_to(u'Login',h.url('login_home'))}</li>
-                %else:                                          
+                %else:
                     <li class="last highlight">${h.link_to(u'Log Out',h.url('logout_home'))}</li>
-                %endif                   
-	            
-	            
+                %endif
         </ul>
         <!-- end user -->
         <div id="header-inner" class="title top-left-rounded-corner top-right-rounded-corner">