Changeset 7453


Ignore:
Timestamp:
12 Jan 2012, 11:43:29 (13 years ago)
Author:
Henrik Bettermann
Message:

Add breadcrumbs to student site layout. Omit the Students breadcrumb if principal is a student.

Location:
main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp/browser/static/waeup-base.css

    r7451 r7453  
    4141}
    4242
     43.container {
     44  width: 700px;
     45}
     46
    4347h2 {
    4448  margin-bottom: 12px;
     
    5761  border-top-left-radius: 3px;
    5862  border-top-right-radius: 3px;
     63  border-bottom-left-radius: 3px;
     64  border-bottom-right-radius: 3px;
    5965}
    6066
     
    8389
    8490 /* SIRP stuff */
    85 
    86 .container {
    87   width: 700px;
    88 }
    8991
    9092.actionbar {
     
    118120  line-height: 16px;
    119121}
     122
     123.student-info-bar{
     124  padding: 7px 14px;
     125  margin-left: -20px;
     126  margin-right: -20px;
     127  margin-bottom: 14px;
     128  padding-left: 20px;
     129  padding-right: 20px;
     130  width: 700px;
     131  background-color: #FFFFFF;
     132  background-image: None;
     133  border: 0px;
     134  border-top-left-radius: 3px;
     135  border-top-right-radius: 3px;
     136  border-bottom-left-radius: 3px;
     137  border-bottom-right-radius: 3px;
     138}
     139
     140.student-info-bar li {
     141  display: inline;
     142  text-shadow: 0 1px 0 #ffffff;
     143}
     144.student-info-bar .divider {
     145  padding: 0 5px;
     146  color: #bfbfbf;
     147}
     148.student-info-bar .active a {
     149  color: #404040;
     150}
     151.wfstatus {
     152  float: right;
     153  line-height: 18px;
     154}
  • main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp/browser/templates/studentsitelayout.pt

    r7450 r7453  
    4545      </div>
    4646    </div>
    47 
    4847    <div class="container">
     48      <ul class="student-info-bar">
     49        <tal:breadcrumbs
     50              tal:condition="python: layout.isAuthenticated()"
     51              tal:content="structure provider:breadcrumbs" />
     52        <span tal:condition="layout/getStudentName" class="wfstatus">
     53              Student Id:
     54            <span tal:replace="python:context.getStudent().student_id">Id
     55            </span>&nbsp;&nbsp;
     56            State:
     57            <span tal:replace="python:context.getStudent().state">State
     58            </span>
     59        </span>
     60      </ul>
    4961      <div class="content">
    5062        <div tal:define="message context/@@messages"
     
    6577      </div>
    6678    </div>
    67 
    6879  </body>
    6980</html>
  • main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp/browser/viewlets.py

    r7442 r7453  
    195195        breadcrumbs = IBreadcrumbContainer(self.view)
    196196        for breadcrumb in breadcrumbs:
    197             yield dict(
    198                 title = breadcrumb.title,
    199                 url = self.view.url(breadcrumb.context, breadcrumb.target)
    200                 )
     197            if breadcrumb.target:
     198                yield dict(
     199                    title = breadcrumb.title,
     200                    url = self.view.url(breadcrumb.context, breadcrumb.target)
     201                    )
    201202
    202203
  • main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp/students/browser.py

    r7451 r7453  
    3636    SIRPPage, SIRPEditFormPage, SIRPAddFormPage, SIRPDisplayFormPage,
    3737    ContactAdminForm, SIRPForm)
    38 from waeup.sirp.browser.interfaces import ICaptchaManager
     38from waeup.sirp.browser.interfaces import ICaptchaManager, IBreadcrumbIgnorable
    3939from waeup.sirp.browser.breadcrumbs import Breadcrumb
    4040from waeup.sirp.browser.resources import datepicker, datatable, tabs, warning
     
    6464from waeup.sirp.applicants.interfaces import IApplicantBaseData
    6565from waeup.sirp.hostels.hostel import NOT_OCCUPIED
     66from waeup.sirp.utils.helpers import get_current_principal
    6667
    6768def write_log_message(view, message):
     
    9697    grok.context(IStudentsContainer)
    9798    title = 'Students'
     99    #grok.implements(IBreadcrumbIgnorable)
     100
     101    @property
     102    def target(self):
     103        user = get_current_principal()
     104        #import pdb; pdb.set_trace()
     105        if getattr(user, 'user_type', None) == 'student':
     106            return None
     107        return self.viewname
    98108
    99109class StudentBreadcrumb(Breadcrumb):
     
    131141    grok.context(IStudentAccommodation)
    132142    title = 'Accommodation'
    133 
    134     #@property
    135     #def target(self):
    136     #    prm = get_principal_role_manager()
    137     #    principal = get_current_principal()
    138     #    roles = [x[0] for x in prm.getRolesForPrincipal(principal.id)]
    139     #    if 'waeup.Student' in roles:
    140     #        return 'index'
    141     #    else:
    142     #        return 'manage'
    143143
    144144class BedTicketBreadcrumb(Breadcrumb):
  • main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp/students/tests/test_browser.py

    r7452 r7453  
    807807        self.browser.getLink("Clear student").click()
    808808        self.assertTrue('Student has been cleared' in self.browser.contents)
    809         self.assertTrue('State: <span>cleared</span>' in self.browser.contents)
     809        self.assertTrue('cleared' in self.browser.contents)
    810810        self.browser.getLink("Reject clearance").click()
    811811        self.assertTrue('Clearance has been annulled' in self.browser.contents)
     
    814814        self.assertEqual(self.browser.url, self.student_path +
    815815            '/contactstudent?subject=%s' % urlmessage)
    816         self.assertTrue('State: <span>clearance started</span>'
    817             in self.browser.contents)
     816        self.assertTrue('clearance started' in self.browser.contents)
    818817        IWorkflowInfo(self.student).fireTransition('request_clearance')
    819818        self.browser.open(self.clearance_student_path)
     
    821820        self.assertTrue('Clearance request has been rejected'
    822821            in self.browser.contents)
    823         self.assertTrue('State: <span>clearance started</span>'
    824             in self.browser.contents)
     822        self.assertTrue('clearance started' in self.browser.contents)
    825823        # CO does now also see the contact form and can send a message
    826824        self.browser.getControl(name="form.subject").value = 'Important subject'
     
    917915        self.browser.getLink("Validate courses").click()
    918916        self.assertTrue('Course list has been validated' in self.browser.contents)
    919         self.assertTrue('State: <span>courses validated</span>' in self.browser.contents)
     917        self.assertTrue('courses validated' in self.browser.contents)
    920918        self.browser.getLink("Reject courses").click()
    921919        self.assertTrue('Course list request has been annulled'
Note: See TracChangeset for help on using the changeset viewer.