コード例 #1
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))
コード例 #2
0
ファイル: accounts.py プロジェクト: xmonader/reahl
    def __init__(self, view, account_management_interface):
        self.account_management_interface = account_management_interface
        super().__init__(view, 'choose_password')

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

        inputs = self.add_child(
            FieldSet(view, legend_text=_('Choose a new password'))).use_layout(
                FormLayout())
        inputs.layout.add_input(
            TextInput(self, account_management_interface.fields.email))
        inputs.layout.add_input(
            TextInput(self, account_management_interface.fields.secret))
        inputs.layout.add_input(
            PasswordInput(self, account_management_interface.fields.password))
        inputs.layout.add_input(
            PasswordInput(self,
                          account_management_interface.fields.repeat_password))

        actions = self.add_child(ActionButtonGroup(view))
        btn = actions.add_child(
            Button(self,
                   account_management_interface.events.choose_password_event))
        btn.use_layout(ButtonLayout(style='primary'))
コード例 #3
0
ファイル: pageflow.py プロジェクト: xmonader/reahl
    def __init__(self, view, comment):
        super().__init__(view, 'myform')
        self.use_layout(FormLayout())

        self.layout.add_input(TextInput(self, comment.fields.email_address))
        self.layout.add_input(TextInput(self, comment.fields.text))
        self.add_child(ButtonInput(self, comment.events.submit))
コード例 #4
0
ファイル: accounts.py プロジェクト: xmonader/reahl
    def __init__(self, view, event_channel_name, account_management_interface):
        self.account_management_interface = account_management_interface
        super().__init__(view, event_channel_name)

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

        identification_inputs = self.add_child(
            FieldSet(view,
                     legend_text=_(
                         'Please supply the following details'))).use_layout(
                             FormLayout())

        identification_inputs.layout.add_input(
            TextInput(self, account_management_interface.fields.email))
        identification_inputs.layout.add_input(
            TextInput(self, account_management_interface.fields.secret))
        identification_inputs.layout.add_input(
            PasswordInput(self, account_management_interface.fields.password))

        actions = self.add_child(ActionButtonGroup(view))
        btn = actions.add_child(
            Button(self, account_management_interface.events.verify_event))
        btn.use_layout(ButtonLayout(style='primary'))
コード例 #5
0
    def __init__(self, view):
        super(CommentForm, self).__init__(view, 'myform')
        comment = Comment()

        layout = ColumnLayout(
            ColumnOptions('left', size=ResponsiveSize(lg=6)),
            ColumnOptions('right', size=ResponsiveSize(lg=6)))

        # .add_child() returns the added child here:
        row = self.add_child(Div(view).use_layout(layout))
        left_column = row.layout.columns['left']

        # ... and .use_layout() returns the Widget it is called on
        section = Div(view).use_layout(FormLayout())
        left_column.add_child(section)

        email_input = TextInput(self, comment.fields.email_address)
        section.layout.add_input(email_input)

        inline_section = Div(view).use_layout(InlineFormLayout())
        left_column.add_child(inline_section)

        text_input = TextInput(self, comment.fields.text)
        inline_section.layout.add_input(text_input)

        right_column = row.layout.columns['right']
        right_column.add_child(
            LiteralHTML.from_restructured_text(
                view, '''
           This form has two columns. Inputs go 
           into the left one and this text into the right one.

           Some inputs are stacked and others are inlined.

           Arbitrarily complicated layouts can be created like this.'''))
コード例 #6
0
 def __init__(self, view):
     super().__init__(view, 'aform')
     self.set_attribute('novalidate', 'novalidate')
     self.use_layout(FormLayout())
     self.layout.add_input(TextInput(self, fixture.domain_object.fields.an_attribute))
     self.layout.add_input(TextInput(self, fixture.domain_object.fields.another_attribute))
     self.define_event_handler(fixture.domain_object.events.submit)
     self.add_child(Button(self, fixture.domain_object.events.submit))
コード例 #7
0
ファイル: datatablebootstrap.py プロジェクト: smohaorg/reahl
    def __init__(self, view, address):
        super().__init__(view, 'edit_form')

        grouped_inputs = self.add_child(FieldSet(view, legend_text='Edit address'))
        grouped_inputs.use_layout(FormLayout())
        grouped_inputs.layout.add_input(TextInput(self, address.fields.name))
        grouped_inputs.layout.add_input(TextInput(self, address.fields.email_address))

        grouped_inputs.add_child(Button(self, address.events.update, style='primary'))
コード例 #8
0
    def __init__(self, view, address):
        super(EditAddressForm, self).__init__(view, 'edit_form')

        grouped_inputs = self.add_child(FieldSet(view, legend_text='Edit address'))
        grouped_inputs.use_layout(FormLayout())
        grouped_inputs.layout.add_input(TextInput(self, address.fields.name))
        grouped_inputs.layout.add_input(TextInput(self, address.fields.email_address))

        btn = grouped_inputs.add_child(Button(self, address.events.update.with_arguments(address_book_id=address.address_book.id)))
        btn.use_layout(ButtonLayout(style='primary'))
コード例 #9
0
ファイル: datatablebootstrap.py プロジェクト: smohaorg/reahl
    def __init__(self, view):
        super().__init__(view, 'add_form')

        new_address = Address()
        grouped_inputs = self.add_child(FieldSet(view, legend_text='Add an address'))
        grouped_inputs.use_layout(FormLayout())
        grouped_inputs.layout.add_input(TextInput(self, new_address.fields.name))
        grouped_inputs.layout.add_input(TextInput(self, new_address.fields.email_address))

        grouped_inputs.add_child(Button(self, new_address.events.save, style='primary'))
コード例 #10
0
    def __init__(self, view, address_book):
        super(AddAddressForm, self).__init__(view, 'add_form')

        new_address = Address(address_book=address_book)

        grouped_inputs = self.add_child(FieldSet(view, legend_text='Add an address'))
        grouped_inputs.use_layout(FormLayout())
        grouped_inputs.layout.add_input(TextInput(self, new_address.fields.name))
        grouped_inputs.layout.add_input(TextInput(self, new_address.fields.email_address))

        btn = grouped_inputs.add_child(Button(self, new_address.events.save.with_arguments(address_book_id=address_book.id)))
        btn.use_layout(ButtonLayout(style='primary'))
コード例 #11
0
    def __init__(self, view, tr):
        super(__class__, self).__init__(view, 'address_form')

        inputs = self.add_child(FieldSet(view, legend_text='Enter data then click button'))
        inputs.use_layout(FormLayout())

        inputs.layout.add_input(TextInput(self, tr.fields.input_text))
        inputs.layout.add_input(TextInput(self, tr.fields.separator), help_text='(Regular expression)')
        inputs.layout.add_input(TextInput(self, tr.fields.joiner), help_text='(Character string)')

        button = inputs.add_child(Button(self, tr.events.save))
        button.use_layout(ButtonLayout(style='primary'))
コード例 #12
0
ファイル: i18nexamplebootstrap.py プロジェクト: diopib/reahl
    def __init__(self, view):
        super(AddAddressForm, self).__init__(view, 'add_form')

        new_address = Address()

        grouped_inputs = self.add_child(FieldSet(view, legend_text=_('Add an address')))
        grouped_inputs.use_layout(FormLayout())
        grouped_inputs.layout.add_input(TextInput(self, new_address.fields.name))
        grouped_inputs.layout.add_input(TextInput(self, new_address.fields.email_address))

        self.define_event_handler(new_address.events.save)
        btn = grouped_inputs.add_child(Button(self, new_address.events.save))
        btn.use_layout(ButtonLayout(style='primary'))
コード例 #13
0
    def __init__(self, form, id_document):
        super().__init__(form.view, legend_text='New investor information', css_id='id_document_section')
        self.enable_refresh()
        self.use_layout(FormLayout())

        self.layout.add_input(SelectInput(form, id_document.fields.document_type,  refresh_widget=self))
        document_type = id_document.document_type
        if document_type == 'passport':
            self.layout.add_input(SelectInput(form, id_document.fields.country))
            self.layout.add_input(TextInput(form, id_document.fields.passport_number))
        elif document_type == 'id_card':
            self.layout.add_input(TextInput(form, id_document.fields.id_card_number))
        else:
            raise Exception(id_document.document_type)
コード例 #14
0
    def add_inputs(self, controls):
        operand_a_input = TextInput(self,
                                    self.calculator.fields.operand_a,
                                    refresh_widget=self)
        controls.layout.add_input(operand_a_input, hide_label=True)

        operator_input = SelectInput(self,
                                     self.calculator.fields.operator,
                                     refresh_widget=self)
        controls.layout.add_input(operator_input, hide_label=True)

        operand_b_input = TextInput(self,
                                    self.calculator.fields.operand_b,
                                    refresh_widget=self)
        controls.layout.add_input(operand_b_input, hide_label=True)
コード例 #15
0
    def __init__(self, view):
        super(CommentForm, self).__init__(view, 'myform')

        new_comment = Comment()
        grouped_inputs = FieldSet(
            view, legend_text='Leave a comment').use_layout(FormLayout())
        self.add_child(grouped_inputs)

        grouped_inputs.layout.add_input(
            TextInput(self, new_comment.fields.email_address))
        grouped_inputs.layout.add_input(
            TextInput(self, new_comment.fields.text))

        self.define_event_handler(new_comment.events.submit)
        grouped_inputs.add_child(ButtonInput(self, new_comment.events.submit))
コード例 #16
0
ファイル: test_form.py プロジェクト: xmonader/reahl
 def __init__(self, view):
     super().__init__(view, 'aform')
     self.use_layout(
         GridFormLayout(ResponsiveSize(lg=4), ResponsiveSize(lg=8)))
     self.layout.add_input(TextInput(
         self, fixture.domain_object.fields.an_attribute),
                           help_text='some help')
コード例 #17
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))
コード例 #18
0
    def __init__(self, view):
        super(CommentForm, self).__init__(view, 'myform')

        new_comment = Comment()
        self.use_layout(FormLayout())
        self.layout.add_input(TextInput(self,
                                        new_comment.fields.email_address))
コード例 #19
0
ファイル: test_cueinput.py プロジェクト: dli7428/reahl
 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)
コード例 #20
0
ファイル: dynamiccontent.py プロジェクト: dli7428/reahl
 def make_allocation_input(self, allocation, field):
     div = Div(self.view).use_layout(FormLayout())
     div.layout.add_input(TextInput(self,
                                    field,
                                    name_discriminator=allocation.fund_code,
                                    refresh_widget=self),
                          hide_label=True)
     return div
コード例 #21
0
ファイル: validation.py プロジェクト: smohaorg/reahl
    def __init__(self, view):
        super().__init__(view, 'myform')

        new_comment = Comment()
        self.use_layout(FormLayout())
        self.layout.add_input( TextInput(self, new_comment.fields.email_address) )

        self.define_event_handler(new_comment.events.do_nothing)
        self.add_child(ButtonInput(self, new_comment.events.do_nothing))
コード例 #22
0
    def __init__(self, view):
        super(CommentForm, self).__init__(view, 'myform')
        self.use_layout(FormLayout())
        comment = Comment()
        email_input = TextInput(self, comment.fields.email_address)
        self.layout.add_input(email_input)

        text_input = TextInput(self, comment.fields.text)
        self.layout.add_input(text_input)

        layout = ColumnLayout(('left', ResponsiveSize(lg=6)),
                              ('right', ResponsiveSize(lg=6)))
        row = self.add_child(Div(view).use_layout(layout))

        left_p = P(view, text='This is in the left column of the row')
        row.layout.columns['left'].add_child(left_p)

        right_p = P(view, text='This is in the right column of the row')
        row.layout.columns['right'].add_child(right_p)
コード例 #23
0
ファイル: access.py プロジェクト: diopib/reahl
    def __init__(self, view):
        super(CommentForm, self).__init__(view, 'myform')
        comment = Comment()

        self.use_layout(FormLayout())

        self.layout.add_input(TextInput(self, comment.fields.greyed_out_field))

        self.define_event_handler(comment.events.greyed_out_event)
        self.add_child(Button(self, comment.events.greyed_out_event))
コード例 #24
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'))
コード例 #25
0
    def add_allocation_controls(self):
        allocation_controls = self.add_child(FieldSet(self.view, legend_text='Investment allocation'))
        allocation_controls.use_layout(FormLayout())

        if self.form.exception:
            self.layout.add_alert_for_domain_exception(self.form.exception, form=self.form, unique_name='details_section')
        
        total_amount_input = TextInput(self.form, self.investment_order.fields.amount, refresh_widget=self)
        allocation_controls.layout.add_input(total_amount_input)

        amount_or_percentage_radio = RadioButtonSelectInput(self.form, self.investment_order.fields.amount_or_percentage, refresh_widget=self)
        allocation_controls.layout.add_input(amount_or_percentage_radio)
コード例 #26
0
    def __init__(self, view, accounts):
        super().__init__(view, 'login')
        self.use_layout(FormLayout())

        if self.exception:
            self.layout.add_alert_for_domain_exception(self.exception)

        self.layout.add_input(TextInput(self, accounts.fields.email))
        self.layout.add_input(PasswordInput(self, accounts.fields.password))

        self.define_event_handler(accounts.events.login_event)
        self.add_child(Button(self, accounts.events.login_event, style='primary'))
コード例 #27
0
ファイル: accounts.py プロジェクト: dli7428/reahl
    def __init__(self, view, account_management_interface):
        super(ResetPasswordForm, self).__init__(view, 'reset_password')

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

        inputs = self.add_child(FieldSet(view, legend_text=_('Request a secret key'))).use_layout(FormLayout())
        inputs.layout.add_input(TextInput(self, account_management_interface.fields.email))

        actions = self.add_child(ActionButtonGroup(view))
        btn = actions.add_child(Button(self, account_management_interface.events.reset_password_event))
        btn.use_layout(ButtonLayout(style='primary'))
コード例 #28
0
        def __init__(self, view):
            super().__init__(view, 'myform')
            self.use_layout(FormLayout())
            model_object = ModelObject()

            if self.exception:
                self.layout.add_alert_for_domain_exception(self.exception)

            self.layout.add_input(TextInput(self, model_object.fields.some_field))

            self.define_event_handler(model_object.events.submit_break)
            self.add_child(Button(self, model_object.events.submit_break))
コード例 #29
0
    def __init__(self, view, accounts):
        super(LoginForm, self).__init__(view, 'login')
        self.use_layout(FormLayout())

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

        self.layout.add_input(TextInput(self, accounts.fields.email))
        self.layout.add_input(PasswordInput(self, accounts.fields.password))

        self.define_event_handler(accounts.events.login_event)
        btn = self.add_child(Button(self, accounts.events.login_event))
        btn.use_layout(ButtonLayout(style='primary'))
コード例 #30
0
ファイル: fileupload.py プロジェクト: smohaorg/reahl
    def __init__(self, view):
        super().__init__(view, 'myform')

        new_comment = Comment()
        grouped_inputs = self.add_child(
            FieldSet(view, legend_text='Leave a comment'))
        grouped_inputs.use_layout(FormLayout())
        grouped_inputs.layout.add_input(
            TextInput(self, new_comment.fields.email_address))
        grouped_inputs.layout.add_input(
            TextInput(self, new_comment.fields.text))

        attachments = self.add_child(FieldSet(view,
                                              legend_text='Attach files'))
        attachments.use_layout(FormLayout())
        attachments.layout.add_input(FileUploadInput(
            self, new_comment.fields.uploaded_files),
                                     hide_label=True)

        self.define_event_handler(new_comment.events.submit)
        self.add_child(
            ButtonInput(self, new_comment.events.submit, style='primary'))