source: main/waeup.ikoba/trunk/src/waeup/ikoba/products/viewlets.py

Last change on this file was 12762, checked in by Henrik Bettermann, 10 years ago

Add PaymentsContainerPage? to search for and list payments (work in progress, completely untested).

  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1## $Id: viewlets.py 12762 2015-03-14 13:49:29Z henrik $
2##
3## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""Viewlet components for products offered by the company.
19"""
20
21import grok
22from waeup.ikoba.browser.viewlets import (
23    PrimaryNavTab, ManageActionButton, AddActionButton)
24from waeup.ikoba.interfaces import IIkobaObject
25from waeup.ikoba.interfaces import MessageFactory as _
26from waeup.ikoba.browser.viewlets import PrimaryNavTab
27
28from waeup.ikoba.products.interfaces import (
29    IProductsContainer, IProduct)
30from waeup.ikoba.products.browser import (
31    ProductsContainerManageFormPage, ProductsContainerPage,
32    ProductManageFormPage, ProductDisplayFormPage)
33
34
35grok.context(IIkobaObject)  # Make IIkobaObject the default context
36grok.templatedir('browser_templates')
37
38
39class ProductsTab(PrimaryNavTab):
40    """Products tab in primary navigation.
41    """
42
43    grok.context(IIkobaObject)
44    grok.order(2)
45    grok.require('waeup.Public')
46    grok.name('productstab')
47
48    pnav = 1
49    tab_title = _(u'Products')
50
51    @property
52    def link_target(self):
53        return self.view.application_url('products')
54
55class ProductsContainerManageActionButton(ManageActionButton):
56    grok.order(1)
57    grok.context(IProductsContainer)
58    grok.view(ProductsContainerPage)
59    grok.require('waeup.manageProducts')
60    text = _('Manage')
61    target = 'manage'
62
63
64class ProductViewActionButton(ManageActionButton):
65    grok.order(1)
66    grok.context(IProduct)
67    grok.view(ProductManageFormPage)
68    grok.require('waeup.manageProducts')
69    text = _('View')
70    target = 'index'
71    icon = 'actionicon_view.png'
72
73
74class ProductManageActionButton(ManageActionButton):
75    grok.order(1)
76    grok.context(IProduct)
77    grok.view(ProductDisplayFormPage)
78    grok.require('waeup.manageProducts')
79    text = _('Manage')
80    target = 'manage'
Note: See TracBrowser for help on using the repository browser.