Changeset 5999


Ignore:
Timestamp:
30 Apr 2011, 13:57:08 (13 years ago)
Author:
Henrik Bettermann
Message:

Rebuild faculty manage page by using jQueryUI tabs and adjust styles in waeuptheme-gray1.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/browser
Files:
1 added
5 edited

Legend:

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

    r5989 r5999  
    166166provided 'Edit  faculty' button:
    167167
    168   >>> browser.getLink('Edit faculty').click()
     168  >>> browser.getLink('Manage faculty').click()
    169169
    170170Let's set a new title and save the form:
    171171
    172   >>> browser.getControl(name='form.title').value = "My test faculty"
     172  >>> browser.getControl(name='form.title').value = "My renamed faculty"
    173173  >>> browser.getControl(name='form.actions.save').click()
    174174
    175 Clicking 'Save' we will stay on the settings form. So we can change
    176 the department again. This time we will return to the overview page
    177 afterwards:
    178 
    179   >>> browser.getControl(name='form.title').value = "My renamed faculty"
    180   >>> ctrl = browser.getControl("Save and return")
    181   >>> ctrl.click()
    182 
    183 If we go to the settings page and click ``Cancel`` nothing will be
    184 changed:
    185 
    186   >>> browser.getLink('Edit faculty').click()
    187   >>> browser.getControl(name='form.title').value = "Blah"
    188   >>> browser.getControl('Cancel').click()
    189 
    190 Our faculty was indeed renamed to ``My renamed faculty`` and not to
    191 ``Blah``:
     175Our faculty was indeed renamed to ``My renamed faculty``:
    192176
    193177  >>> browser.open('http://localhost/myuniversity/faculties')
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r5996 r5999  
    1616from zope import schema
    1717from waeup.sirp.browser.resources import warning
     18from waeup.sirp.browser.resources import datepicker, tabs
    1819try:
    1920    from zope.authentication.interfaces import (
     
    906907    grok.name('index')
    907908    pnav = 1
    908     label = 'Departments'
    909909
    910910    @property
    911911    def title(self):
    912912        return self.context.longtitle()
     913       
     914    @property
     915    def label(self):
     916        return 'Departments'
    913917
    914918    #def update(self, code=None, edit=None, delete=None):
     
    927931    grok.name('add')
    928932    grok.require('waeup.manageUniversity')
    929     title = 'Add department'
    930     label = ''
     933    label = 'Add department'
    931934    form_fields = grok.AutoFields(IDepartmentAdd)
    932935    pnav = 1
     936
     937    @property
     938    def title(self):
     939        return self.context.longtitle()
    933940   
    934941    @grok.action('Add department')
     
    946953                                  'in the database')
    947954            return
    948         self.redirect(self.url(self.context))
     955        self.redirect(self.url(self.context, u'@@manage'))
    949956       
    950957    @grok.action('Cancel')
    951958    def cancel(self, **data):
    952         self.redirect(self.url(self.context))           
     959        self.redirect(self.url(self.context))
    953960
    954961class ManageFacultyFormPage(WAeUPEditFormPage):
     
    958965    grok.name('manage')
    959966    grok.require('waeup.manageUniversity')
    960     title = 'Edit faculty'
    961     pnav = 1
     967    grok.template('facultymanagepage')
     968    pnav = 1
     969    taboneactions = ['Save','Save and return','Cancel']
     970    tabtwoactions = ['Add department', 'Remove selected','Cancel']
    962971
    963972    form_fields = grok.AutoFields(IFaculty)
     973
     974    @property
     975    def label(self):
     976        return 'Manage faculty'
     977       
     978    @property
     979    def title(self):
     980        return self.context.longtitle()       
     981
     982    def update(self):
     983        tabs.need()
     984        #warning.need()
     985        return super(ManageFacultyFormPage, self).update()
    964986
    965987    @grok.action('Save')
     
    967989        self.applyData(self.context, **data)
    968990        return
    969    
    970     @grok.action('Save and return')
    971     def saveAndReturn(self, **data):
    972         self.applyData(self.context, **data)
    973         self.redirect(self.url(self.context))
    974         return
    975 
     991         
     992    # ToDo: Show warning message before deletion
     993    @grok.action('Remove selected')
     994    def delDepartments(self, **data):
     995        form = self.request.form
     996        child_id = form['val_id']
     997        if not isinstance(child_id, list):
     998            child_id = [child_id]
     999        deleted = []
     1000        for id in child_id:
     1001            try:
     1002                del self.context[id]
     1003                deleted.append(id)
     1004            except:
     1005                self.flash('Could not delete %s: %s: %s' % (
     1006                        id, sys.exc_info()[0], sys.exc_info()[1]))
     1007        if len(deleted):
     1008            self.flash('Successfully removed: %s' % ', '.join(deleted))
     1009        return       
     1010
     1011    @grok.action('Add department', validator=NullValidator)
     1012    def addDepartment(self, **data):
     1013        self.redirect(self.url(self.context, '@@add'))
     1014        return   
     1015       
    9761016    @grok.action('Cancel', validator=NullValidator)
    9771017    def cancel(self, **data):
     
    9801020
    9811021
    982 class RemoveDepartmentFormPage(RemoveFormPage):
    983     """ Remove Department Page
    984     """
    985     grok.context(IFaculty)
    986     title = "Remove department"
    987     pnav = 1
     1022#class RemoveDepartmentFormPage(RemoveFormPage):
     1023#    """ Remove Department Page
     1024#    """
     1025#    grok.context(IFaculty)
     1026#    title = "Remove department"
     1027#    pnav = 1
    9881028
    9891029
     
    10061046    def update(self):
    10071047        yui.tabview.need()
    1008 
    10091048        if 'delcourse' in self.request.form:
    10101049            code = self.request.form['code']
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/static/waeuptheme-gray1.css

    r5405 r5999  
    44want to do more complex operations. */
    55 
     6a, table td a {
     7  text-decoration: none;
     8}
     9
     10a:hover {
     11  text-decoration: underline;
     12}
     13
    614.breadcrumbs {
    715  background-color: #fff;
    816  padding: 0.3em;
    9   margin-bottom: 0.8em
     17  margin-bottom: 0.8em;
     18}
     19
     20.breadcrumbs a {
     21  text-decoration: none;
     22}
     23
     24.breadcrumbs a:hover {
     25  text-decoration: underline;
    1026}
    1127 
     
    7692}
    7793
     94.yui-button a:hover {
     95  text-decoration: none;
     96}
     97
     98
    7899.actionbar {
    79100  margin-top: -10px;
     
    82103}
    83104
     105/* jquery-ui customizations */
     106
     107.ui-tabs {
     108  padding-bottom: 0em;
     109  padding-left: 0em;
     110  padding-right: 0em;
     111  padding-top: 0em;
     112  position: relative;
     113}
     114
     115.ui-corner-all {
     116  -moz-border-radius:0px;
     117}
     118
     119.ui-tabs .ui-tabs-nav {
     120  margin: 0;
     121  padding-left: 0.2em;
     122  padding-right: 0.2em;
     123  padding-bottom: 0;
     124  padding-top: 0;
     125
     126}
     127
     128.ui-tabs .ui-tabs-nav li {
     129  float: center;
     130  margin-left: 6px;
     131  margin-right: 0.2em;
     132  margin-top: 0;
     133  padding-left: 0;
     134  padding-right: 0;
     135  padding-top: 0;
     136  position: relative;
     137  top: 1px;
     138  white-space: nowrap;
     139
     140}
     141
     142.ui-tabs .ui-tabs-nav li a {
     143  float: center;
     144  padding-bottom: 0.5em;
     145  padding-left: 1em;
     146  padding-right: 1em;
     147  padding-top: 0.5em;
     148  text-decoration: none;
     149}
     150
     151.ui-tabs .ui-tabs-nav li a:hover {
     152  text-decoration: underline;
     153}
     154
     155.ui-tabs .ui-tabs-nav li.ui-tabs-selected {
     156  margin-bottom: 0px;
     157  padding-bottom: 0px;
     158  background: #FFF;
     159  border-width: 0px;
     160  padding-top: 0px;
     161  margin-top: 0px;
     162}
     163
     164
     165.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited {
     166  color: #FFF;
     167}
     168
     169.ui-state-active a:link, .ui-state-active a:visited {
     170  color: #000;
     171}
     172
     173.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
     174 
     175  border-width: 0px;
     176  background-color: #456;
     177  background-image: none;
     178  font-weight: normal;
     179}
     180
     181.ui-widget {
     182  font-family: Verdana,Arial,sans-serif;
     183  font-size: 100%;
     184}
     185
     186.ui-widget-header {
     187  background-color: #456;
     188  background-image: None;
     189  border-color: #456;
     190  border-style: solid;
     191  border-width:0px; 
     192}
     193
     194.ui-helper-reset {
     195  font-size: 90%;
     196  line-height: 1;
     197}
     198
     199.ui-widget-content {
     200  background-color: #FFFFFF;
     201  background-image: none;
     202  border-bottom-style: solid;
     203  border-bottom-width: 1px;
     204  border-top-style: solid;
     205  border-top-width: 0px;
     206  border-color: #456;
     207}
     208
     209.ui-widget-content a {
     210  color: #456;
     211}
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/login.pt

    r5403 r5999  
    33   
    44    <a href="@@loginstaff">
    5       <img tal:attributes="src static/login.png" /> Staff Login
     5      Staff Login
    66    </a>
    77    <br />
    88    <a href="@@loginstudent">
    9       <img tal:attributes="src static/login.png" /> Student Login
     9      Student Login
    1010    </a>
    1111</div>
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py

    r5977 r5999  
    316316    grok.context(IFaculty)
    317317    grok.view(FacultyPage)
    318     text = 'Edit faculty'
     318    text = 'Manage faculty'
    319319
    320320class ManageDepartmentActionButton(ManageActionButton):
     
    361361    text = 'Add faculty'
    362362   
    363 class AddDepartmentActionButton(AddActionButton):
    364     grok.context(IFaculty)
    365     grok.view(FacultyPage)
    366     text = 'Add department'
     363#class AddDepartmentActionButton(AddActionButton):
     364#    grok.context(IFaculty)
     365#    grok.view(FacultyPage)
     366#    text = 'Add department'
    367367
    368368class AddCertificateActionButton(AddActionButton):
     
    397397    text = 'Remove faculty'
    398398   
    399 class RemoveDepartmentActionButton(RemoveActionButton):
    400     grok.context(IFaculty)
    401     grok.view(FacultyPage)
    402     text = 'Remove department'
    403 
     399#class RemoveDepartmentActionButton(RemoveActionButton):
     400#    grok.context(IFaculty)
     401#    grok.view(FacultyPage)
     402#    text = 'Remove department'
     403   
    404404
    405405#
Note: See TracChangeset for help on using the changeset viewer.