Exemplo n.º 1
0
 def __init__(self, view, account_management_interface,
              register_help_bookmark, verify_bookmark):
     super().__init__(view)
     self.add_child(P(view, text=_('You have successfully registered.')))
     self.add_child(
         P(view,
           text=
           _('Before we can allow you to log in, however, you need to prove to us that you are indeed the owner of %s.'
             ) % account_management_interface.email))
     p = P(view, text=_('In order to do this, an email was sent to {email} containing a secret code. '\
                        'Please check your email, retrieve the code and then enter it on {verify}.'))
     self.add_child(
         p.format(verify=A.from_bookmark(
             view,
             verify_bookmark.with_description(_('the verification page'))),
                  email=TextNode(view, account_management_interface.email)))
     self.add_child(
         P(view,
           text=
           _('Sometimes these emails arrive immediately, but they may also be delayed.'
             )))
     last_p = P(
         view,
         text=
         _('If you do not receive the email within an hour or so, please follow {trouble}.'
           ))
     self.add_child(
         last_p.format(trouble=A.from_bookmark(
             view,
             register_help_bookmark.with_description(
                 _('our troubleshooting procedure')))))
Exemplo n.º 2
0
    def __init__(self, view, account_management_interface):
        super().__init__(view)
        self.add_child(
            P(view,
              text=_('You are trying to register using the email address "%s"')
              % account_management_interface.email))
        self.add_child(
            P(view,
              text=
              _('That address is already registered and active on the system.'
                'This means that you (or someone else) must have registered using that email address'
                ' previously.')))

        forgot_password_bookmark = self.user_interface.get_bookmark(
            relative_path='/resetPassword')
        last_p = P(
            view,
            text=
            _('You can gain access to this account by following our {procedure}.'
              ))
        self.add_child(
            last_p.format(procedure=A.from_bookmark(
                view,
                forgot_password_bookmark.with_description(
                    _(' password reset procedure')))))
Exemplo n.º 3
0
    def __init__(self, view, account_management_interface):
        super().__init__(view)
        self.add_child(
            P(view,
              text=
              _('There is no record of someone trying to register the email address "%s".'
                ) % account_management_interface.email))
        self.add_child(
            P(view,
              text=
              _('Perhaps you mistyped your email address when registering? The system also removes '
                'such a registration request if you take a long time to get around to verifying it.'
                )))

        register_bookmark = self.user_interface.get_bookmark(
            relative_path='/register')
        last_p = P(
            view,
            text=_(
                'Whatever the case, please {register} to rectify the problem.')
        )
        self.add_child(
            last_p.format(register=A.from_bookmark(
                view, register_bookmark.with_description(_(
                    'register again')))))
Exemplo n.º 4
0
 def __init__(self, view, account_management_interface, register_help_bookmark):
     super(CongratsWidget, self).__init__(view)
     self.add_child(P(view, text=_('You have successfully registered.')))
     self.add_child(P(view, text=_('Before we can allow you to log in, however, you need to prove to us that you are indeed the owner of %s.') % account_management_interface.email))
     self.add_child(P(view, text=_('You can do that by following instructions just emailed to that address.')))
     self.add_child(P(view, text=_('Sometimes these emails arrive immediately, but they may also be delayed.')))
     last_p = P(view, text=_('If you do not receive the email within an hour or so, please follow {trouble}.'))
     self.add_child(last_p.format(trouble=A.from_bookmark(view, register_help_bookmark.with_description(_('our troubleshooting procedure')))))
Exemplo n.º 5
0
 def __init__(self, view):
     super().__init__(view)
     self.add_child(
         P(view, text=_('Thank you for verifying your email address.')))
     self.add_child(
         P(view,
           text=
           _('Your account is now active, and you can proceed to log in using the details you provided.'
             )))
Exemplo n.º 6
0
 def __init__(self, view, account_management_interface):
     super().__init__(view)
     self.add_child(
         P(view,
           text=_('A new registration email was sent to "%s"') %
           account_management_interface.email))
     self.add_child(
         P(view,
           text=
           _('Please watch your inbox and follow the instructions in the email.'
             )))
Exemplo n.º 7
0
    def add_two(self):
        layout = ColumnLayout(('left', ResponsiveSize(md=4)),
                              ('right', ResponsiveSize(md=8)))

        div = Div(self.view).use_layout(layout)
        self.body.add_child(div)

        div.layout.columns['left'].add_child(
            P(self.view, text='4/12ths on md and larger'))
        div.layout.columns['right'].add_child(
            P(self.view, text='8/12ths on md and larger'))
Exemplo n.º 8
0
    def __init__(self, view):
        super(MyPage, self).__init__(view)
        self.body.use_layout(Container())

        carousel = Carousel(view, 'my_example_carousel_id', show_indicators=True)
        self.body.add_child(carousel)

        carousel.add_slide(PlaceholderImage(view, 900, 500, text='Slide 1', alt='Slide 1 was here'),
                           caption_widget=P(view, text='a paragraph with text'))

        carousel.add_slide(PlaceholderImage(view, 900, 500, text='Slide 2', alt='Slide 2 was here'),
                           caption_widget=P(view, text='a different paragraph'))
Exemplo n.º 9
0
    def add_four(self):
        layout = ColumnLayout(ColumnOptions('first', ResponsiveSize(md=6)),
                              ColumnOptions('second', ResponsiveSize(md=6)),
                              ColumnOptions('third', ResponsiveSize(md=6)),
                              ColumnOptions('fourth', ResponsiveSize(md=6)))

        div = Div(self.view).use_layout(layout)
        self.body.add_child(div)

        message = '6/12ths on md and larger, else defaults to 12/12ths'
        div.layout.columns['first'].add_child(P(self.view, text=message))
        div.layout.columns['second'].add_child(P(self.view, text=message))
        div.layout.columns['third'].add_child(P(self.view, text=message))
        div.layout.columns['fourth'].add_child(P(self.view, text=message))
Exemplo n.º 10
0
    def __init__(self, view, account_management_interface):
        super(RegistrationPendingWidget, self).__init__(view)
        config = WebExecutionContext.get_context().config
        self.add_child(P(view, text=_('There is a registration pending for email address "%s".') % account_management_interface.email))
        self.add_child(P(view, text=_('Before you can log in using it, you need to act on the automated email '\
                                      'sent to that address. It looks like you did not do that.')))
        self.add_child(P(view, text=_('You should receive the automated email anything between a minute to an hour after '\
                                      'registration. Sometimes though, your email software may mistakenly identify our '\
                                      'email as junk email. If this happens it will be hidden away in a "junk email" '\
                                      'folder or just not shown to you.')))
        self.add_child(P(view, text=_('You can have the email re-sent to you by clicking on the button below.')))
        self.add_child(P(view, text=_('Before you do that, however, please make sure that your email system will allow '\
                                      'emails from "%s" through to you.') % config.accounts.admin_email))

        self.add_child(RegistrationPendingForm(view))
Exemplo n.º 11
0
    def __init__(self, view):
        super(PageLayoutPage, self).__init__(view)
        self.body.use_layout(Container())
        column_layout = ColumnLayout(
            ColumnOptions('left', ResponsiveSize(md=4)),
            ColumnOptions('right', ResponsiveSize(md=8)))
        self.use_layout(PageLayout(contents_layout=column_layout))

        self.layout.header.add_child(P(view, text='The header'))
        self.layout.footer.add_child(P(view, text='The footer'))

        left = column_layout.columns['left']
        left.add_child(P(view, text='To the left'))

        right = column_layout.columns['right']
        right.add_child(P(view, text='To the right'))
Exemplo n.º 12
0
 def __init__(self, view):
     super(FormWithCueInput, self).__init__(view, 'test')
     self.use_layout(FormLayout())
     cue_input = CueInput(
         TextInput(self, fixture.domain_object.fields.field),
         P(view, 'this is your cue'))
     self.layout.add_input(cue_input)
Exemplo n.º 13
0
    def create_terms_inputs(self):
        terms_inputs = self.add_child(FieldSet(self.view, legend_text=_('Terms and conditions'))).use_layout(FormLayout())

        terms_prompt = P(self.view, text=_('Please read and accept our {terms}. You may also be interested '
                                           'to read our {privacypolicy} and our {disclaimer}.'))
        popup = PopupA(self.view, self.bookmarks.terms_bookmark, '#terms', close_button=False)
        terms_inputs.add_child(terms_prompt.format(terms=popup,
                                                   privacypolicy=PopupA(self.view, self.bookmarks.privacy_bookmark, '#privacypolicy'),
                                                   disclaimer=PopupA(self.view, self.bookmarks.disclaimer_bookmark, '#disclaimer')))

        terms_cue = P(self.view, _('You can only register if you agree to the terms and conditions.'))
        accept_checkbox = CheckboxInput(self, self.account_management_interface.fields.accept_terms)
        terms_inputs.layout.add_input(CueInput(accept_checkbox, terms_cue))

        popup.add_js_button(_('Accept'), CheckCheckboxScript(accept_checkbox), style='primary')
        popup.add_js_button(_('Cancel'))
Exemplo n.º 14
0
 def __init__(self, view):
     super(PopupTestPanel, self).__init__(view)
     popup_a = self.add_child(PopupA(view, view.as_bookmark(), '#contents'))
     popup_a.add_js_button('Butt1')
     popup_a.add_js_button('Butt2')
     popup_contents = self.add_child(P(view, text='this is the content of the popup'))
     popup_contents.set_id('contents')
Exemplo n.º 15
0
    def __init__(self, view, address):
        form_name = 'address_%s' % address.id
        super(AddressBox, self).__init__(view, form_name)
        self.use_layout(FormLayout())

        par = self.add_child(P(view, text='%s: %s ' % (address.name, address.email_address)))
        par.add_child(Button(self, address.events.edit.with_arguments(address_id=address.id)))
Exemplo n.º 16
0
    def __init__(self, view):
        super().__init__(view, 'simple_form')
        self.use_layout(FormLayout())
        if self.exception:
            self.layout.add_alert_for_domain_exception(self.exception)

        domain_object = self.get_or_create_domain_object()

        link = self.add_child(
            A(view, Url('/'), description='Open another tab...'))
        link.set_attribute('target', '_blank')
        self.add_child(
            P(view,
              text=
              '...and increment the value there. Come back here and submit the value. A Concurrency error will be shown'
              ))

        #Your own widget that tracks changes
        self.add_child(MyConcurrencyWidget(view, domain_object))

        self.layout.add_input(
            TextInput(self, domain_object.fields.some_field_value))
        self.define_event_handler(domain_object.events.submit)
        self.add_child(Button(self, domain_object.events.submit))
        self.define_event_handler(domain_object.events.increment)
        self.add_child(Button(self, domain_object.events.increment))
Exemplo n.º 17
0
    def add_twelve(self):
        div = Div(self.view).use_layout(ColumnLayout())
        self.body.add_child(div)

        for i in range(1, 13):
            column = div.layout.add_column(str(i), size=ResponsiveSize(md=1))
            column.add_child(P(self.view, text='1/12th on md and larger'))
Exemplo n.º 18
0
 def __init__(self, view, address):
     super(AddressBox, self).__init__(view)
     formatted_date = babel.dates.format_date(address.added_date,
                                              locale=_.current_locale)
     self.add_child(
         P(view,
           text='%s: %s (%s)' %
           (address.name, address.email_address, formatted_date)))
Exemplo n.º 19
0
 def __init__(self, view, address):
     form_name = 'address_%s' % address.id  # Forms need unique names!
     super(AddressBox, self).__init__(view, form_name)
     paragraph = self.add_child(
         P(view, text='%s: %s ' % (address.name, address.email_address)))
     paragraph.add_child(
         Button(self,
                address.events.edit.with_arguments(address_id=address.id)))
Exemplo n.º 20
0
    def __init__(self, view, event_channel_name, account_management_interface):
        super().__init__(view, event_channel_name)
        self.account_management_interface = account_management_interface

        if self.exception:
            self.add_child(
                Alert(view, self.exception.as_user_message(), 'warning'))

        login_inputs = self.add_child(
            FieldSet(view,
                     legend_text=_('Please specify'))).use_layout(FormLayout())
        email_cue = P(view, _('The email address you used to register here.'))
        login_inputs.layout.add_input(
            CueInput(
                TextInput(self,
                          self.account_management_interface.fields.email),
                email_cue))

        password_cue = P(
            view, _('The secret password you supplied upon registration.'))
        password_cue_input = CueInput(
            PasswordInput(self,
                          self.account_management_interface.fields.password),
            password_cue)
        forgot_password_bookmark = self.user_interface.get_bookmark(
            relative_path='/resetPassword',
            description=_('Forgot your password?'))

        password_cue_input.add_child(
            A.from_bookmark(view, forgot_password_bookmark))
        login_inputs.layout.add_input(password_cue_input)
        stay_cue = P(view,
                     _('If selected, you will stay logged in for longer.'))
        login_inputs.layout.add_input(
            CueInput(
                CheckboxInput(
                    self,
                    self.account_management_interface.fields.stay_logged_in),
                stay_cue))

        login_buttons = self.add_child(ActionButtonGroup(view))
        btn = login_buttons.add_child(
            Button(self,
                   account_management_interface.events.login_event,
                   style='primary'))
Exemplo n.º 21
0
    def __init__(self, view, funding_request, apply_bookmark):
        super(FundingRequestSummary, self).__init__(view)

        self.add_child(H(view, 1, 'Application for Financial Aid'))
        self.add_child(P(view, text='Name: %s' % funding_request.name))
        self.add_child(P(view, text='Surname: %s' % funding_request.surname))
        self.add_child(
            P(view, text='Email: %s' % funding_request.email_address))
        self.add_child(
            P(view, text='Current status: %s.' % funding_request.grant_status))

        self.add_child(H(view, 2, 'Feedback from the financial aid team'))
        if funding_request.feedback_message:
            self.add_child(P(view, text=funding_request.feedback_message))
        else:
            self.add_child(
                P(view,
                  text=
                  'There is no feedback message for you from the organisers'))

        if funding_request.allow_user_changes:
            self.add_child(
                P(view, text='You can still edit/change your request'))
            self.add_child(
                Nav(view).with_bookmarks(
                    [apply_bookmark.with_description('Edit application')]))
Exemplo n.º 22
0
def test_navbar_toggle_requires_target_id(web_fixture, navbar_fixture):
    """To be able to hide an element, it is required to have an id"""

    navbar = navbar_fixture.navbar
    navbar.use_layout(NavbarLayout())
    element_without_id = P(web_fixture.view, text='Peek-A-Boo')

    with expected(ProgrammerError, test='.*has no css_id set.*'):
        navbar.layout.add_toggle(element_without_id)
Exemplo n.º 23
0
            def __init__(self, view):
                super(PopupTestPanel, self).__init__(view)
                popup_a = self.add_child(PopupA(view, view.as_bookmark(), '#contents'))
                popup_contents = self.add_child(P(view, text='this is the content of the popup'))
                popup_contents.set_id('contents')
                form = self.add_child(Form(view, 'aform')).use_layout(FormLayout())
                checkbox = form.layout.add_input(CheckboxInput(form, self.fields.field))

                popup_a.add_js_button('Checkit', CheckCheckboxScript(checkbox))
Exemplo n.º 24
0
    def __init__(self, view, account_management_interface):
        super(ChoosePasswordWidget, self).__init__(view)
        explanation = P(view, text=_('Do you have your secret key? You can only choose a new password if you {reset_password}.'))
        
        link_text = _('previously requested a secret key to be sent to your registered email address')
        step1_bookmark = self.user_interface.get_bookmark(relative_path='/resetPassword', description=link_text)

        self.add_child(explanation.format(reset_password=A.from_bookmark(view, step1_bookmark)))
        self.add_child(ChoosePasswordForm(view, account_management_interface))
Exemplo n.º 25
0
    def create_identification_inputs(self):
        identification_inputs = self.add_child(FieldSet(self.view, legend_text=_('How will you identify yourself?'))).use_layout(FormLayout())

        email_cue = P(self.view, _('You identify yourself to us by your email address.' \
                                   'This information is not divulged to others.'))
        error_message=_('Sorry, you can only register once per email address and someone is ' \
                        'already registered as $value. Did you perhaps register long ago?')

        unique_email_field = self.account_management_interface.fields.email.as_with_validation_constraint(UniqueEmailConstraint(error_message))
        identification_inputs.layout.add_input(CueInput(TextInput(self, unique_email_field), email_cue))

        password_cue = P(self.view, _('Upon logging in, you will be asked for your password. Your password should be a '\
                                 'secret, known only to yourself, and be difficult to guess.') )
        identification_inputs.layout.add_input(CueInput(PasswordInput(self, self.account_management_interface.fields.password),
                                           password_cue))
        repeat_password_cue = P(self.view, _('By typing the same password again you help us to make sure you did not make any typing mistakes.'))
        identification_inputs.layout.add_input(CueInput(PasswordInput(self, self.account_management_interface.fields.repeat_password),
                                           repeat_password_cue))
Exemplo n.º 26
0
    def __init__(self, view):
        super(__class__, self).__init__(view)

        tr = TR.for_current_session()
        my_form = InputForm(view, tr)
        self.add_child(my_form)

        if tr.has_data:
            self.add_child(P(view, text=tr.translated_string))
Exemplo n.º 27
0
    def __init__(self, view):
        super(ContainerPage, self).__init__(view)

        page_layout = PageLayout(contents_layout=CenteredLayout(),
                                 header_layout=Container(fluid=True),
                                 footer_layout=Container(fluid=True))

        self.use_layout(page_layout)

        self.layout.header.add_child(P(view, text='The header'))
        self.layout.footer.add_child(P(view, text='The footer'))

        columns = page_layout.contents_layout.columns
        left = columns['left']
        left.add_child(P(view, text='To the left'))

        right = columns['right']
        right.add_child(P(view, text='To the right'))
Exemplo n.º 28
0
 def __init__(self, view):
     super().__init__(view)
     error_widget = self.body.insert_child(0, ErrorWidget(view))
     error_widget.add_child(H(view, 1, text='Oops, something broke'))
     error_widget.add_child(P(view, text=error_widget.error_message))
     error_widget.add_child(
         A(view,
           Url(error_widget.error_source_href),
           description='Click here to try again'))
Exemplo n.º 29
0
def test_alert_with_widget_as_message(web_fixture):
    """An alert can also be constructed with a widget as message"""

    widget_contained_in_alert = P(web_fixture.view,
                                  text='Consider yourself warned')
    alert = Alert(web_fixture.view, widget_contained_in_alert, 'warning')

    [paragraph] = alert.children
    [message] = paragraph.children
    assert message.value == 'Consider yourself warned'
Exemplo n.º 30
0
 def __init__(self, view):
     super().__init__(view)
     self.add_child(
         PopupA(view,
                view.as_bookmark(),
                '#contents',
                center_vertically=True))
     popup_contents = self.add_child(
         P(view, text='this is the content of the popup'))
     popup_contents.set_id('contents')