Ignore:
Timestamp:
21 Nov 2014, 05:08:19 (10 years ago)
Author:
Henrik Bettermann
Message:

Add more customer document components.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py

    r12015 r12016  
    752752    grok.name('index')
    753753    grok.require('waeup.viewCustomer')
     754    grok.template('documentpage')
    754755    form_fields = grok.AutoFields(ICustomerDocument)
    755756    pnav = 4
     
    768769    grok.context(ICustomerDocument)
    769770    grok.name('manage')
    770     grok.require('waeup.viewCustomer')
     771    grok.require('waeup.manageCustomer')
    771772    form_fields = grok.AutoFields(ICustomerDocument)
    772773    pnav = 4
     
    778779            'b':self.context.document_id})
    779780        return self.context.document_id
     781
     782    @action(_('Save'), style='primary')
     783    def save(self, **data):
     784        msave(self, **data)
     785        return
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/documentsmanagepage.pt

    r12015 r12016  
    77      <th>&nbsp;</th>
    88      <th i18n:translate="">Document Id</th>
     9      <th i18n:translate="">Title</th>
    910    </tr>
    1011    </thead>
     
    1718         tal:condition="python: not view.unremovable(cl)" />
    1819        </td>
    19         <td> <a tal:attributes="href python: view.url(cl)">
    20         <span tal:content="cl/document_id">PDID</span></a></td>
     20        <td>
     21          <a tal:attributes="href python: view.url(cl)">
     22          <span tal:content="cl/document_id">DOCID</span></a>
     23        </td>
     24        <td>
     25          <span tal:content="cl/title">TITLE</span>
     26        </td>
    2127      </tr>
    2228    </tbody>
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12015 r12016  
    790790        document = self.customer['documents']['d102']
    791791
     792        # Document can be edited
     793        self.browser.getLink("d102").click()
     794        self.browser.getLink("Manage").click()
     795        self.browser.getControl(name="form.title").value = 'My second doc'
     796        self.browser.getControl("Save").click()
     797        self.assertTrue('Form has been saved.' in self.browser.contents)
     798        self.browser.getLink("View").click()
     799        self.assertEqual(self.browser.url, self.documents_path + '/d102/index')
     800
    792801        # Documents can be removed
     802        self.browser.getLink("Documents").click()
    793803        ctrl = self.browser.getControl(name='val_id')
    794804        ctrl.getControl(value=document.document_id).selected = True
     
    802812
    803813        self.assertTrue(
     814            'INFO - zope.mgr - customers.browser.DocumentManageFormPage '
     815            '- K1000000 - saved: title'
     816            in logcontent)
     817
     818        self.assertTrue(
    804819            'INFO - zope.mgr - customers.browser.DocumentAddFormPage '
    805820            '- K1000000 - added: Generic Document %s'
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py

    r12015 r12016  
    2727from waeup.ikoba.customers.interfaces import (
    2828    ICustomer, ICustomersContainer,
    29     ICustomerDocumentsContainer)
     29    ICustomerDocumentsContainer, ICustomerDocument)
    3030from waeup.ikoba.customers.browser import (
    3131    CustomersContainerPage, CustomersContainerManagePage,
    3232    CustomerBaseDisplayFormPage,
    33     DocumentsManageFormPage)
     33    DocumentsManageFormPage, DocumentDisplayFormPage, DocumentManageFormPage)
    3434
    3535grok.context(IIkobaObject)  # Make IIkobaObject the default context
     
    266266    target = 'edit_base'
    267267
     268
    268269class CustomerPasswordActionButton(ManageActionButton):
    269270    grok.order(2)
     
    274275    text = _('Change password')
    275276    target = 'changepassword'
     277
    276278
    277279class CustomerPassportActionButton(ManageActionButton):
     
    295297    text = _('Add document')
    296298    target = 'adddoc'
     299
     300
     301class DocumentManageActionButton(ManageActionButton):
     302    grok.order(1)
     303    grok.context(ICustomerDocument)
     304    grok.view(DocumentDisplayFormPage)
     305    grok.require('waeup.manageCustomer')
     306    text = _('Manage')
     307    target = 'manage'
     308
     309class DocumentViewActionButton(ManageActionButton):
     310    grok.order(1)
     311    grok.context(ICustomerDocument)
     312    grok.view(DocumentManageFormPage)
     313    grok.require('waeup.manageCustomer')
     314    text = _('View')
     315    target = 'index'
     316    icon = 'actionicon_view.png'
Note: See TracChangeset for help on using the changeset viewer.