Changeset 8921


Ignore:
Timestamp:
5 Jul 2012, 15:28:28 (12 years ago)
Author:
Henrik Bettermann
Message:

Translate boolean values also in edit and manage pages.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
3 edited

Legend:

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

    r8920 r8921  
    9191    return
    9292
     93def translated_values(view):
     94    lang = view.request.cookies.get('kofa.language')
     95    for value in view.context.values():
     96        value_dict = dict([i for i in value.__dict__.items()])
     97        value_dict['mandatory_bool'] = value.mandatory
     98        value_dict['mandatory'] = translate(str(value.mandatory), 'zope',
     99            target_language=lang)
     100        value_dict['carry_over'] = translate(str(value.carry_over), 'zope',
     101            target_language=lang)
     102        value_dict['automatic'] = translate(str(value.automatic), 'zope',
     103            target_language=lang)
     104        yield value_dict
     105
    93106class StudentsBreadcrumb(Breadcrumb):
    94107    """A breadcrumb for the students container.
     
    710723    @property
    711724    def translated_values(self):
    712         lang = self.request.cookies.get('kofa.language')
    713         for value in self.context.values():
    714             value_dict = dict([i for i in value.__dict__.items()])
    715             value_dict['mandatory'] = translate(str(value.mandatory), 'zope',
    716                 target_language=lang)
    717             value_dict['carry_over'] = translate(str(value.carry_over), 'zope',
    718                 target_language=lang)
    719             value_dict['automatic'] = translate(str(value.automatic), 'zope',
    720                 target_language=lang)
    721             yield value_dict
     725        return translated_values(self)
    722726
    723727    @property
     
    821825        datatable.need()
    822826        return
     827
     828    @property
     829    def translated_values(self):
     830        return translated_values(self)
    823831
    824832    @property
     
    17871795        return total_credits
    17881796
     1797    @property
     1798    def translated_values(self):
     1799        return translated_values(self)
     1800
    17891801    @action(_('Add course ticket'))
    17901802    def addCourseTicket(self, **data):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/studyleveleditpage.pt

    r8553 r8921  
    2222  </thead>
    2323  <tbody>
    24     <tr tal:repeat="value context/values" class="gradeC">
     24    <tr tal:repeat="value view/translated_values" class="gradeC">
    2525       <td>
    2626        <input type="checkbox" name="val_id"
    2727                  tal:attributes="value value/__name__"
    28         tal:condition="not: value/mandatory" />
     28        tal:condition="not: value/mandatory_bool" />
    2929      </td>
    3030      <td tal:content="value/semester">SEMESTER</td>
     
    3636      <td tal:content="value/fcode">FACULTY</td>
    3737      <td tal:content="value/credits">CREDITS</td>
    38       <td tal:content="value/score">SCORE</td>
     38      <td tal:content="value/score|nothing">SCORE</td>
    3939      <td tal:content="value/carry_over">CO</td>
    4040    </tr>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/studylevelmanagepage.pt

    r7811 r8921  
    4646      </thead>
    4747      <tbody>
    48         <tr tal:repeat="value context/values" class="gradeC">
     48        <tr tal:repeat="value view/translated_values" class="gradeC">
    4949          <td>
    5050            <input type="checkbox" name="val_id"
     
    6060          <td tal:content="value/credits">CREDITS</td>
    6161          <td tal:content="value/mandatory">MANDATORY</td>
    62           <td tal:content="value/score">SCORE</td>
     62          <td tal:content="value/score|nothing">SCORE</td>
    6363          <td tal:content="value/carry_over">CO</td>
    6464          <td tal:content="value/automatic">AUTO</td>
Note: See TracChangeset for help on using the changeset viewer.