Ignore:
Timestamp:
16 Jan 2012, 07:06:21 (13 years ago)
Author:
Henrik Bettermann
Message:

Redirect to specified tabs using the request's QUERY_STRING value. This suboptimal solution will be replaced later by a pure Javascript solution.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/applicants
Files:
3 edited

Legend:

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

    r7467 r7484  
    116116        if len(deleted):
    117117            self.flash('Successfully removed: %s' % ', '.join(deleted))
    118         self.redirect(self.url(self.context, '@@manage')+'#tab-1')
     118        self.redirect(self.url(self.context, '@@manage'))
    119119        return
    120120
     
    131131    @action('Add local role', validator=NullValidator)
    132132    def addLocalRole(self, **data):
    133         return add_local_role(self,2, **data)
     133        return add_local_role(self,3, **data)
    134134
    135135    @action('Remove selected local roles')
    136136    def delLocalRoles(self, **data):
    137         return del_local_roles(self,2,**data)
     137        return del_local_roles(self,3,**data)
    138138
    139139class ApplicantsContainerAddFormPage(SIRPAddFormPage):
     
    173173        self.context[code] = container
    174174        self.flash('Added: "%s".' % code)
    175         self.redirect(self.url(self.context, u'@@manage')+'#tab-1')
     175        self.redirect(self.url(self.context, u'@@manage'))
    176176        return
    177177
    178178    @action('Cancel', validator=NullValidator)
    179179    def cancel(self, **data):
    180         self.redirect(self.url(self.context, '@@manage') + '#tab-1')
     180        self.redirect(self.url(self.context, '@@manage'))
    181181
    182182class ApplicantsRootBreadcrumb(Breadcrumb):
     
    252252        datepicker.need() # Enable jQuery datepicker in date fields.
    253253        tabs.need()
     254        self.tab1 = self.tab2 = self.tab3 = ''
     255        qs = self.request.get('QUERY_STRING', '')
     256        if not qs:
     257            qs = 'tab1'
     258        setattr(self, qs, 'active')
    254259        warning.need()
    255260        datatable.need()  # Enable jQurey datatables for contents listing
     
    283288        else:
    284289            self.flash('No applicant selected!')
    285             self.redirect(self.url(self.context, '@@manage')+'#tab-2')
     290            self.redirect(self.url(self.context, '@@manage')+'?tab2')
    286291            return
    287292        if not isinstance(child_id, list):
     
    297302        if len(deleted):
    298303            self.flash('Successfully removed: %s' % ', '.join(deleted))
    299         self.redirect(self.url(self.context, u'@@manage')+'#tab-2')
     304        self.redirect(self.url(self.context, u'@@manage')+'?tab2')
    300305        return
    301306
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantscontainermanagepage.pt

    r7477 r7484  
    22
    33  <ul class="tabs" data-tabs="tabs">
    4     <li class="active">
     4    <li tal:attributes="class view/tab1">
    55    <a href="#tab-1">
    66      <span>Settings
    77      </span></a>
    88    </li>
    9     <li>
     9    <li tal:attributes="class view/tab2">
    1010    <a href="#tab-2">
    1111      <span>Applicants
    1212      </span></a>
    1313    </li>
    14     <li>
     14    <li tal:attributes="class view/tab3">
    1515    <a href="#tab-3">
    1616      <span>Local Roles
     
    1919  </ul>
    2020  <div class="tab-content">
    21     <div id="tab-1" class="active">
     21    <div id="tab-1" tal:attributes="class view/tab1">
    2222      <table class="form-table">
    2323        <tbody>
     
    5353      </div>
    5454    </div>
    55     <div id="tab-2"> <h3>Applicants</h3>
     55    <div id="tab-2" tal:attributes="class view/tab2"> <h3>Applicants</h3>
    5656      <table class="display dataTableManage">
    5757        <thead>
     
    100100      </div>
    101101    </div>
    102     <div id="tab-3"> <br />
     102    <div id="tab-3" tal:attributes="class view/tab3"> <br />
    103103      <table class="display dataTableManage">
    104104        <thead>
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py

    r7436 r7484  
    254254        self.browser.open(self.add_container_path)
    255255        self.browser.getControl("Cancel").click()
    256         self.assertEqual(self.browser.url, self.manage_root_path + '#tab-1')
     256        self.assertEqual(self.browser.url, self.manage_root_path)
    257257        self.browser.open(self.add_container_path)
    258258        self.browser.getControl(name="form.prefix").value = ['app']
Note: See TracChangeset for help on using the changeset viewer.