Ignore:
Timestamp:
11 Jan 2012, 22:51:42 (13 years ago)
Author:
Henrik Bettermann
Message:

Backup today's work (mainly student navigation).

Location:
main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp/students
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp/students/browser_templates/studycoursepage.pt

    r7447 r7450  
    5555
    5656
    57 <table class="zebra">
     57<table>
    5858  <thead>
    5959    <tr>
     
    6363  </thead>
    6464  <tbody>
    65     <tr tal:repeat="value context/values">
     65    <tr class="gradeC" tal:repeat="value context/values">
    6666      <td> <a tal:attributes="href value/__name__">
    6767      <span tal:content="value/level">CODE</span></a></td>
  • main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp/students/viewlets.py

    r7442 r7450  
    6060                url, self.text)
    6161
    62 class StudentManageBaseLink(StudentManageLink):
    63     grok.order(1)
    64     link = 'index'
    65     text = u'Base Data'
    66 
    6762class StudentManageApplicationLink(StudentManageLink):
    68     grok.order(2)
     63    grok.order(1)
    6964    link = 'application_slip'
    7065    text = u'Application Slip'
     
    7570        if slip:
    7671            url = self.view.url(self.context,self.link)
    77             return u'<li"><a href="%s">%s</a></li>' % (
     72            return u'<li><a href="%s">%s</a></li>' % (
    7873                    url, self.text)
    7974        return ''
     75
     76class StudentManageBaseLink(StudentManageLink):
     77    grok.order(2)
     78    link = 'index'
     79    text = u'Base Data'
    8080
    8181class StudentManageClearanceLink(StudentManageLink):
     
    111111    text = u'History'
    112112
    113 
    114 class StudentMenu(grok.ViewletManager):
    115     grok.name('top_student')
    116 
    117 class StudentLink(PlainActionButton):
    118     """A link displayed in the student box which shows up for StudentNavigation
    119     objects.
    120 
    121     """
    122     grok.baseclass()
    123     grok.viewletmanager(StudentMenu)
    124     grok.context(ISIRPObject)
    125     grok.view(Interface)
    126     grok.order(5)
    127     grok.require('waeup.viewStudent')
    128 
    129     link = 'index'
    130     text = u'Base Data'
    131 
    132     @property
    133     def target_url(self):
    134         """Get a URL to the target...
    135         """
    136         return self.view.url(self.context.getStudent(), self.link)
    137 
    138 class StudentBaseLink(StudentLink):
    139     grok.order(1)
    140     link = 'index'
    141     text = u'Base Data'
    142 
    143 class ApplicationSlipLink(StudentLink):
    144     grok.order(2)
    145     link = 'application_slip'
    146     text = u'Application Slip'
    147 
    148     @property
    149     def target_url(self):
    150         slip = getUtility(IExtFileStore).getFileByContext(
    151             self.context.getStudent(), attr=self.link)
    152         if slip:
    153             return self.view.url(self.context,self.link)
    154         return
    155 
    156 class StudentClearanceLink(StudentLink):
    157     grok.order(3)
    158     link = 'view_clearance'
    159     text = u'Clearance Data'
    160 
    161 class StudentPersonalLink(StudentLink):
    162     grok.order(4)
    163     link = 'view_personal'
    164     text = u'Personal Data'
    165 
    166 class StudentStudyCourseLink(StudentLink):
    167     grok.order(5)
    168     link = 'studycourse'
    169     text = u'Study Course'
    170 
    171 class StudentPaymentsLink(StudentLink):
    172     grok.order(6)
    173     link = 'payments'
    174     text = u'Payments'
    175 
    176 class StudentAccommodationLink(StudentLink):
    177     grok.order(7)
    178     link = 'accommodation'
    179     text = u'Accommodation'
    180 
    181 class StudentHistoryLink(StudentLink):
    182     grok.order(8)
    183     link = 'history'
    184     text = u'History'
    185 
    186113class StudentsTab(PrimaryNavTab):
    187114    """Students tab in primary navigation.
     
    227154
    228155class MyStudentDataTab(PrimaryStudentNavTab):
    229     """MyData-tab in primary navigation.
     156    """MyData dropdown tab in primary navigation.
    230157    """
    231158    grok.order(3)
    232159    grok.require('waeup.viewMyStudentDataTab')
     160    grok.template('mydatadropdowntabs')
    233161    pnav = 4
    234162    tab_title = u'My Data'
    235163
    236164    @property
    237     def link_target(self):
    238         rel_link = '/students/%s' % self.request.principal.id
    239         return self.view.application_url() + rel_link
     165    def active(self):
     166        view_pnav = getattr(self.view, 'pnav', 0)
     167        if view_pnav == self.pnav:
     168            return 'active dropdown'
     169        return 'dropdown'
     170
     171    @property
     172    def targets(self):
     173        student_url = self.view.application_url() + (
     174            '/students/%s' % self.request.principal.id)
     175        #app_slip = getUtility(IExtFileStore).getFileByContext(
     176        #    self.context.getStudent(), 'application_slip')
     177        targets = []
     178        #if app_slip:
     179        #    targets = [{'url':student_url + '/application_slip', 'title':'Application Slip'},]
     180        targets += [
     181            {'url':student_url + '/index', 'title':'Base Data'},
     182            {'url':student_url + '/view_clearance', 'title':'Clearance Data'},
     183            {'url':student_url + '/view_personal', 'title':'Personal Data'},
     184            {'url':student_url + '/studycourse', 'title':'Study Course'},
     185            {'url':student_url + '/payments', 'title':'Payments'},
     186            {'url':student_url + '/accommodation', 'title':'Accommodation Data'},
     187            {'url':student_url + '/history', 'title':'History'},
     188            ]
     189        return targets
    240190
    241191def handle_file_delete(context, view, download_name):
Note: See TracChangeset for help on using the changeset viewer.