Ignore:
Timestamp:
25 Mar 2010, 16:05:49 (15 years ago)
Author:
uli
Message:

Add action button and add page to create batches (add page not
finished).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/browser.py

    r5082 r5084  
    22"""
    33import grok
    4 from waeup.sirp.browser import WAeUPPage
     4from waeup.sirp.browser import WAeUPPage, WAeUPAddFormPage
    55from waeup.sirp.browser.breadcrumbs import Breadcrumb
    6 from waeup.sirp.browser.viewlets import AdminTask
     6from waeup.sirp.browser.viewlets import AdminTask, AddActionButton
    77from waeup.sirp.interfaces import IWAeUPObject
    88
     
    1818    title = 'Access Code Batches'
    1919    pnav = 0
     20
     21class AddBatchPage(WAeUPAddFormPage):
     22    grok.name('add')
     23    grok.context(IAccessCodeBatchContainer)
     24
     25    title = label = 'Create a WAeUP Scratch Card Batch'
     26    pnav = 0
     27
     28    @grok.action('Create batch')
     29    def createBatch(self, **data):
     30        self.flash('Batch created')
     31        self.redirect(self.url(self.context))
    2032
    2133class BatchContainerBreadcrumb(Breadcrumb):
     
    3547    link_title = 'Manage access-code batches'
    3648    target_viewname = 'accesscodes'
     49
     50class CreateBatchButton(AddActionButton):
     51    """Action button on batch container page which links to batch creation.
     52    """
     53    grok.context(IAccessCodeBatchContainer)
     54    grok.view(BatchContainerPage)
     55    grok.require('waeup.manageUniversity')
     56    text = 'Add Scratch Card Batch'
Note: See TracChangeset for help on using the changeset viewer.