Changeset - 8ba65e4c4e4c
[Not reviewed]
celery
0 4 0
Marcin Kuzminski - 15 years ago 2010-09-13 13:02:20
marcin@python-works.com
added journal icon and made active links in journal, fixed edit user bug when given wrong id
4 files changed with 14 insertions and 2 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/admin/users.py
Show inline comments
 
#!/usr/bin/env python
 
# encoding: utf-8
 
# users controller for pylons
 
# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
 
# 
 
# 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.
 
"""
 
Created on April 4, 2010
 
users controller for pylons
 
@author: marcink
 
"""
 

	
 
from formencode import htmlfill
 
from pylons import request, session, tmpl_context as c, url
 
from pylons.controllers.util import abort, redirect
 
from pylons.i18n.translation import _
 
from pylons_app.lib import helpers as h
 
from pylons_app.lib.auth import LoginRequired, HasPermissionAllDecorator
 
from pylons_app.lib.base import BaseController, render
 
from pylons_app.model.db import User, UserLog
 
from pylons_app.model.forms import UserForm
 
from pylons_app.model.user_model import UserModel, DefaultUserException
 
import formencode
 
import logging
 
import traceback
 

	
 
log = logging.getLogger(__name__)
 

	
 
class UsersController(BaseController):
 
    """REST Controller styled on the Atom Publishing Protocol"""
 
    # To properly map this controller, ensure your config/routing.py
 
    # file has a resource setup:
 
    #     map.resource('user', 'users')
 
    
 
    @LoginRequired()
 
    @HasPermissionAllDecorator('hg.admin')
 
    def __before__(self):
 
        c.admin_user = session.get('admin_user')
 
        c.admin_username = session.get('admin_username')
 
        super(UsersController, self).__before__()
 
    
 

	
 
    def index(self, format='html'):
 
        """GET /users: All items in the collection"""
 
        # url('users')
 
        
 
        c.users_list = self.sa.query(User).all()     
 
        return render('admin/users/users.html')
 
    
 
    def create(self):
 
        """POST /users: Create a new item"""
 
        # url('users')
 
        
 
        user_model = UserModel()
 
        login_form = UserForm()()
 
        try:
 
            form_result = login_form.to_python(dict(request.POST))
 
            user_model.create(form_result)
 
            h.flash(_('created user %s') % form_result['username'],
 
                    category='success')
 
        except formencode.Invalid as errors:
 
            return htmlfill.render(
 
                render('admin/users/user_add.html'),
 
                defaults=errors.value,
 
                errors=errors.error_dict or {},
 
                prefix_error=False,
 
                encoding="UTF-8") 
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            h.flash(_('error occured during creation of user %s') \
 
                    % request.POST.get('username'), category='error')            
 
        return redirect(url('users'))
 
    
 
    def new(self, format='html'):
 
        """GET /users/new: Form to create a new item"""
 
        # url('new_user')
 
        return render('admin/users/user_add.html')
 

	
 
    def update(self, id):
 
        """PUT /users/id: Update an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="PUT" />
 
        # Or using helpers:
 
        #    h.form(url('user', id=ID),
 
        #           method='put')
 
        # url('user', id=ID)
 
        user_model = UserModel()
 
        _form = UserForm(edit=True, old_data={'user_id':id})()
 
        form_result = {}
 
        try:
 
            form_result = _form.to_python(dict(request.POST))
 
            user_model.update(id, form_result)
 
            h.flash(_('User updated succesfully'), category='success')
 
                           
 
        except formencode.Invalid as errors:
 
            c.user = user_model.get_user(id)
 
            return htmlfill.render(
 
                render('admin/users/user_edit.html'),
 
                defaults=errors.value,
 
                errors=errors.error_dict or {},
 
                prefix_error=False,
 
                encoding="UTF-8") 
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            h.flash(_('error occured during update of user %s') \
 
                    % form_result.get('username'), category='error')
 
            
 
        return redirect(url('users'))
 
    
 
    def delete(self, id):
 
        """DELETE /users/id: Delete an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="DELETE" />
 
        # Or using helpers:
 
        #    h.form(url('user', id=ID),
 
        #           method='delete')
 
        # url('user', id=ID)
 
        user_model = UserModel()
 
        try:
 
            user_model.delete(id)
 
            h.flash(_('sucessfully deleted user'), category='success')
 
        except DefaultUserException as e:
 
            h.flash(str(e), category='warning')
 
        except Exception:
 
            h.flash(_('An error occured during deletion of user'),
 
                    category='error')            
 
        return redirect(url('users'))
 
        
 
    def show(self, id, format='html'):
 
        """GET /users/id: Show a specific item"""
 
        # url('user', id=ID)
 
    
 
    
 
    def edit(self, id, format='html'):
 
        """GET /users/id/edit: Form to edit an existing item"""
 
        # url('edit_user', id=ID)
 
        c.user = self.sa.query(User).get(id)
 
        if not c.user:
 
            return redirect(url('users'))
 
        if c.user.username == 'default':
 
            h.flash(_("You can't edit this user since it's" 
 
              " crucial for entire application"), category='warning')
 
            return redirect(url('users'))
 
        
 
        defaults = c.user.__dict__
 
        return htmlfill.render(
 
            render('admin/users/user_edit.html'),
 
            defaults=defaults,
 
            encoding="UTF-8",
 
            force_defaults=False
 
        )    
pylons_app/public/css/style.css
Show inline comments
 
@@ -124,768 +124,777 @@ div.color a
 
    float: left;
 
}
 
 
div.color a.blue
 
{
 
    background: #376ea6;
 
}
 
 
div.color a.green
 
{
 
    background: #85924b;
 
}
 
 
div.color a.brown
 
{
 
    background: #9b6e42;
 
}
 
 
div.color a.purple
 
{
 
    background: #88528b;
 
}
 
 
div.color a.red
 
{
 
    background: #bd3220;
 
}
 
 
div.color a.greyblue
 
{
 
    background: #566e86;
 
}
 
 
/* -----------------------------------------------------------
 
	options
 
----------------------------------------------------------- */ 
 
 
div.options
 
{
 
    margin: 7px 0 0 162px;
 
    padding: 0;
 
	clear: both;
 
	overflow: hidden;
 
    position: absolute;
 
    background: #FFFFFF;
 
}
 
 
div.options a
 
{
 
	margin: 0;
 
    padding: 3px 8px 3px 8px;
 
    height: 1%;
 
    display: block;
 
	text-decoration: none;	
 
}
 
 
div.options a:hover
 
{
 
	text-decoration: none;	
 
}
 
 
/* -----------------------------------------------------------
 
	header
 
----------------------------------------------------------- */ 
 
 
#header
 
{
 
	margin: 0;
 
	padding: 0 30px 0 30px;
 
	background: #b0b0b0 url("../images/header_background.png") repeat;
 
}
 
 
 
/* -----------------------------------------------------------
 
	header -> user
 
----------------------------------------------------------- */ 
 
 
#header ul#logged-user
 
{
 
	margin: 0;
 
	padding: 0;
 
	float: right;
 
}
 
 
#header ul#logged-user li
 
{
 
	margin: 0;
 
	padding: 10px 12px 10px 12px;
 
	list-style: none;
 
	float: left;
 
	border-left: 1px solid #bbbbbb;
 
	border-right: 1px solid #a5a5a5;
 
}
 
 
#header ul#logged-user li.first
 
{
 
	border-left: none;
 
	margin:-6px;	
 
}
 
#header ul#logged-user li.first div.account
 
{
 
	padding-top: 4px;
 
	float: left;
 
}
 
 
 
#header ul#logged-user li.last
 
{
 
	border-right: none;	
 
}
 
 
#header ul#logged-user li a
 
{
 
	color: #4e4e4e;
 
	font-weight: bold;
 
	text-decoration: none;
 
}
 
 
#header ul#logged-user li a:hover
 
{
 
	color: #376ea6;
 
	text-decoration: underline;
 
}
 
 
#header ul#logged-user li.highlight a
 
{
 
	color: #ffffff;
 
}
 
 
#header ul#logged-user li.highlight a:hover
 
{
 
	color: #376ea6;
 
}
 
 
#header #header-inner
 
{
 
	margin: 0;
 
	padding: 0;
 
	height: 40px;
 
	clear: both;
 
	position: relative;
 
	background: #003367 url("../images/colors/blue/header_inner.png") repeat-x;
 
	border-bottom: 6px solid #ffffff;
 
}
 
 
/* -----------------------------------------------------------
 
	header -> home
 
----------------------------------------------------------- */ 
 
 
#header #header-inner #home
 
{
 
	float: left;	
 
}
 
 
#header #header-inner #home a
 
{
 
	margin: 0;
 
	padding: 0;
 
	height: 40px;
 
	width: 46px;
 
	display: block;
 
	background: url("../images/colors/blue/button_home.png");
 
	background-position: 0 0;	
 
}
 
 
#header #header-inner #home a:hover
 
{
 
	background-position: 0 -40px;	
 
}
 
 
/* -----------------------------------------------------------
 
	header -> logo
 
----------------------------------------------------------- */ 
 
 
#header #header-inner #logo
 
{
 
	float: left;	
 
}
 
 
#header #header-inner #logo h1
 
{
 
	margin: 13px 0 0 13px;
 
	padding: 0;
 
	color: #FFFFFF;
 
	font-size: 14px;
 
	text-transform: uppercase;	
 
}
 
 
#header #header-inner #logo a
 
{
 
	color: #ffffff;
 
	text-decoration: none;	
 
}
 
 
#header #header-inner #logo a:hover
 
{
 
	color: #dabf29;
 
}
 
 
/* -----------------------------------------------------------
 
	header -> quick
 
----------------------------------------------------------- */ 
 
#header #header-inner #quick,
 
#header #header-inner #quick ul
 
{
 
    margin: 10px 5px 0 0;
 
    padding: 0;
 
    position: relative;
 
    float: right;
 
    list-style-type: none;
 
    list-style-position: outside;
 
}
 
 
#header #header-inner #quick li
 
{
 
    margin: 0 5px 0 0;
 
    padding: 0;
 
    position: relative;
 
    float: left;
 
}
 
 
#header #header-inner #quick li a
 
{
 
    top: 0;
 
    left: 0;
 
    padding: 0;
 
    height: 1%;
 
    display: block;
 
    clear: both;
 
    overflow: hidden;
 
    background: #336699 url("../../resources/images/colors/blue/quick_l.png") no-repeat top left;
 
    color: #FFFFFF;
 
    font-weight: bold;
 
    text-decoration: none;
 
}
 
 
#header #header-inner #quick li span
 
{
 
    top: 0;
 
    right: 0;
 
    margin: 0;
 
    padding: 10px 12px 8px 10px;
 
    height: 1%;
 
    display: block;
 
    float: left;
 
    background: url("../../resources/images/colors/blue/quick_r.png") no-repeat top right;
 
    border-left: 1px solid #3f6f9f;
 
}
 
 
#header #header-inner #quick li span.normal
 
{
 
    padding: 10px 12px 8px 12px;
 
    border: none;   
 
}
 
 
#header #header-inner #quick li span.icon
 
{
 
    top: 0;
 
    left: 0;
 
    padding: 8px 8px 4px 8px;
 
    background: url("../../resources/images/colors/blue/quick_l.png") no-repeat top left;
 
    border-left: none;
 
    border-right: 1px solid #2e5c89;
 
}
 
 
#header #header-inner #quick li a:hover
 
{
 
    background: #4e4e4e url("../../resources/images/colors/blue/quick_l_selected.png") no-repeat top left;
 
}
 
 
#header #header-inner #quick li a:hover span
 
{
 
    background: url("../../resources/images/colors/blue/quick_r_selected.png") no-repeat top right;
 
    border-left: 1px solid #545454;
 
}
 
 
#header #header-inner #quick li a:hover span.normal
 
{
 
    border: none;   
 
}
 
 
#header #header-inner #quick li a:hover span.icon
 
{
 
    background: url("../../resources/images/colors/blue/quick_l_selected.png") no-repeat top left;
 
    border-left: none;
 
    border-right: 1px solid #464646;
 
}
 
 
#header #header-inner #quick ul
 
{
 
    top: 29px;
 
    right: 0;
 
    margin: 0;
 
    padding: 0;
 
    width: 200px;
 
    display: none;
 
    position: absolute;
 
    background: #FFFFFF;
 
    border: 1px solid #666;
 
    border-top: 1px solid #003367;
 
    z-index: 100;
 
}
 
 
#header #header-inner #quick ul.repo_switcher{
 
    max-height:275px;
 
    overflow-x:hidden;
 
    overflow-y:auto;
 
    white-space:nowrap;
 
}
 
 
#header #header-inner #quick li ul li
 
{
 
    border-bottom: 1px solid #dddddd;   
 
}
 
 
#header #header-inner #quick li ul li.last
 
{
 
    border: none;   
 
}
 
 
#header #header-inner #quick li ul li a
 
{
 
    margin: 0;
 
    padding: 7px 9px 7px 9px;
 
    height: 1%;
 
    width: 182px;
 
    height: auto;
 
    display: block;
 
    float: left;
 
    background: #FFFFFF;
 
    color: #0066CC;
 
    font-weight: normal;
 
}
 
 
#header #header-inner #quick li ul li a.childs
 
{
 
    margin: 0;
 
    padding: 7px 9px 7px 24px;
 
    width: 167px;
 
    background: #FFFFFF url("../../resources/images/plus.png") no-repeat 8px 9px;
 
}
 
 
#header #header-inner #quick li ul li a:hover
 
{
 
    color: #000000;
 
    background: #FFFFFF;
 
}
 
 
#header #header-inner #quick li ul li a.childs:hover
 
{
 
    background: #FFFFFF url("../../resources/images/minus.png") no-repeat 8px 9px;
 
}
 
 
#header #header-inner #quick ul ul 
 
{
 
    top: auto;
 
}   
 
 
#header #header-inner #quick li ul ul 
 
{
 
    right: 200px;
 
    max-height: 275px;
 
    overflow: auto;
 
    overflow-x: hidden;
 
    white-space:nowrap;    
 
}
 
 
#header #header-inner #quick li:hover ul ul, 
 
#header #header-inner #quick li:hover ul ul ul, 
 
#header #header-inner #quick li:hover ul ul ul ul 
 
{
 
    display: none;
 
}
 
 
#header #header-inner #quick li:hover ul, 
 
#header #header-inner #quick li li:hover ul, 
 
#header #header-inner #quick li li li:hover ul, 
 
#header #header-inner #quick li li li li:hover ul
 
{
 
    display: block;
 
}
 
 
 
/*ICONS*/
 
#header #header-inner #quick li ul li a.journal,
 
#header #header-inner #quick li ul li a.journal:hover
 
{
 
    background:url("../images/icons/book.png") no-repeat scroll 4px 9px #FFFFFF;
 
    margin:0;
 
    padding:12px 9px 7px 24px;
 
    width:167px;
 
 
}
 
 
#header #header-inner #quick li ul li a.repos,
 
#header #header-inner #quick li ul li a.repos:hover
 
{
 
    background:url("../images/icons/folder_edit.png") no-repeat scroll 4px 9px #FFFFFF;
 
    margin:0;
 
    padding:12px 9px 7px 24px;
 
    width:167px;
 
 
}
 
#header #header-inner #quick li ul li a.users,
 
#header #header-inner #quick li ul li a.users:hover
 
{
 
    background: #FFFFFF url("../images/icons/user_edit.png") no-repeat 4px 9px;
 
    margin:0;
 
    padding:12px 9px 7px 24px;
 
    width:167px;    
 
}
 
#header #header-inner #quick li ul li a.settings,
 
#header #header-inner #quick li ul li a.settings:hover
 
{
 
    background: #FFFFFF url("../images/icons/cog.png") no-repeat 4px 9px;
 
    margin:0;
 
    padding:12px 9px 7px 24px;
 
    width:167px;        
 
}
 
 
#header #header-inner #quick li ul li a.permissions,
 
#header #header-inner #quick li ul li a.permissions:hover
 
{
 
 
    background: #FFFFFF url("../images/icons/key.png") no-repeat 4px 9px;
 
    margin:0;
 
    padding:12px 9px 7px 24px;
 
    width:167px;        
 
}
 
 
#header #header-inner #quick li ul li a.branches,#header #header-inner #quick li ul li a.branches:hover
 
{
 
 
    background: #FFFFFF url("../images/icons/arrow_branch.png") no-repeat 4px 9px;
 
    margin:0;
 
    padding:12px 9px 7px 24px;
 
    width:167px;        
 
}
 
 
#header #header-inner #quick li ul li a.tags,#header #header-inner #quick li ul li a.tags:hover
 
{
 
 
    background: #FFFFFF url("../images/icons/tag_blue.png") no-repeat 4px 9px;
 
    margin:0;
 
    padding:12px 9px 7px 24px;
 
    width:167px;        
 
}
 
/* -----------------------------------------------------------
 
	header corners
 
----------------------------------------------------------- */ 
 
 
#header #header-inner div.corner
 
{
 
	height: 6px;
 
	width: 6px;
 
	position: absolute;
 
	background: url("../images/colors/blue/header_inner_corners.png") no-repeat;
 
}
 
 
#header #header-inner div.tl
 
{
 
	top: 0;
 
	left: 0;
 
    background-position: 0 0;
 
}
 
 
#header #header-inner div.tr
 
{
 
	top: 0;
 
	right: 0;
 
    background-position: -6px 0;
 
}
 
 
/* -----------------------------------------------------------
 
	content
 
----------------------------------------------------------- */ 
 
 
#content 
 
{
 
	margin: 10px 0 0 0;
 
	padding: 0;
 
    min-height: 100%;
 
	clear: both;
 
	overflow: hidden;
 
	background: url("../images/content.png") repeat-y top left;	
 
}
 
 
/* -----------------------------------------------------------
 
	content -> left
 
----------------------------------------------------------- */ 
 
 
#content #left
 
{
 
	left: 0;
 
	width: 280px;
 
	position: absolute;
 
}
 
 
/* -----------------------------------------------------------
 
	content -> left -> menu
 
----------------------------------------------------------- */ 
 
 
#content #left #menu
 
{
 
	margin: 5px 10px 0 60px;
 
	padding: 0;
 
	clear: both;
 
	overflow: hidden;
 
}
 
 
/* -----------------------------------------------------------
 
	content -> left -> menu / heading
 
----------------------------------------------------------- */ 
 
 
#content #left #menu h6
 
{
 
	margin: 5px 0 0 0;
 
	padding: 0;
 
	clear: both;
 
	overflow: hidden;
 
	background: #dfdfdf url("../images/menu.png") repeat-x;
 
	color: #6e6e6e;
 
}
 
 
#content #left #menu h6 a
 
{
 
	margin: 0;
 
	padding: 0;
 
	height: 1%;
 
	display: block;
 
    clear: both;
 
    overflow: hidden;
 
	background: url("../images/menu_l.png") no-repeat top left;
 
	color: #6e6e6e;
 
	text-decoration: none;
 
}
 
 
#content #left #menu h6 span
 
{
 
	margin: 0;
 
	padding: 9px 10px 10px 10px;
 
	height: 1%;
 
	display: block;
 
	background: url("../images/menu_r.png") no-repeat top right;
 
}
 
 
#content #left #menu h6.selected
 
{
 
	background: #00376e url("../images/colors/blue/menu_selected.png") repeat-x;
 
	color: #FFFFFF;
 
}
 
 
#content #left #menu h6.selected a
 
{
 
	background: url("../images/colors/blue/menu_l_selected.png") no-repeat top left;
 
	color: #ffffff;
 
}
 
 
#content #left #menu h6.selected span
 
{
 
	background: url("../images/colors/blue/menu_r_selected.png") no-repeat top right;
 
}
 
 
/* -----------------------------------------------------------
 
	content -> left -> menu / links
 
----------------------------------------------------------- */
 
 
#content #left #menu ul
 
{
 
	margin: 0;
 
	padding: 0;
 
	background: #376ea6;
 
}
 
 
#content #left #menu ul.opened
 
{
 
	display: block;	
 
}
 
 
#content #left #menu ul.closed
 
{
 
	display: none;	
 
}
 
 
#content #left #menu li
 
{
 
	margin: 0;
 
	padding: 0;
 
	clear: both;
 
	overflow: hidden;
 
	list-style: none;
 
	border-bottom: 1px solid #5f8bb7;
 
	color: #ffffff;
 
}
 
 
#content #left #menu li a
 
{
 
	margin: 0 0 0 6px;
 
	padding: 8px 0 8px 18px;
 
	height: 1%;
 
	display: block;
 
	float: left;
 
	background: url("../images/colors/colors/blue/menu_arrow.png") no-repeat 0 9px;
 
	color: #ffffff;
 
	text-decoration: none;
 
}
 
 
#content #left #menu li a:hover
 
{
 
	color: #b9dcff;
 
}
 
 
/* -----------------------------------------------------------
 
	content -> left -> menu / collapsible
 
----------------------------------------------------------- */ 
 
 
#content #left #menu li.collapsible
 
{
 
	background: url("../images/colors/blue/menu_border.png") no-repeat top left;
 
}
 
 
#content #left #menu li.collapsible a
 
{
 
	margin: 0 0 0 6px;
 
	padding: 8px 0 8px 0;
 
	height: 1%;
 
	display: block;
 
	background: transparent;
 
	float: left;
 
	font-weight: bold;
 
}
 
 
#content #left #menu li.collapsible a.plus
 
{
 
	margin: 0;
 
	padding: 8px 0 9px 24px;
 
	height: 10px;
 
	width: 10px;
 
	display: block;
 
	float: left;
 
	background: url("../images/menu_plus.png") no-repeat 5px 10px;
 
	border: none;
 
}
 
 
#content #left #menu li.collapsible a.minus
 
{
 
	margin: 0;
 
	padding: 8px 0 9px 24px;
 
	height: 10px;
 
	width: 10px;
 
	display: block;
 
	float: left;
 
	background: url("../images/menu_minus.png") no-repeat 5px 10px;
 
	border: none;
 
}
 
 
#content #left #menu li ul
 
{
 
	margin: 0;
 
	padding: 0;
 
	border-left: 18px solid #285889;
 
}
 
 
#content #left #menu li ul.expanded
 
{
 
	display: block;	
 
}
 
 
#content #left #menu li ul.collapsed
 
{
 
	display: none;	
 
}
 
 
#content #left #menu li ul li
 
{
 
	margin: 0;
 
	padding: 0;
 
	clear: both;
 
	overflow: hidden;
 
	list-style: none;
 
	border-bottom: 1px solid #5f8bb7;
 
	color: #ffffff;
 
}
 
 
#content #left #menu li.collapsible ul li a
 
{
 
	font-weight: normal;
 
}
 
 
#content #left #menu li.last
 
{
 
	border-bottom: none;
 
}
 
 
/* -----------------------------------------------------------
 
	content -> left -> date picker
 
----------------------------------------------------------- */ 
 
 
#content #left #date-picker
 
{
 
	margin: 10px 10px 0 60px;
 
	padding: 0;
 
	clear: both;
 
	overflow: hidden;
 
}
 
 
#content #left #date-picker .ui-datepicker  
 
{
 
	width: auto; 
 
	padding: 0; 
 
	clear: both;
 
	overflow: hidden;
 
	background: #FFFFFF; 
 
	border: 1px solid #d1d1d1; 
 
}
 
 
#content #left #date-picker .ui-datepicker .ui-datepicker-header  
 
{
 
	padding: 5px 0;
 
}
 
 
#content #left #date-picker .ui-datepicker .ui-datepicker-prev
 
{
 
	top: 5px;
 
	left: 4px;
 
}
 
 
#content #left #date-picker .ui-datepicker .ui-datepicker-next  
 
{
 
	top: 5px;
 
	right: 4px;
 
}
 
 
#content #left #date-picker .ui-datepicker .ui-datepicker-prev-hover
 
{
 
	top: 5px;
 
	left: 4px;
 
}
 
 
#content #left #date-picker .ui-datepicker .ui-datepicker-next-hover  
 
{
 
	top: 5px;
 
	right: 4px;
 
}
 
 
/* -----------------------------------------------------------
 
	content -> right
 
----------------------------------------------------------- */ 
 
 
#content #right
 
{
 
	margin: 0 60px 10px 290px;
 
}
 
 
/* -----------------------------------------------------------
 
	content -> right -> box
 
----------------------------------------------------------- */
 
 
#content div.box
 
{
 
	margin: 0 0 10px 0;
 
	padding: 0 0 10px 0;
 
	clear: both;
 
	overflow: hidden;
 
	background: #ffffff;
 
}
 
 
#content div.box-left
 
{
 
	margin: 0 0 10px;
 
	width: 49%;
 
	clear: none;
 
	float: left;	
 
}
 
 
#content div.box-right
 
{
pylons_app/templates/admin/admin_log.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
%if c.users_log:
 
<table>
 
	<tr>
 
		<th class="left">${_('Username')}</th>
 
		<th class="left">${_('Repository')}</th>
 
		<th class="left">${_('Action')}</th>
 
		<th class="left">${_('Date')}</th>
 
		<th class="left">${_('From IP')}</th>
 
	</tr>
 

	
 
	%for cnt,l in enumerate(c.users_log):
 
	<tr class="parity${cnt%2}">
 
		<td>${l.user.username}</td>
 
		<td>${l.repository}</td>
 
		<td>${h.link_to(l.user.username,h.url('edit_user', id=l.user.user_id))}</td>
 
		<td>${h.link_to(l.repository,h.url('summary_home',repo_name=l.repository))}</td>
 
		<td>${l.action}</td>
 
		<td>${l.action_date}</td>
 
		<td>${l.user_ip}</td>
 
	</tr>
 
	%endfor
 
</table>
 

	
 
<script type="text/javascript">
 
  var data_div = 'user_log';
 
  YAHOO.util.Event.onDOMReady(function(){
 
	YAHOO.util.Event.addListener(YAHOO.util.Dom.getElementsByClassName('pager_link'),"click",function(){
 
			YAHOO.util.Dom.setStyle('shortlog_data','opacity','0.3');});});
 
</script>
 
		
 
		
 
<div class="pagination-wh pagination-left">
 
${c.users_log.pager('$link_previous ~2~ $link_next',
 
onclick="""YAHOO.util.Connect.asyncRequest('GET','$partial_url',{
 
success:function(o){YAHOO.util.Dom.get(data_div).innerHTML=o.responseText;
 
YAHOO.util.Event.addListener(YAHOO.util.Dom.getElementsByClassName('pager_link'),"click",function(){
 
		YAHOO.util.Dom.setStyle(data_div,'opacity','0.3');});		
 
YAHOO.util.Dom.setStyle(data_div,'opacity','1');}},null); return false;""")}
 
</div>
 
%else: 
 
	${_('No actions yet')} 
 
%endif
pylons_app/templates/base/base.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" id="mainhtml">
 
<head>
 
    <title>${next.title()}</title>
 
    <link rel="icon" href="/images/hgicon.png" type="image/png" />
 
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 
    <meta name="robots" content="index, nofollow"/>
 
    <!-- stylesheets -->
 
    ${self.css()}
 
    <!-- scripts -->
 
    ${self.js()}
 
</head>
 
<body>
 
    <!-- header -->
 
    <div id="header">
 
        <!-- user -->
 
        <ul id="logged-user">
 
            <li class="first">
 
	            <div class="gravatar">
 
	            	<img alt="gravatar" src="${h.gravatar_url(c.hg_app_user.email,24)}" />
 
	            </div>
 
	            <div class="account">
 
	            	${h.link_to('%s %s'%(c.hg_app_user.name,c.hg_app_user.lastname),h.url('admin_settings_my_account'))}<br/>
 
	            	${h.link_to(c.hg_app_user.username,h.url('admin_settings_my_account'))}
 
	            </div>	
 
            </li>
 
            <li class="last highlight">${h.link_to(u'Logout',h.url('logout_home'))}</li>
 
        </ul>
 
        <!-- end user -->
 
        <div id="header-inner">
 
            <div id="home">
 
                <a href="${h.url('hg_home')}"></a>
 
            </div>
 
            <!-- logo -->
 
            <div id="logo">
 
                <h1><a href="${h.url('hg_home')}">${c.hg_app_name}</a></h1>
 
            </div>
 
            <!-- end logo -->
 
            <!-- quick menu -->
 
            ${self.page_nav()}
 
            <!-- end quick -->
 
            <div class="corner tl"></div>
 
            <div class="corner tr"></div>
 
        </div>
 
    </div>     
 
    <!-- end header -->
 
    
 
	<!-- CONTENT -->
 
	<div id="content"> 
 
        <div class="flash_msg">
 
            <% messages = h.flash.pop_messages() %>
 
            % if messages:
 
            <ul id="flash-messages">
 
                % for message in messages:
 
                <li class="${message.category}_msg">${message}</li>
 
                % endfor
 
            </ul>
 
            % endif
 
        </div>	    
 
	    <div id="main"> 
 
	        ${next.main()}
 
	    </div>
 
	</div> 
 
    <!-- END CONTENT -->
 

	
 
	<!-- footer -->
 
	<div id="footer">
 
	    <p>Hg App ${c.hg_app_version} &copy; 2010 by Marcin Kuzminski</p>
 
        <script type="text/javascript">${h.tooltip.activate()}</script>	    
 
	</div>
 
	<!-- end footer -->
 
</body>
 

	
 
</html>
 

	
 
### MAKO DEFS ### 
 
<%def name="page_nav()">
 
	${self.menu()}
 
</%def>
 

	
 
<%def name="menu(current=None)">
 
		<% 
 
		def is_current(selected):
 
			if selected == current:
 
				return h.literal('class="current"')
 
		%>
 
		%if current not in ['home','admin']:           		
 
		   ##REGULAR MENU            
 
	        <ul id="quick">
 
				<!-- repo switcher -->
 
				<li>
 
					<a id="repo_switcher" title="${_('Switch repository')}" href="#">
 
                    <span class="icon">
 
                        <img src="/images/icons/database.png" alt="${_('Products')}" />
 
                    </span>
 
                    <span>&darr;</span>					
 
					</a>
 
					<ul class="repo_switcher">
 
                        %for repo in c.repo_switcher_list:
 
                            <li>${h.link_to(repo,h.url('summary_home',repo_name=repo))}</li>
 
                        %endfor					
 
					</ul>			
 
				</li>
 
				
 
	            <li ${is_current('summary')}>
 
	               <a title="${_('Summary')}" href="${h.url('summary_home',repo_name=c.repo_name)}">
 
	               <span class="icon">
 
	                   <img src="/images/icons/clipboard_16.png" alt="${_('Summary')}" />
 
	               </span>
 
	               <span>${_('Summary')}</span>                 
 
	               </a>	            
 
	            </li>
 
                <li ${is_current('shortlog')}>
 
                   <a title="${_('Shortlog')}" href="${h.url('shortlog_home',repo_name=c.repo_name)}">
 
                   <span class="icon">
 
                       <img src="/images/icons/application_double.png" alt="${_('Shortlog')}" />
 
                   </span>
 
                   <span>${_('Shortlog')}</span>                 
 
                   </a>             
 
                </li>	            
 
                <li ${is_current('changelog')}>
 
                   <a title="${_('Changelog')}" href="${h.url('changelog_home',repo_name=c.repo_name)}">
 
                   <span class="icon">
 
                       <img src="/images/icons/time.png" alt="${_('Changelog')}" />
 
                   </span>
 
                   <span>${_('Changelog')}</span>                 
 
                   </a>             
 
                </li>   	
 
                
 
                <li ${is_current('switch_to')}>
 
                   <a title="${_('Switch to')}" href="#">
 
                   <span class="icon">
 
                       <img src="/images/icons/arrow_switch.png" alt="${_('Switch to')}" />
 
                   </span>
 
                   <span>${_('Switch to')}</span>                 
 
                   </a>    
 
                    <ul>
 
                        <li>
 
                            ${h.link_to(_('branches'),h.url('branches_home',repo_name=c.repo_name),class_='branches childs')}
 
                            <ul>
 
						        %for cnt,branch in enumerate(c.repository_branches.items()):
 
						            <li>${h.link_to('%s - %s' % (branch[0],branch[1]),h.url('files_home',repo_name=c.repo_name,revision=branch[1]))}</li>
 
						        %endfor
 
                            </ul>                        
 
                        </li>
 
                        <li>
 
                            ${h.link_to(_('tags'),h.url('tags_home',repo_name=c.repo_name),class_='tags childs')}
 
                            <ul>
 
                                %for cnt,tag in enumerate(c.repository_tags.items()):
 
                                 <li>${h.link_to('%s - %s' % (tag[0],tag[1]),h.url('files_home',repo_name=c.repo_name,revision=tag[1]))}</li>
 
                                %endfor
 
                            </ul>                        
 
                        </li>                        
 
                    </ul>
 
                </li>
 
                <li ${is_current('files')}>
 
                   <a title="${_('Files')}" href="${h.url('files_home',repo_name=c.repo_name)}">
 
                   <span class="icon">
 
                       <img src="/images/icons/file.png" alt="${_('Files')}" />
 
                   </span>
 
                   <span>${_('Files')}</span>                 
 
                   </a>             
 
                </li>                            
 
				%if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
 
                <li ${is_current('settings')}>
 
                   <a title="${_('Settings')}" href="${h.url('repo_settings_home',repo_name=c.repo_name)}">
 
                   <span class="icon">
 
                       <img src="/images/icons/cog_edit.png" alt="${_('Settings')}" />
 
                   </span>
 
                   <span>${_('Settings')}</span>                 
 
                   </a>             
 
                </li>				
 
				%endif					        
 
	        </ul>
 
		%else:
 
		    ##ROOT MENU
 
            <ul id="quick">
 
                <li>
 
                    <a title="${_('Home')}"  href="${h.url('hg_home')}">
 
                    <span class="icon">
 
                        <img src="/images/icons/home_16.png" alt="${_('Home')}" />
 
                    </span>
 
                    <span>${_('Home')}</span>                 
 
                    </a>        
 
                </li>
 
                
 
                <li>
 
                    <a title="${_('Search')}"  href="${h.url('search')}">
 
                    <span class="icon">
 
                        <img src="/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 title="${_('Admin')}" href="${h.url('admin_home')}">
 
                   <span class="icon">
 
                       <img src="/images/icons/cog_edit.png" alt="${_('Admin')}" />
 
                   </span>
 
                   <span>${_('Admin')}</span>                 
 
                   </a>    
 
				    <ul>
 
				        <li>${h.link_to(_('journal'),h.url('admin_home'),class_='journal')}</li>
 
				        <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li>
 
				        <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li>
 
				        <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li>
 
				        <li class="last">${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</li>        
 
				    </ul>
 
                </li>
 
				%endif
 
				
 
			</ul>
 
		%endif    
 
</%def>
 

	
 

	
 
<%def name="css()">
 
<link rel="stylesheet" type="text/css" href="/css/reset.css" />
 
<link rel="stylesheet" type="text/css" href="/css/style.css" media="screen" />
 
<link id="color" rel="stylesheet" type="text/css" href="/css/colors/blue.css" />
 
<link rel="stylesheet" type="text/css" href="/css/pygments.css"  />
 
<link rel="stylesheet" type="text/css" href="/css/diff.css"  />
 
</%def>
 

	
 
<%def name="js()">
 
##<script type="text/javascript" src="/js/yui/utilities/utilities.js"></script>
 
##<script type="text/javascript" src="/js/yui/container/container.js"></script>
 
##<script type="text/javascript" src="/js/yui/datasource/datasource.js"></script>
 
##<script type="text/javascript" src="/js/yui/autocomplete/autocomplete.js"></script>
 

	
 
<script type="text/javascript" src="/js/yui2.js"></script>
 
<!--[if IE]><script language="javascript" type="text/javascript" src="/js/excanvas.min.js"></script><![endif]-->
 
<script type="text/javascript" src="/js/yui.flot.js"></script>
 
</%def>
 

	
 
<%def name="breadcrumbs()">
 
    <div class="breadcrumbs">
 
    ${self.breadcrumbs_links()}
 
    </div>
 
</%def>
 
\ No newline at end of file
0 comments (0 inline, 0 general)