Author: matevz
Date: Tue Mar 12 10:59:02 2013
New Revision: 1455481
URL: http://svn.apache.org/r1455481
Log:
#326 - Multiproduct UI: Breadcrumbs (roadmap/milestone breadcrumbs)
Added:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_path_general.html
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/web_ui.py
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/theme.py
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/web_ui.py
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/web_ui.py?rev=1455481&r1=1455480&r2=1455481&view=diff
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/web_ui.py
(original)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/web_ui.py
Tue Mar 12 10:59:02 2013
@@ -194,22 +194,6 @@ class ProductModule(Component):
'context': web_context(req, Resource('products', None))}
return 'product_list.html', data, None
- def add_product_link(rel, product):
- href = req.href.products(product.prefix)
- add_link(req, rel, href, _('Product "%(name)s"',
- name=product.name))
-
- idx = [i for i, p in enumerate(products) if p.name == product.name]
- if idx:
- idx = idx[0]
- if idx > 0:
- add_product_link('first', products[0])
- add_product_link('prev', products[idx - 1])
- if idx < len(products) - 1:
- add_product_link('next', products[idx + 1])
- add_product_link('last', products[-1])
- prevnext_nav(req, _('Previous Product'), _('Next Product'),
- _('Back to Product List'))
return 'product_view.html', data, None
def _render_editor(self, req, product):
Added:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_path_general.html
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_path_general.html?rev=1455481&view=auto
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_path_general.html
(added)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_path_general.html
Tue Mar 12 10:59:02 2013
@@ -0,0 +1,42 @@
+<!--!
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+
+<div xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:py="http://genshi.edgewall.org/"
+ xmlns:i18n="http://genshi.edgewall.org/i18n"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ py:strip=""
+ py:with="single_product = not product_list or len(product_list) < 2">
+ <div class="btn-group" py:strip="single_product">
+ <button class="btn btn-mini" py:strip="single_product">
+ <a title="Select product"
href="${href.products(req.perm.env.product.prefix)}">${req.perm.env.product.name}</a>
+ </button>
+ <py:if test="not single_product">
+ <button class="btn btn-mini dropdown-toggle" data-toggle="dropdown">
+ <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu">
+ <li py:for="prefix,name in product_list">
+ <a title="Product $name ($prefix)"
href="${href.products(prefix)}">$name ($prefix)</a>
+ </li>
+ </ul>
+ </py:if>
+ </div>
+</div>
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/theme.py
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/theme.py?rev=1455481&r1=1455480&r2=1455481&view=diff
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/theme.py
(original)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/theme.py
Tue Mar 12 10:59:02 2013
@@ -109,7 +109,8 @@ class BloodhoundTheme(ThemeBase):
# Ticket
'milestone_edit.html' : ('bh_milestone_edit.html', None),
'milestone_delete.html' : ('bh_milestone_delete.html', None),
- 'milestone_view.html' : ('bh_milestone_view.html',
'_modify_roadmap_css'),
+ 'milestone_view.html' : ('bh_milestone_view.html',
'_modify_roadmap_page'),
+ 'roadmap.html' : ('roadmap.html', '_add_products_general_breadcrumb'),
'query.html' : ('bh_query.html', None),
'report_delete.html' : ('bh_report_delete.html', None),
'report_edit.html' : ('bh_report_edit.html', None),
@@ -129,7 +130,7 @@ class BloodhoundTheme(ThemeBase):
'dir_entries.html' : ('bh_dir_entries.html', None),
# Multi Product
- 'product_view.html' : ('bh_product_view.html', None),
+ 'product_view.html' : ('bh_product_view.html',
'_add_products_general_breadcrumb'),
# General purpose
'about.html' : ('bh_about.html', None),
@@ -320,10 +321,12 @@ class BloodhoundTheme(ThemeBase):
if is_active:
data['resourcepath_template'] = 'bh_path_wikipage.html'
- def _modify_roadmap_css(self, req, template, data, content_type,
is_active):
- """Insert roadmap.css
+ def _modify_roadmap_page(self, req, template, data, content_type,
is_active):
+ """Insert roadmap.css + products breadcrumb
"""
add_stylesheet(req, 'dashboard/css/roadmap.css')
+ self._add_products_general_breadcrumb(req, template, data,
+ content_type, is_active)
def _modify_ticket(self, req, template, data, content_type, is_active):
"""Ticket modifications
@@ -388,6 +391,13 @@ class BloodhoundTheme(ThemeBase):
))
add_stylesheet(req, 'theme/css/browser.css')
+
+ def _add_products_general_breadcrumb(self, req, template, data,
+ content_type, is_active):
+ data['product_list'] = [(p.prefix, p.name)
+ for p in self._get_product_list(req)]
+ data['resourcepath_template'] = 'bh_path_general.html'
+
# INavigationContributor methods
def get_active_navigation_item(self, req):