예제 #1
0
    def __init__(self, view, address_book):
        super().__init__(view, 'add_collaborator_form')

        grouped_inputs = self.add_child(FieldSet(view, legend_text='Add a collaborator'))
        grouped_inputs.use_layout(FormLayout())
        grouped_inputs.layout.add_input(SelectInput(self, address_book.fields.chosen_collaborator))

        rights_inputs = grouped_inputs.add_child(FieldSet(view, legend_text='Rights'))
        rights_inputs.use_layout(FormLayout())
        rights_inputs.layout.add_input(CheckboxInput(self, address_book.fields.may_edit_address))
        rights_inputs.layout.add_input(CheckboxInput(self, address_book.fields.may_add_address))

        grouped_inputs.add_child(Button(self, address_book.events.add_collaborator.with_arguments(address_book_id=address_book.id), style='primary'))
예제 #2
0
    def __init__(self, form, investment_order):
        super().__init__(form.view, css_id='investor_details_section')
        self.enable_refresh()
        self.use_layout(FormLayout())

        investor_info = self.add_child(
            FieldSet(self.view, legend_text='Investor information'))
        investor_info.use_layout(FormLayout())

        if investment_order.new_or_existing == 'new':
            investor_info.layout.add_input(
                TextInput(form, investment_order.fields.name))
            investor_info.layout.add_input(
                TextInput(form, investment_order.fields.surname))
            self.add_child(
                IDDocumentSection(form, investment_order.id_document))

        elif investment_order.new_or_existing == 'existing':
            investor_info.layout.add_input(
                TextInput(form,
                          investment_order.fields.existing_account_number))

        self.layout.add_input(
            CheckboxInput(form,
                          investment_order.fields.agreed_to_terms,
                          refresh_widget=self))
        if investment_order.agreed_to_terms:
            self.add_child(AllocationDetailSection(form, investment_order))
예제 #3
0
파일: test_form.py 프로젝트: xmonader/reahl
 def __init__(self, view):
     super().__init__(view, 'aform')
     self.use_layout(FormLayout())
     self.layout.add_input(
         CheckboxInput(self,
                       fixture.domain_object.fields.an_attribute))
     self.define_event_handler(fixture.domain_object.events.submit)
     self.add_child(
         Button(self, fixture.domain_object.events.submit))
예제 #4
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))
예제 #5
0
    def __init__(self, view, event_channel_name):
        super().__init__(view, event_channel_name)
        self.use_layout(FormLayout())
        model_object = ModelObject()
        self.layout.add_input(
            TextInput(self, model_object.fields.text_input_field))
        self.layout.add_input(
            CheckboxInput(self, model_object.fields.boolean_field))
        self.layout.add_input(
            PasswordInput(self, model_object.fields.password_field))
        self.layout.add_input(
            TextArea(self,
                     model_object.fields.text_area_field,
                     rows=5,
                     columns=60))
        self.layout.add_input(
            SelectInput(self, model_object.fields.choice_field))
        self.layout.add_input(
            SelectInput(self, model_object.fields.multi_choice_field))
        self.layout.add_input(
            CheckboxInput(self,
                          model_object.fields.another_multi_choice_field))
        self.layout.add_input(
            RadioButtonSelectInput(self,
                                   model_object.fields.radio_choice_field,
                                   contents_layout=ChoicesLayout(inline=True)))
        self.layout.add_input(
            TextInput(self, model_object.fields.fuzzy_date_field, fuzzy=True))
        self.layout.add_input(TextInput(
            self,
            model_object.fields.text_input_without_label,
            placeholder=True),
                              hide_label=True)
        self.layout.add_input(
            CueInput(TextInput(self, model_object.fields.cue_field),
                     P(view, text='This is a cue')))
        self.define_event_handler(model_object.events.do_something)

        self.add_child(
            ButtonInput(self,
                        model_object.events.do_something,
                        style='primary'))
예제 #6
0
파일: accounts.py 프로젝트: dli7428/reahl
    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'))
예제 #7
0
파일: accounts.py 프로젝트: smohaorg/reahl
    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'))
예제 #8
0
파일: test_form.py 프로젝트: diopib/reahl
 def __init__(self, view):
     super(FormWithInputWithCheckbox, self).__init__(view, 'aform')
     self.use_layout(FormLayout())
     self.layout.add_input(
         CheckboxInput(self, fixture.domain_object.fields.an_attribute))