Changeset 6635 for main/waeup.sirp/trunk


Ignore:
Timestamp:
26 Aug 2011, 20:54:25 (13 years ago)
Author:
Henrik Bettermann
Message:

Make action buttons smaller on studentpage.

Add StudentAccommodation? container class which contains the accommodation objects.

Add StudentPayments? container class which contains the payments objects.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/actionbutton.pt

    r6028 r6635  
    44       tal:attributes="href viewlet/target_url">
    55      <img src="" alt="edit"
    6            tal:attributes="src viewlet/icon_url; 
     6           tal:attributes="src viewlet/icon_url;
    77                           alt viewlet/alt"/>
    88    <span tal:content="viewlet/text">TEXT</span></a>
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py

    r6447 r6635  
    114114        """
    115115        return self.view.url(self.view.context, self.target)
     116
     117class PlainActionButton(ActionButton):
     118    """A base for action buttons without image
     119    """
     120    grok.baseclass()
     121    template = grok.PageTemplateFile('templates/plainactionbutton.pt')
    116122
    117123   
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r6633 r6635  
    4646from waeup.sirp.browser.viewlets import (
    4747    ManageActionButton, PrimaryNavTab, LeftSidebarLink,
    48     AddActionButton, ActionButton,
     48    AddActionButton, ActionButton, PlainActionButton,
    4949    )
    5050from waeup.sirp.image.browser.widget import (
     
    6464from waeup.sirp.students.interfaces import (
    6565    IStudentsContainer, IStudent, IStudentClearance,
    66     IStudentPersonal, IStudentBase
     66    IStudentPersonal, IStudentBase, IStudentStudyCourse,
     67    IStudentPayments, IStudentAccommodation
    6768    )
    6869from waeup.sirp.students.student import (
     
    9293    grok.context(IStudentsContainer)
    9394    title = u'Students'
     95
     96class SudyCourseBreadcrumb(Breadcrumb):
     97    """A breadcrumb for the student study course.
     98    """
     99    grok.context(IStudentStudyCourse)
     100    title = u'Study Course'
     101
     102class PaymentsBreadcrumb(Breadcrumb):
     103    """A breadcrumb for the student payments folder.
     104    """
     105    grok.context(IStudentPayments)
     106    title = u'Payments'
     107
     108class AccommodationBreadcrumb(Breadcrumb):
     109    """A breadcrumb for the student accommodation folder.
     110    """
     111    grok.context(IStudentAccommodation)
     112    title = u'Accommodation'
    94113
    95114class StudentsContainerPage(WAeUPPage):
     
    229248    grok.name('index')
    230249    grok.require('waeup.viewStudents')
     250    grok.template('studentpage')
    231251    form_fields = grok.AutoFields(IStudentBase)
    232252
     
    244264    grok.view(StudentBaseDisplayFormPage)
    245265    grok.require('waeup.manageStudents')
    246     text = 'Edit base data'
     266    text = 'Edit'
    247267    target = 'edit_base'
    248268
    249 class StudentClearanceViewActionButton(ActionButton):
     269class StudentClearanceViewActionButton(PlainActionButton):
    250270    grok.order(2)
    251     icon = 'actionicon_view.png'
    252     grok.context(IStudent)
    253     grok.view(StudentBaseDisplayFormPage)
    254     grok.require('waeup.viewStudents')
    255     text = 'View clearance data'
     271    grok.context(IStudent)
     272    grok.view(StudentBaseDisplayFormPage)
     273    grok.require('waeup.viewStudents')
     274    text = 'Clearance Data'
    256275    target = 'view_clearance'
    257276
    258 class StudentPersonalViewActionButton(ActionButton):
     277class StudentPersonalViewActionButton(PlainActionButton):
    259278    grok.order(3)
    260     icon = 'actionicon_view.png'
    261     grok.context(IStudent)
    262     grok.view(StudentBaseDisplayFormPage)
    263     grok.require('waeup.viewStudents')
    264     text = 'View personal data'
     279    grok.context(IStudent)
     280    grok.view(StudentBaseDisplayFormPage)
     281    grok.require('waeup.viewStudents')
     282    text = 'Personal Data'
    265283    target = 'view_personal'
     284
     285class StudyCourseViewActionButton(PlainActionButton):
     286    grok.order(4)
     287    grok.context(IStudent)
     288    grok.view(StudentBaseDisplayFormPage)
     289    grok.require('waeup.viewStudents')
     290    text = 'Study Course'
     291    target = 'studycourse'
     292
     293class PaymentsViewActionButton(PlainActionButton):
     294    grok.order(5)
     295    grok.context(IStudent)
     296    grok.view(StudentBaseDisplayFormPage)
     297    grok.require('waeup.viewStudents')
     298    text = 'Payments'
     299    target = 'payments'
     300
     301class AccommodationViewActionButton(PlainActionButton):
     302    grok.order(6)
     303    grok.context(IStudent)
     304    grok.view(StudentBaseDisplayFormPage)
     305    grok.require('waeup.viewStudents')
     306    text = 'Accommodation'
     307    target = 'accommodation'
    266308
    267309class StudentBaseManageFormPage(WAeUPEditFormPage):
     
    300342    grok.view(StudentClearanceDisplayFormPage)
    301343    grok.require('waeup.manageStudents')
    302     text = 'Edit clearance data'
     344    text = 'Edit'
    303345    target = 'edit_clearance'
    304346
     
    337379    grok.view(StudentPersonalDisplayFormPage)
    338380    grok.require('waeup.manageStudents')
    339     text = 'Edit personal data'
     381    text = 'Edit'
    340382    target = 'edit_personal'
    341383
     
    352394    def title(self):
    353395        return 'Student: %s' % self.context.name
     396
     397class StudyCourseDisplayFormPage(WAeUPDisplayFormPage):
     398    """ Page to display the student study course data
     399    """
     400    grok.context(IStudentStudyCourse)
     401    grok.name('index')
     402    grok.require('waeup.viewStudents')
     403    form_fields = grok.AutoFields(IStudentStudyCourse)
     404    #grok.template('studycoursepage')
     405
     406    @property
     407    def title(self):
     408        return 'Student: %s' % self.context.__parent__.name
     409
     410    @property
     411    def label(self):
     412        return '%s: Study Course Data' % self.context.__parent__.name
     413
     414class PaymentsDisplayFormPage(WAeUPDisplayFormPage):
     415    """ Page to display the student payments
     416    """
     417    grok.context(IStudentPayments)
     418    grok.name('index')
     419    grok.require('waeup.viewStudents')
     420    form_fields = grok.AutoFields(IStudentPayments)
     421    #grok.template('paymentspage')
     422
     423    @property
     424    def title(self):
     425        return 'Student: %s' % self.context.__parent__.name
     426
     427    @property
     428    def label(self):
     429        return '%s: Payments' % self.context.__parent__.name
     430
     431class AccommodationDisplayFormPage(WAeUPDisplayFormPage):
     432    """ Page to display the student accommodation data
     433    """
     434    grok.context(IStudentAccommodation)
     435    grok.name('index')
     436    grok.require('waeup.viewStudents')
     437    form_fields = grok.AutoFields(IStudentAccommodation)
     438    #grok.template('accommodationpage')
     439
     440    @property
     441    def title(self):
     442        return 'Student: %s' % self.context.__parent__.name
     443
     444    @property
     445    def label(self):
     446        return '%s: Accommodation Data' % self.context.__parent__.name
  • main/waeup.sirp/trunk/src/waeup/sirp/students/container.py

    r6633 r6635  
    2222from zope.interface import implementedBy
    2323from waeup.sirp.students.interfaces import (
    24     IStudentsContainer, IStudent)
     24    IStudentsContainer, IStudent, IStudentPayments, IStudentAccommodation)
    2525from waeup.sirp.students.studycourse import StudentStudyCourse
     26from waeup.sirp.students.payments import StudentPayments
     27from waeup.sirp.students.accommodation import StudentAccommodation
    2628
    2729class StudentsContainer(grok.Container):
     
    4648        studycourse = StudentStudyCourse()
    4749        self[student.student_id]['studycourse'] = studycourse
     50        payments = StudentPayments()
     51        self[student.student_id]['payments'] = payments
     52        accommodation = StudentAccommodation()
     53        self[student.student_id]['accommodation'] = accommodation
    4854        return
  • main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py

    r6633 r6635  
    9292        required = True,
    9393        )
     94
     95class IStudentAccommodation(IWAeUPObject):
     96    """A container for student accommodation objects.
     97
     98    """
     99
     100class IStudentPayments(IWAeUPObject):
     101    """A container for student payment objects.
     102
     103    """
     104
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r6632 r6635  
    7272
    7373
    74         # Add student
     74        # Add student with subobjects (done by addStudent)
    7575        student = Student()
    7676        student.name = u'Anna Tester'
    7777        student.student_id = u'Z654321'
    78         self.app['students'][student.student_id] = student
     78        self.app['students'].addStudent(student)
    7979
    8080        self.container_path = 'http://localhost/app/students'
     
    8888        self.edit_personal_student_path = self.student_path + '/edit_personal'
    8989
     90        self.studycourse_student_path = self.student_path + '/studycourse'
     91        self.payments_student_path = self.student_path + '/payments'
     92        self.accommodation_student_path = self.student_path + '/accommodation'
     93
    9094        # Populate university
    9195        certificate = createObject('waeup.Certificate')
     
    188192        # and can perform actions
    189193        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     194
    190195        self.browser.open(self.student_path)
    191196        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    192197        self.assertEqual(self.browser.url, self.student_path)
    193         self.browser.getLink("Edit base data").click()
     198        self.browser.getLink("Edit").click()
    194199        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    195200        self.assertEqual(self.browser.url, self.manage_student_path)
    196         self.browser.open(self.student_path)
    197         self.browser.getLink("View clearance data").click()
     201
     202        self.browser.open(self.student_path)
     203        self.browser.getLink("Clearance Data").click()
    198204        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    199205        self.assertEqual(self.browser.url, self.clearance_student_path)
    200         self.browser.getLink("Edit clearance data").click()
     206        self.browser.getLink("Edit").click()
    201207        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    202208        self.assertEqual(self.browser.url, self.edit_clearance_student_path)
    203         self.browser.open(self.student_path)
    204         self.browser.getLink("View personal data").click()
     209
     210        self.browser.open(self.student_path)
     211        self.browser.getLink("Personal Data").click()
    205212        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    206213        self.assertEqual(self.browser.url, self.personal_student_path)
    207         self.browser.getLink("Edit personal data").click()
     214        self.browser.getLink("Edit").click()
    208215        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    209216        self.assertEqual(self.browser.url, self.edit_personal_student_path)
     217
     218        self.browser.open(self.student_path)
     219        self.browser.getLink("Study Course").click()
     220        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     221        self.assertEqual(self.browser.url, self.studycourse_student_path)
     222
     223        self.browser.open(self.student_path)
     224        self.browser.getLink("Payments").click()
     225        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     226        self.assertEqual(self.browser.url, self.payments_student_path)
     227
     228        self.browser.open(self.student_path)
     229        self.browser.getLink("Accommodation").click()
     230        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     231        self.assertEqual(self.browser.url, self.accommodation_student_path)
     232
    210233        return
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_student.py

    r6633 r6635  
    3030    Student, StudentFactory,
    3131    )
    32 from waeup.sirp.students.studycourse import (
    33     StudentStudyCourse,
    34     )
     32from waeup.sirp.students.studycourse import StudentStudyCourse
     33from waeup.sirp.students.payments import StudentPayments
     34from waeup.sirp.students.accommodation import StudentAccommodation
    3535from waeup.sirp.students.interfaces import (
    36     IStudent, IStudentStudyCourse,
     36    IStudent, IStudentStudyCourse, IStudentPayments, IStudentAccommodation,
    3737    )
    3838from waeup.sirp.testing import FunctionalLayer
     
    4646        self.student = Student()
    4747        self.studycourse = StudentStudyCourse()
     48        self.payments = StudentPayments()
     49        self.accommodation = StudentAccommodation()
    4850        return
    4951
     
    5759        verify.verifyClass(IStudentStudyCourse, StudentStudyCourse)
    5860        verify.verifyObject(IStudentStudyCourse, self.studycourse)
     61        verify.verifyClass(IStudentPayments, StudentPayments)
     62        verify.verifyObject(IStudentPayments, self.payments)
     63        verify.verifyClass(IStudentAccommodation, StudentAccommodation)
     64        verify.verifyObject(IStudentAccommodation, self.accommodation)
    5965        return
    6066
Note: See TracChangeset for help on using the changeset viewer.