Ignore:
Timestamp:
12 Apr 2011, 11:47:46 (14 years ago)
Author:
Henrik Bettermann
Message:

Use simple table layout with remove buttons for faculties. Open a warning message before removing departments.

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

Legend:

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

    r5927 r5930  
    907907        return "%s (%s)" % (getName(self.context), self.context.code)
    908908
    909     def update(self):
    910         self.table = ITableProvider(self.context).getTables(view=self)[0]
    911         self.table.need()
     909    def update(self, code=None, edit=None, delete=None):
     910        warning.need()
     911        if delete is not None and code is not None:
     912            try:
     913                del self.context[code]
     914                self.flash('Department %s successfully removed.' % code)               
     915            except:
     916                self.flash('Could not delete %s.' % code)
    912917
    913918class AddDepartmentFormPage(WAeUPAddFormPage):
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/facultypage.pt

    r5917 r5930  
    1   <h2>Departments</h2>
     1<h2>Departments</h2>
    22
    33
    4   <div tal:condition="python: not len(context.keys())">
    5     There are no departments registered yet.
    6   </div>
     4<div tal:condition="python: not len(context.keys())">
     5There are no departments registered yet.
     6</div>
    77
    8   <div name="thedepartmenttable" tal:condition="python: len(context.keys())">
    9     <div tal:replace="structure view/table/renderHTML" />
    10   </div>
     8<table class="zebra">
     9  <thead>
     10    <tr>
     11      <th>Code</th>
     12      <th>Title</th>
     13      <th>&nbsp;</th>
     14    </tr>
     15  </thead>
     16  <tbody>
     17    <tr tal:repeat="value context/values"
     18        tal:attributes="class python: repeat['value'].odd() and 'odd' or 'even'">
     19      <td> <a tal:attributes="href value/__name__"> <span tal:content="value/code">Name</span></a></td>
     20      <td tal:content="value/title">Title</td>
     21      <td class="text-right">
     22      <form method="post">
     23         <input type="hidden" name="code"
     24                 tal:attributes="value value/__name__"/>
     25         <input type="submit" name="delete" value="remove"
     26                onclick="return confirmPost('All courses and certificates of this faculty will be removed too. Are you sure?')">
     27      </form>
     28      </td>
     29    </tr>
     30  </tbody>
     31</table>
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py

    r5927 r5930  
    397397#    text = 'Remove faculty'
    398398   
    399 class RemoveDepartmentActionButton(RemoveActionButton):
    400     grok.context(IFaculty)
    401     grok.view(FacultyPage)
    402     text = 'Remove department'
     399#class RemoveDepartmentActionButton(RemoveActionButton):
     400#    grok.context(IFaculty)
     401#    grok.view(FacultyPage)
     402#    text = 'Remove department'
    403403
    404404
Note: See TracChangeset for help on using the changeset viewer.