You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by rj...@apache.org on 2013/09/17 07:34:51 UTC
svn commit: r1523898 - in /bloodhound/trunk:
bloodhound_dashboard/bhdashboard/widgets/templates/widget_media_list.html
bloodhound_theme/bhtheme/templates/bh_product_list.html
bloodhound_theme/bhtheme/theme.py
Author: rjollos
Date: Tue Sep 17 05:34:51 2013
New Revision: 1523898
URL: http://svn.apache.org/r1523898
Log:
0.8dev: Show a media list on the Products list page. Refs #562.
Patch by Olemis Lang.
Added:
bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_product_list.html
Modified:
bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_media_list.html
bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
Modified: bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_media_list.html
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_media_list.html?rev=1523898&r1=1523897&r2=1523898&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_media_list.html (original)
+++ bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_media_list.html Tue Sep 17 05:34:51 2013
@@ -24,13 +24,13 @@
<li py:for="item in items" class="media">
<a class="pull-left" href="${item.href}">
- <img class="media-object img-polaroid" src="${item.thumb}"
- width="${thumbsize or 64}" height="${thumbsize or 64}"/>
+ <img class="media-object img-polaroid" src="${item.thumb}"
+ width="${thumbsize or 64}" height="${thumbsize or 64}"/>
</a>
<div class="media-body">
<h4 class="media-heading">${item.title}</h4>
<a class="pull-right btn" href="${link.href}" title="${link.title}" style="display: inline-block"
- py:if="item.links and item.links.main" py:with="link = item.links.main">
+ py:if="item.links and item.links.main" py:with="link = item.links.main">
<span>${link.label}</span> ${link.icon}
</a>
<div xml:space="preserve" class="description">${item.description}</div>
Added: bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_product_list.html
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_product_list.html?rev=1523898&view=auto
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_product_list.html (added)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_product_list.html Tue Sep 17 05:34:51 2013
@@ -0,0 +1,48 @@
+<!--!
+ 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.
+-->
+
+<!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"
+ xmlns:py="http://genshi.edgewall.org/"
+ xmlns:i18n="http://genshi.edgewall.org/i18n"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:include href="layout.html" />
+ <head>
+ <title>Products</title>
+ </head>
+
+ <body>
+ <div id="content" class="products row">
+ <div class="span12">
+ <h1>Products</h1>
+
+ <xi:include href="widget_media_list.html" py:with="items = products"/>
+
+ <div py:if="'PRODUCT_CREATE' in perm" class="btn-group">
+ <form method="get" action="${href.products()}">
+ <input type="hidden" name="action" value="new" />
+ <input class="btn" type="submit" value="${_('Add new product')}" />
+ </form>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
Modified: bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1523898&r1=1523897&r2=1523898&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Tue Sep 17 05:34:51 2013
@@ -38,6 +38,7 @@ from trac.web.api import IRequestFilter,
from trac.web.chrome import (add_stylesheet, add_warning, INavigationContributor,
ITemplateProvider, prevnext_nav, Chrome)
from trac.wiki.admin import WikiAdmin
+from trac.wiki.formatter import format_to_html
from themeengine.api import ThemeBase, ThemeEngineSystem
@@ -132,6 +133,7 @@ class BloodhoundTheme(ThemeBase):
# Multi Product
'product_view.html': ('bh_product_view.html', '_add_products_general_breadcrumb'),
+ 'product_list.html': ('bh_product_list.html', '_modify_product_list'),
# General purpose
'about.html': ('bh_about.html', None),
@@ -440,6 +442,52 @@ class BloodhoundTheme(ThemeBase):
if isinstance(req.perm.env, ProductEnvironment):
data['resourcepath_template'] = 'bh_path_general.html'
+ def _modify_product_list(self, req, template, data, content_type,
+ is_active):
+ """Transform products list into media list by adding
+ configured product icon as well as further navigation items.
+ """
+ products = data.pop('products')
+ context = data['context']
+ with self.env.db_query as db:
+ icons = db.execute("""
+ SELECT product, value FROM bloodhound_productconfig
+ WHERE product IN (%s) AND section='project' AND
+ option='icon'""" % ', '.join(["%s"] * len(products)),
+ tuple(p.prefix for p in products))
+ icons = dict(icons)
+ data['thumbsize'] = 64
+ # FIXME: Gray icon for missing products
+ no_thumbnail = req.href('chrome/theme/img/bh.ico')
+ product_ctx = lambda item: context.child(item.resource)
+
+ def product_media_data(icons, product):
+ return dict(href=product.href(),
+ thumb=icons.get(product.prefix, no_thumbnail),
+ title=product.name,
+ description=format_to_html(self.env,
+ product_ctx(product),
+ product.description),
+ links={'extras': [{'href': product.href(),
+ 'title': 'Home page',
+ 'icon': tag.i(class_='icon-home'),
+ 'label': 'Home'},
+ {'href': product.href.dashboard(),
+ 'title': 'Tickets dashboard',
+ 'icon': tag.i(class_='icon-tasks'),
+ 'label': 'Tickets'},
+ {'href': product.href.wiki(),
+ 'title': 'Wiki',
+ 'icon': tag.i(class_='icon-book'),
+ 'label': 'Wiki'}],
+ 'main': {'href': product.href(),
+ 'title': None,
+ 'icon': tag.i(class_='icon-chevron-right'),
+ 'label': 'Browse'}})
+
+ data['products'] = [product_media_data(icons, product)
+ for product in products]
+
# INavigationContributor methods
def get_active_navigation_item(self, req):