Author: rjollos
Date: Mon Sep 30 05:00:03 2013
New Revision: 1527442

URL: http://svn.apache.org/r1527442
Log:
0.8dev: Added an //Edit// link to the prooduct list page. Refs #669.

Patch by Olemis Lang.

Modified:
    bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py
    bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_product_list.html
    bloodhound/trunk/bloodhound_theme/bhtheme/theme.py

Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py?rev=1527442&r1=1527441&r2=1527442&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py (original)
+++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py Mon Sep 30 
05:00:03 2013
@@ -37,13 +37,14 @@ class MultiProductEnvironmentFactory(Env
     def open_environment(self, environ, env_path, global_env, use_cache=False):
         environ.setdefault('SCRIPT_NAME', '')  # bh:ticket:594
 
-        env = pid = None
+        env = pid = product_path = None
         path_info = environ.get('PATH_INFO')
         if not path_info:
             return env
         m = PRODUCT_RE.match(path_info)
         if m:
             pid = m.group('pid')
+            product_path = m.group('pathinfo') or ''
 
         def create_product_env(product_prefix, script_name, path_info):
             if not global_env._abs_href:
@@ -64,11 +65,11 @@ class MultiProductEnvironmentFactory(Env
                 environ['PATH_INFO'] = path_info
             return env
 
-        if pid:
+        if pid and not (product_path in ('', '/') and 
+                        environ.get('QUERY_STRING')):
             env = create_product_env(pid,
                                      environ['SCRIPT_NAME'] + '/products/' +
-                                     pid,
-                                     m.group('pathinfo') or '')
+                                     pid, product_path)
 
         return env
 

Modified: 
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=1527442&r1=1527441&r2=1527442&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_product_list.html 
(original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_product_list.html 
Mon Sep 30 05:00:03 2013
@@ -37,7 +37,7 @@
         <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()}">
+          <form id="new" method="get" action="${href.products()}">
             <input type="hidden" name="action" value="new" />
             <input class="btn" type="submit" value="${_('Add new product')}" />
           </form>

Modified: bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1527442&r1=1527441&r2=1527442&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Mon Sep 30 05:00:03 2013
@@ -468,18 +468,26 @@ class BloodhoundTheme(ThemeBase):
                         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'}],
+                        links={'extras': (([{'href': req.href.products(
+                                                product.prefix, action='edit'),
+                                             'title': _('Edit product 
%(prefix)s',
+                                                        prefix=product.prefix),
+                                             'icon': tag.i(class_='icon-edit'),
+                                             'label': _('Edit')},]
+                                           if 'PRODUCT_MODIFY' in req.perm
+                                           else []) +
+                                          [{'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'),


Reply via email to