changeset 922:b2a70582bce3

fixed base.html. and missing lib str2bool function
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 06 Jan 2011 19:26:46 +0100
parents 136af52f374b
children 7e9c80b515af
files rhodecode/lib/__init__.py rhodecode/templates/base/base.html
diffstat 2 files changed, 36 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/__init__.py	Thu Jan 06 19:10:25 2011 +0100
+++ b/rhodecode/lib/__init__.py	Thu Jan 06 19:26:46 2011 +0100
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+"""
+    rhodecode.lib.__init__
+    ~~~~~~~~~~~~~~~~~~~~~~~
+
+    Some simple helper functions
+    
+    :created_on: Jan 5, 2011
+    :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
+# of the License or (at your opinion) any later version of the license.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+
+def str2bool(v):
+    return v.lower() in ["yes", "true", "t", "1"] if v else None
--- a/rhodecode/templates/base/base.html	Thu Jan 06 19:10:25 2011 +0100
+++ b/rhodecode/templates/base/base.html	Thu Jan 06 19:26:46 2011 +0100
@@ -207,7 +207,11 @@
                    </a>
                    <ul>
                    %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
-                   	<li>${h.link_to(_('settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}</li>
+                     %if h.HasPermissionAll('hg.admin')('access settings on repository'):
+                         <li>${h.link_to(_('settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}</li>
+                     %else:
+                         <li>${h.link_to(_('settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}</li>
+                     %endif
                    	<li>${h.link_to(_('fork'),h.url('repo_fork_home',repo_name=c.repo_name),class_='fork')}</li>
                    %endif  
                    	<li>${h.link_to(_('search'),h.url('search_repo',search_repo=c.repo_name),class_='search')}</li>
@@ -337,7 +341,7 @@
 
 function toggleFollowingUser(fallows_user_id,token){
     args = 'follows_user_id='+fallows_user_id;
-    args+= '&auth_token='+token;
+    args+= '&amp;auth_token='+token;
     YUC.asyncRequest('POST',base_url,{
         success:function(o){
         	onSuccess();
@@ -347,7 +351,7 @@
 
 function toggleFollowingRepo(fallows_repo_id,token){
     args = 'follows_repo_id='+fallows_repo_id;
-    args+= '&auth_token='+token;
+    args+= '&amp;auth_token='+token;
     YUC.asyncRequest('POST',base_url,{
         success:function(o){
         	onSuccess();