Changeset 13711 for main


Ignore:
Timestamp:
18 Feb 2016, 11:52:18 (9 years ago)
Author:
Henrik Bettermann
Message:

Add flash_notice field.

Location:
main/waeup.kofa/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r13702 r13711  
    441.4.2.dev0 (unreleased)
    55=======================
     6
     7* Add `flash_notice` field.
    68
    79* Documentation updates.
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py

    r13495 r13711  
    411411        self.assertEqual(self.browser.contents,
    412412            'adm_code,clr_code,date_of_birth,email,'
    413             'employer,firstname,lastname,matric_number,middlename,'
     413            'employer,firstname,flash_notice,lastname,matric_number,middlename,'
    414414            'nationality,officer_comment,perm_address,personal_updated,'
    415415            'phone,reg_number,sex,student_id,suspended,suspended_comment,'
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r13610 r13711  
    414414    grok.template('basepage')
    415415    form_fields = grok.AutoFields(IStudentBase).omit(
    416         'password', 'suspended', 'suspended_comment')
     416        'password', 'suspended', 'suspended_comment', 'flash_notice')
    417417    pnav = 4
    418418
     
    430430            return _('set')
    431431        return _('unset')
     432
     433    def update(self):
     434        if self.context.flash_notice:
     435            self.flash(self.context.flash_notice, type="warning")
     436        super(StudentBaseDisplayFormPage, self).update()
     437        return
    432438
    433439class StudentBasePDFFormPage(KofaDisplayFormPage):
     
    492498    prefix = 'form'
    493499
    494     omit_fields = ('date_of_birth', 'current_level')
     500    omit_fields = ('date_of_birth', 'current_level', 'flash_notice')
    495501
    496502    form_fields = grok.AutoFields(IStudentBase).select('student_id', 'reg_number')
     
    664670        'suspended', 'phone',
    665671        'adm_code', 'suspended_comment',
    666         'date_of_birth', 'current_level')
     672        'date_of_birth', 'current_level',
     673        'flash_notice')
    667674
    668675    @property
     
    12061213        'department', 'faculty', 'current_mode', 'entry_session', 'certificate',
    12071214        'password', 'suspended', 'phone', 'email',
    1208         'adm_code', 'suspended_comment', 'current_level')
     1215        'adm_code', 'suspended_comment', 'current_level', 'flash_notice')
    12091216
    12101217    def update(self):
     
    13561363    omit_fields = (
    13571364        'password', 'suspended', 'phone', 'date_of_birth',
    1358         'adm_code', 'sex', 'suspended_comment', 'current_level')
     1365        'adm_code', 'sex', 'suspended_comment', 'current_level',
     1366        'flash_notice')
    13591367
    13601368    @property
     
    19191927    omit_fields = (
    19201928        'password', 'suspended', 'phone', 'date_of_birth',
    1921         'adm_code', 'sex', 'suspended_comment', 'current_level')
     1929        'adm_code', 'sex', 'suspended_comment', 'current_level',
     1930        'flash_notice')
    19221931
    19231932    @property
     
    22032212    omit_fields = (
    22042213        'password', 'suspended', 'phone', 'adm_code',
    2205         'suspended_comment', 'date_of_birth', 'current_level')
     2214        'suspended_comment', 'date_of_birth', 'current_level',
     2215        'flash_notice')
    22062216
    22072217    @property
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r13457 r13711  
    198198        )
    199199
     200    flash_notice = schema.TextLine(
     201        title = _(u'Flash Notice'),
     202        required = False,
     203        readonly = False,
     204        description = _(
     205            u'This single-line message will be shown in a flash box.'),
     206        )
     207
    200208    student_id = schema.TextLine(
    201209        title = _(u'Student Id'),
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r13700 r13711  
    544544        # Only the Application Slip does not exist
    545545        self.assertFalse('Application Slip' in self.browser.contents)
     546        return
     547
     548    def test_flash_notice(self):
     549        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     550        self.browser.open(self.student_path)
     551        self.assertFalse('alert alert-warning' in self.browser.contents)
     552        self.student.flash_notice = u'Happy Birthday!'
     553        self.browser.open(self.student_path)
     554        self.assertTrue(
     555            '<div><div class="alert alert-warning">Happy Birthday!</div>'
     556            in self.browser.contents)
    546557        return
    547558
     
    35223533        self.assertTrue(
    35233534            'adm_code,clr_code,date_of_birth,email,employer,'
    3524             'firstname,lastname,matric_number,middlename,nationality,'
     3535            'firstname,flash_notice,lastname,matric_number,middlename,nationality,'
    35253536            'officer_comment,perm_address,personal_updated,phone,reg_number,'
    35263537            'sex,student_id,suspended,suspended_comment,transcript_comment,'
    35273538            'password,state,history,certcode,is_postgrad,current_level,'
    35283539            'current_session\r\n'
    3529             ',,1981-02-04#,aa@aa.ng,,Anna,Tester,234,,,,,,'
     3540            ',,1981-02-04#,aa@aa.ng,,Anna,,Tester,234,,,,,,'
    35303541            '1234#,123,m,K1000000,0,,,{SSHA}' in self.browser.contents)
    35313542
     
    36223633        self.assertTrue(
    36233634            'adm_code,clr_code,date_of_birth,email,employer,'
    3624             'firstname,lastname,matric_number,middlename,nationality,'
     3635            'firstname,flash_notice,lastname,matric_number,middlename,nationality,'
    36253636            'officer_comment,perm_address,personal_updated,phone,reg_number,'
    36263637            'sex,student_id,suspended,suspended_comment,transcript_comment,'
    36273638            'password,state,history,certcode,is_postgrad,current_level,'
    36283639            'current_session\r\n'
    3629             ',,1981-02-04#,aa@aa.ng,,Anna,Tester,234,,,,,,'
     3640            ',,1981-02-04#,aa@aa.ng,,Anna,,Tester,234,,,,,,'
    36303641            '1234#,123,m,K1000000,0,,,{SSHA}' in self.browser.contents)
    36313642        self.assertEqual(len(self.app['datacenter'].running_exports), 1)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r13641 r13711  
    126126    std_csv_entry = (
    127127        'my adm code,my clr code,1981-02-04#,anna@sample.com,,'
    128         'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",,'
     128        'Anna,,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",,'
    129129        '+234-123-12345#,123,f,A111111,0,,,,created'
    130130        )
     
    157157        self.assertTrue(
    158158            'adm_code,clr_code,date_of_birth,email,'
    159             'employer,firstname,lastname,matric_number,middlename,'
     159            'employer,firstname,flash_notice,lastname,matric_number,middlename,'
    160160            'nationality,officer_comment,perm_address,personal_updated,'
    161161            'phone,reg_number,sex,student_id,suspended,suspended_comment,'
     
    163163            'current_level,current_session\r\n'
    164164            'my adm code,my clr code,'
    165             '1981-02-04#,anna@sample.com,,Anna,Tester,234,M.,NG,,'
     165            '1981-02-04#,anna@sample.com,,Anna,,Tester,234,M.,NG,,'
    166166            '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,123,f,'
    167167            'A111111,0,,,,created'
     
    179179        self.assertTrue(
    180180            'adm_code,clr_code,date_of_birth,email,'
    181             'employer,firstname,lastname,matric_number,middlename,'
     181            'employer,firstname,flash_notice,lastname,matric_number,middlename,'
    182182            'nationality,officer_comment,perm_address,personal_updated,'
    183183            'phone,reg_number,sex,student_id,suspended,suspended_comment,'
     
    185185            'is_postgrad,current_level,current_session\r\n'
    186186            'my adm code,my clr code,1981-02-04#,anna@sample.com,,'
    187             'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n"'
     187            'Anna,,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n"'
    188188            ',,+234-123-12345#,123,f,A111111,0,,,,created'
    189189            in result
     
    199199        self.assertTrue(
    200200            'adm_code,clr_code,date_of_birth,email,'
    201             'employer,firstname,lastname,matric_number,middlename,'
     201            'employer,firstname,flash_notice,lastname,matric_number,middlename,'
    202202            'nationality,officer_comment,perm_address,personal_updated,'
    203203            'phone,reg_number,sex,student_id,suspended,suspended_comment,'
     
    205205            'is_postgrad,current_level,current_session\r\n'
    206206            'my adm code,my clr code,1981-02-04#,anna@sample.com,,'
    207             'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n"'
     207            'Anna,,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n"'
    208208            ',,+234-123-12345#,123,f,A111111,0,,,,created'
    209209            in result
Note: See TracChangeset for help on using the changeset viewer.