Changeset 7134


Ignore:
Timestamp:
18 Nov 2011, 10:59:42 (13 years ago)
Author:
Henrik Bettermann
Message:

Use jquery tabs in StudentBaseManageFormPage? and StudentClearanceManageFormPage? forms to separate form data and file upload widgets.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
1 added
4 edited

Legend:

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

    r7133 r7134  
    385385    def update(self):
    386386        datepicker.need() # Enable jQuery datepicker in date fields.
     387        tabs.need()
    387388        super(StudentBaseManageFormPage, self).update()
    388389        self.wf_info = IWorkflowInfo(self.context)
     
    472473    grok.name('edit_clearance')
    473474    grok.require('waeup.manageStudents')
     475    grok.template('clearanceeditpage')
    474476    form_fields = grok.AutoFields(IStudentClearance)
    475477    label = 'Manage clearance data'
    476478    title = 'Clearance Data'
    477479    pnav = 4
    478 
    479480    form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
    480481
    481482    def update(self):
    482483        datepicker.need() # Enable jQuery datepicker in date fields.
     484        tabs.need()
    483485        return super(StudentClearanceManageFormPage, self).update()
    484486
    485     @grok.action('Save (no upload)')
     487    @grok.action('Save')
    486488    def save(self, **data):
    487489        msave(self, **data)
     
    16931695    label = 'Edit clearance data'
    16941696    title = 'Clearance Data'
    1695     pnav = 4
    16961697    form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
    16971698
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/basemanagepage.pt

    r7112 r7134  
    1515  </div>
    1616
    17   <table class="form-fields zebra">
    18     <tbody>
    19       <tal:block repeat="widget view/widgets">
    20         <tr>
    21           <td class="label">
    22             <label tal:attributes="for widget/name">
    23               <span class="required" tal:condition="widget/required">*</span>
    24               <span i18n:translate="" tal:content="widget/label">label</span>:
    25             </label>
    26           </td>
    27           <td class="field">
    28             <span class="widget" tal:content="structure widget">
    29               <input type="text" />
    30             </span>
    31             <tal:error tal:condition="widget/error">
    32               <span tal:replace="structure widget/error">error</span>
    33             </tal:error>
    34             <tal:hint tal:condition="widget/hint">
    35               <span class="hint" tal:content="structure widget/hint">hint</span>
    36             </tal:hint>
    37           </td>
    38         </tr>
    39       </tal:block>
    40       <tr>
    41         <td class="label"><label>Password:</label></td>
    42         <td>
    43           <input name="password" type="password"  />
    44         </td>
    45       </tr>
    46       <tr>
    47         <td class="label"><label>Retype password:</label></td>
    48         <td>
    49           <input name="control_password" type="password" />
    50         </td>
    51       </tr>
    52       <tr>
    53         <td class="label"><label>Registration Transition:</label></td>
    54         <td>
    55           <select id="transition" name="transition">
    56             <option tal:repeat="transition view/getTransitions"
    57                     tal:attributes="value transition/name">
    58               <span tal:replace="transition/title">TRANSITIONTITLE</span>
    59             </option>
    60           </select>
    61         </td>
    62       </tr>
    63       <tal:files content="structure provider:files" />
    64     </tbody>
    65   </table>
     17  <div id="tabs">
     18    <ul>
     19      <li><a href="#tab-1"><span>Base Data</span></a></li>
     20      <li><a href="#tab-2"><span>Passport Picture</span></a></li>
     21    </ul>
    6622
    67   <div class="actionButtons" tal:condition="view/availableActions">
    68     <input tal:repeat="action view/actions"
    69            tal:replace="structure action/render"
    70            />
     23    <div id="tab-1">
     24      <table class="form-fields zebra">
     25        <tbody>
     26          <tal:block repeat="widget view/widgets">
     27            <tr>
     28              <td class="label">
     29                <label tal:attributes="for widget/name">
     30                  <span class="required" tal:condition="widget/required">*</span>
     31                  <span i18n:translate="" tal:content="widget/label">label</span>:
     32                </label>
     33              </td>
     34              <td class="field">
     35                <span class="widget" tal:content="structure widget">
     36                  <input type="text" />
     37                </span>
     38                <tal:error tal:condition="widget/error">
     39                  <span tal:replace="structure widget/error">error</span>
     40                </tal:error>
     41                <tal:hint tal:condition="widget/hint">
     42                  <span class="hint" tal:content="structure widget/hint">hint</span>
     43                </tal:hint>
     44              </td>
     45            </tr>
     46          </tal:block>
     47          <tr>
     48            <td class="label"><label>Password:</label></td>
     49            <td>
     50              <input name="password" type="password"  />
     51            </td>
     52          </tr>
     53          <tr>
     54            <td class="label"><label>Retype password:</label></td>
     55            <td>
     56              <input name="control_password" type="password" />
     57            </td>
     58          </tr>
     59          <tr>
     60            <td class="label"><label>Registration Transition:</label></td>
     61            <td>
     62              <select id="transition" name="transition">
     63                <option tal:repeat="transition view/getTransitions"
     64                        tal:attributes="value transition/name">
     65                  <span tal:replace="transition/title">TRANSITIONTITLE</span>
     66                </option>
     67              </select>
     68            </td>
     69          </tr>
     70
     71        </tbody>
     72      </table>
     73
     74      <div class="actionButtons" tal:condition="view/availableActions">
     75        <input tal:repeat="action view/actions"
     76               tal:replace="structure action/render"
     77               />
     78      </div>
     79    </div>
     80
     81    <div id="tab-2">
     82      <h2>Upload passport picture</h2>
     83      <table class="form-fields zebra">
     84        <tbody>
     85          <tal:files content="structure provider:files" />
     86        </tbody>
     87      </table>
     88    </div>
    7189  </div>
    7290</form>
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7133 r7134  
    378378        file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.jpg')
    379379        # The Save action does not upload files
    380         self.browser.getControl("Save (no upload)").click() # submit form
     380        self.browser.getControl("Save").click() # submit form
    381381        self.assertFalse(
    382382            '<a target="image" href="birth_certificate">'
     
    789789        self.browser.getLink("Edit").click()
    790790        self.browser.getControl("Save and request clearance").click()
     791       
    791792        self.browser.getControl(name="ac_series").value = self.existing_clrseries
    792793        self.browser.getControl(name="ac_number").value = self.existing_clrnumber
  • main/waeup.sirp/trunk/src/waeup/sirp/students/viewlets.py

    r7127 r7134  
    286286    grok.template('fileupload')
    287287    grok.require('waeup.uploadStudentFile')
     288    tab_redirect = ''
    288289    mus = 1024 * 150
    289290
     
    303304                download_name=self.download_name)
    304305            self.view.redirect(
    305                 self.view.url(self.context, self.view.__name__))
     306                self.view.url(
     307                    self.context, self.view.__name__) + self.tab_redirect)
    306308            return
    307309        if upload_button:
     
    312314                    self.context, self.view, self.mus, self.download_name)
    313315                self.view.redirect(
    314                     self.view.url(self.context, self.view.__name__))
     316                    self.view.url(
     317                        self.context, self.view.__name__) + self.tab_redirect)
    315318            else:
    316319                self.view.flash('No local file selected.')
    317320                self.view.redirect(
    318                     self.view.url(self.context, self.view.__name__))
     321                    self.view.url(
     322                        self.context, self.view.__name__) + self.tab_redirect)
    319323        return
    320324
     
    341345    mus = 1024 * 50
    342346    download_name = u'passport.jpg'
     347    tab_redirect = '#tab-2'
    343348
    344349class PassportUploadEdit(PassportUploadManage):
     
    364369    mus = 1024 * 150
    365370    download_name = u'birth_certificate'
     371    tab_redirect = '#tab-2'
    366372
    367373class AcceptanceLetterDisplay(FileDisplay):
     
    381387    mus = 1024 * 150
    382388    download_name = u'acceptance_letter'
     389    tab_redirect = '#tab-2'
    383390
    384391class Image(grok.View):
Note: See TracChangeset for help on using the changeset viewer.