changeset 453:2a95d54b19e6

reimplemented tags/branches menu. some css fixes as well for menus
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 03 Sep 2010 16:18:18 +0200
parents f19d3ee89335
children ffbd1808b4c8
files pylons_app/lib/base.py pylons_app/public/css/style.css pylons_app/templates/base/base.html
diffstat 3 files changed, 224 insertions(+), 158 deletions(-) [+]
line wrap: on
line diff
--- a/pylons_app/lib/base.py	Fri Sep 03 13:15:16 2010 +0200
+++ b/pylons_app/lib/base.py	Fri Sep 03 16:18:18 2010 +0200
@@ -20,6 +20,11 @@
         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):
--- a/pylons_app/public/css/style.css	Fri Sep 03 13:15:16 2010 +0200
+++ b/pylons_app/public/css/style.css	Fri Sep 03 16:18:18 2010 +0200
@@ -323,181 +323,231 @@
 /* -----------------------------------------------------------
 	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,
+#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;
-	padding: 0;
-	position: relative;
-	float: left;
+    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;
-	color: #FFFFFF;
-	font-weight: bold;
-	text-decoration: none;
+    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("../images/colors/blue/quick_r.png") no-repeat top right;
-	border-left: 1px solid #3f6f9f;
+    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("../images/colors/blue/quick_l.png") no-repeat top left;
-	border-left: none;
-	border-right: 1px solid #2e5c89;
+    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;
+    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;
-	border-left: 1px solid #545454;
+    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;
-	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;
-}
-
-#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;
+    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
+{
+    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 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;
-}
-
+    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
 ----------------------------------------------------------- */ 
--- a/pylons_app/templates/base/base.html	Fri Sep 03 13:15:16 2010 +0200
+++ b/pylons_app/templates/base/base.html	Fri Sep 03 16:18:18 2010 +0200
@@ -151,22 +151,33 @@
                    </span>
                    <span>${_('Changelog')}</span>                 
                    </a>             
-                </li>   	            
-                <li ${is_current('branches')}>
-                   <a title="${_('Branches')}" href="${h.url('branches_home',repo_name=c.repo_name)}">
+                </li>   	
+                
+                <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>                 
-                   </a>             
-                </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>             
+                   <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)}">
@@ -220,7 +231,7 @@
 				        <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