Changeset 12527


Ignore:
Timestamp:
31 Jan 2015, 07:13:52 (10 years ago)
Author:
Henrik Bettermann
Message:

Rearrange some pages for customers.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers
Files:
3 edited

Legend:

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

    r12526 r12527  
    3838    IContactForm, IObjectHistory, IIkobaObject, IIkobaUtils,
    3939    IPasswordValidator, IUserAccount,
    40     VERIFIED, REJECTED, EXPIRED, CREATED, REQUESTED, APPROVED, PROVISIONALLY)
     40    STARTED, VERIFIED, REJECTED, EXPIRED, CREATED, REQUESTED,
     41    APPROVED, PROVISIONALLY)
    4142from waeup.ikoba.browser.layout import (
    4243    IkobaPage, IkobaEditFormPage, IkobaAddFormPage, IkobaDisplayFormPage,
     
    389390        return grok.AutoFields(
    390391            self.context.form_fields_interface).omit(
    391             'customer_id', 'adm_code', 'suspended')
     392            'customer_id', 'suspended')
    392393
    393394    def update(self):
     
    673674        return
    674675
     676# Pages for customers
    675677
    676678class CustomerFilesUploadPage(IkobaPage):
     
    680682    """
    681683    grok.context(ICustomer)
    682     grok.name('change_portrait')
     684    grok.name('upload_files')
    683685    grok.require('waeup.handleCustomer')
    684686    grok.template('filesuploadpage')
    685     label = _('Change portrait')
     687    label = _('Upload files')
    686688    pnav = 4
    687689
     
    689691        CUSTMANAGE_STATES = getUtility(
    690692            ICustomersUtils).CUSTMANAGE_CUSTOMER_STATES
    691         if self.context.customer.state not in CUSTMANAGE_STATES:
     693        if self.context.state not in CUSTMANAGE_STATES:
    692694            emit_lock_message(self)
    693695            return
     
    698700        return
    699701
    700 # Pages for customers
    701 
    702702
    703703class CustomerBaseEditFormPage(IkobaEditFormPage):
     
    708708    grok.require('waeup.handleCustomer')
    709709    pnav = 4
     710
     711    def is_requestable(self, action=None):
     712        if self.context.state == STARTED:
     713            return True
     714        return False
    710715
    711716    @property
     
    717722    @property
    718723    def form_fields(self):
    719         if self.context.state in (REQUESTED, PROVISIONALLY, APPROVED):
     724        if not self.is_requestable():
    720725            return grok.AutoFields(ICustomer).select('email', 'phone')
    721726        return grok.AutoFields(ICustomer).omit(
     
    727732        return
    728733
    729     def is_requestable(self, action=None):
    730         if self.context.state in (REQUESTED, PROVISIONALLY, APPROVED):
    731             return False
    732         return True
    733 
    734     @action(_('Request registration now'),
     734    @action(_('Save and request registration now'),
    735735            warning=WARNING_CUST, condition=is_requestable)
    736736    def finalsubmit(self, **data):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12526 r12527  
    620620            '...You logged in...', self.browser.contents)
    621621        # Admitted customer can upload a passport picture
    622         self.browser.getLink("Change portrait").click()
     622        self.browser.getLink("Upload files").click()
    623623        ctrl = self.browser.getControl(name='passporteditupload')
    624624        file_obj = open(SAMPLE_IMAGE, 'rb')
     
    644644        self.browser.getLink("Edit").click()
    645645        self.browser.getControl(name="form.email").value = 'new_email@aa.ng'
    646         self.browser.getControl("Save").click()
     646        self.browser.getControl("Save", index=1).click()
    647647        self.assertMatches('...Form has been saved...',
    648648                           self.browser.contents)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py

    r12500 r12527  
    300300    grok.view(CustomerBaseDisplayFormPage)
    301301    grok.require('waeup.handleCustomer')
    302     icon = 'actionicon_portrait.png'
    303     text = _('Change portrait')
    304     target = 'change_portrait'
     302    icon = 'actionicon_up.png'
     303    text = _('Upload files')
     304    target = 'upload_files'
    305305
    306306    @property
Note: See TracChangeset for help on using the changeset viewer.