Changeset - 2a95d54b19e6
[Not reviewed]
default
0 3 0
Marcin Kuzminski - 15 years ago 2010-09-03 16:18:18
marcin@python-works.com
reimplemented tags/branches menu.
some css fixes as well for menus
3 files changed with 116 insertions and 50 deletions:
0 comments (0 inline, 0 general)
pylons_app/lib/base.py
Show inline comments
 
"""The base Controller API
 

	
 
Provides the BaseController class for subclassing.
 
"""
 
from pylons import config, tmpl_context as c, request, session
 
from pylons.controllers import WSGIController
 
from pylons.templating import render_mako as render
 
from pylons_app import __version__
 
from pylons_app.lib import auth
 
from pylons_app.lib.utils import get_repo_slug
 
from pylons_app.model import meta
 
from pylons_app.model.hg_model import _get_repos_cached, \
 
    _get_repos_switcher_cached
 

	
 
class BaseController(WSGIController):
 
    
 
    def __before__(self):
 
        c.hg_app_version = __version__
 
        c.hg_app_name = config['hg_app_title']
 
        c.repo_name = get_repo_slug(request)
 
        c.cached_repo_list = _get_repos_cached()
 
        c.repo_switcher_list = _get_repos_switcher_cached(c.cached_repo_list)
 
        
 
        if c.repo_name:
 
            c.repository_tags = c.cached_repo_list[c.repo_name].tags
 
            c.repository_branches = c.cached_repo_list[c.repo_name].branches
 
                    
 
        self.sa = meta.Session
 
    
 
    def __call__(self, environ, start_response):
 
        """Invoke the Controller"""
 
        # WSGIController.__call__ dispatches to the Controller method
 
        # the request is routed to. This routing information is
 
        # available in environ['pylons.routes_dict']
 
        try:
 
            #putting this here makes sure that we update permissions every time
 
            c.hg_app_user = auth.get_user(session)
 
            return WSGIController.__call__(self, environ, start_response)
 
        finally:
 
            meta.Session.remove()
pylons_app/public/css/style.css
Show inline comments
 
@@ -302,223 +302,273 @@ div.options a:hover
 
 
#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 4px 0 0;
 
    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("../images/colors/blue/quick_l.png") no-repeat top left;
 
    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("../images/colors/blue/quick_r.png") no-repeat top right;
 
    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("../images/colors/blue/quick_l.png") no-repeat top left;
 
    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;
 
    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("../images/colors/blue/quick_r_selected.png") no-repeat top right;
 
    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("../images/colors/blue/quick_l_selected.png") no-repeat top left;
 
    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 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.repos,#header #header-inner #quick li ul li a.repos:hover
 
{
 
	margin: 0;
 
	padding: 12px 9px 7px 28px;
 
	width: 167px;
 
	background: #FFFFFF url("../images/icons/folder_edit.png") no-repeat 8px 9px;
 
}
 
#header #header-inner #quick li ul li a.users,#header #header-inner #quick li ul li a.users:hover
 
{
 
	margin: 0;
 
	padding: 12px 9px 7px 28px;
 
	width: 167px;
 
	background: #FFFFFF url("../images/icons/user_edit.png") no-repeat 8px 9px;
 
}
 
#header #header-inner #quick li ul li a.settings,#header #header-inner #quick li ul li a.settings:hover
 
{
 
	margin: 0;
 
	padding: 12px 9px 7px 28px;
 
	width: 167px;
 
	background: #FFFFFF url("../images/icons/cog.png") no-repeat 8px 9px;
 
}
 
 
#header #header-inner #quick li ul li a.permissions,#header #header-inner #quick li ul li a.permissions:hover
 
{
 
	margin: 0;
 
	padding: 12px 9px 7px 28px;
 
	width: 167px;
 
	background: #FFFFFF url("../images/icons/key.png") no-repeat 8px 9px;
 
}
 

	
 
#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;
 
}
 

	
 
#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.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;
pylons_app/templates/base/base.html
Show inline comments
 
@@ -131,63 +131,74 @@
 
	            <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('branches')}>
 
                   <a title="${_('Branches')}" href="${h.url('branches_home',repo_name=c.repo_name)}">
 
                
 
                <li ${is_current('switch_to')}>
 
                   <a title="${_('Switch to')}" href="#">
 
                   <span class="icon">
 
                       <img src="/images/icons/arrow_branch.png" alt="${_('Branches')}" />
 
                       <img src="/images/icons/arrow_switch.png" alt="${_('Switch to')}" />
 
                   </span>
 
                   <span>${_('Branches')}</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 ${is_current('tags')}>
 
                   <a title="${_('Tags')}" href="${h.url('tags_home',repo_name=c.repo_name)}">
 
                   <span class="icon">
 
                       <img src="/images/icons/tag_blue.png" alt="${_('Tags')}" />
 
                   </span>
 
                   <span>${_('Tags')}</span>                 
 
                   </a>             
 
                        <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>
 
@@ -199,49 +210,49 @@
 
                    </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(_('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>${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</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>
 
<!--[if IE]><script language="javascript" type="text/javascript" src="/js/excanvas.min.js"></script><![endif]-->
 
<script type="text/javascript" src="/js/yui/container/container-min.js"></script>
 
<script type="text/javascript" src="/js/yui/datasource/datasource-min.js"></script>
 
<script type="text/javascript" src="/js/yui/autocomplete/autocomplete-min.js"></script>
 
<script type="text/javascript" src="/js/yui.flot.js"></script>
0 comments (0 inline, 0 general)