Beispiel #1
0
 def __init__(self, *args, **kwargs):
     super(TelerivetOutgoingSMSForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_class = 'form form-horizontal'
     self.helper.label_class = 'col-sm-2 col-md-1'
     self.helper.field_class = 'col-sm-4 col-md-3'
     self.helper.layout = Layout(
         Div(
             hqcrispy.B3MultiField(
                 _("API Key"),
                 Div(hqcrispy.MultiInlineField('api_key',
                                               ng_model='apiKey')),
                 get_rmi_error_placeholder('apiKeyError'),
                 ng_class="{'has-error': apiKeyError}"),
             hqcrispy.B3MultiField(
                 _("Project ID"),
                 Div(
                     hqcrispy.MultiInlineField('project_id',
                                               ng_model='projectId')),
                 get_rmi_error_placeholder('projectIdError'),
                 ng_class="{'has-error': projectIdError}"),
             hqcrispy.B3MultiField(
                 _("Phone ID"),
                 Div(
                     hqcrispy.MultiInlineField('phone_id',
                                               ng_model='phoneId')),
                 get_rmi_error_placeholder('phoneIdError'),
                 ng_class="{'has-error': phoneIdError}")))
Beispiel #2
0
 def __init__(self, *args, **kwargs):
     super(FinalizeGatewaySetupForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_class = 'form form-horizontal'
     self.helper.label_class = 'col-sm-3 col-md-2'
     self.helper.field_class = 'col-sm-3 col-md-2'
     self.helper.layout = Layout(
         Div(
             hqcrispy.B3MultiField(
                 _("Name"),
                 Div(hqcrispy.MultiInlineField('name', ng_model='name')),
                 get_rmi_error_placeholder('nameError'),
                 ng_class="{'has-error': nameError}"),
             hqcrispy.B3MultiField(
                 _("Set as default gateway"),
                 Div(
                     hqcrispy.MultiInlineField('set_as_default',
                                               ng_model='setAsDefault',
                                               style='margin-left: 0px;')),
                 get_rmi_error_placeholder('setAsDefaultError'),
                 ng_class="{'has-error': setAsDefaultError}"),
             FormActions(
                 StrictButton(_("Complete"),
                              id="id_create_backend",
                              css_class='btn-success',
                              ng_click='createBackend();'))))
Beispiel #3
0
 def __init__(self, *args, **kwargs):
     super(TelerivetPhoneNumberForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_class = 'form form-horizontal'
     self.helper.label_class = 'col-sm-2 col-md-1'
     self.helper.field_class = 'col-sm-4 col-md-3'
     self.helper.layout = Layout(
         Div(
             hqcrispy.B3MultiField(
                 _("Test Phone Number"),
                 Div(
                     hqcrispy.MultiInlineField('test_phone_number',
                                               ng_model='testPhoneNumber')),
                 get_rmi_error_placeholder('testPhoneNumberError'),
                 Div(
                     StrictButton(_("Send"),
                                  id='id_send_sms_button',
                                  css_class='btn btn-success',
                                  ng_click='sendTestSMS();')),
                 ng_class="{'has-error': testPhoneNumberError}")))
Beispiel #4
0
    def __init__(self, *args, **kwargs):
        if 'domain' not in kwargs:
            raise Exception("Expected domain in kwargs")
        self.domain = kwargs.pop('domain')
        super(AddAutomaticCaseUpdateRuleForm, self).__init__(*args, **kwargs)

        # We can't set these fields to be required because they are displayed
        # conditionally and we'll confuse django validation if we make them
        # required. However, we should show the asterisk for consistency, since
        # when they are displayed they are required.
        self.fields['update_property_name'].label = _(
            "Property") + '<span class="asteriskField">*</span>'
        self.fields['update_property_value'].label = _(
            "Value") + '<span class="asteriskField">*</span>'

        if AUTO_CASE_UPDATES.enabled(self.domain):
            self.allow_updates_without_closing()

        self.set_case_type_choices(self.initial.get('case_type'))
        self.helper = FormHelper()
        self.helper.form_class = 'form form-horizontal'
        self.helper.label_class = 'col-sm-3 col-md-2'
        self.helper.field_class = 'col-sm-4 col-md-3'
        self.helper.form_method = 'POST'
        self.helper.form_action = '#'
        self.helper.layout = Layout(
            Fieldset(
                _("Basic Information"),
                Field(
                    'name',
                    ng_model='name',
                ),
                Field(
                    'case_type',
                    ng_model='case_type',
                ),
                hqcrispy.B3MultiField(
                    _("Close Case") + '<span class="asteriskField">*</span>',
                    Div(
                        hqcrispy.MultiInlineField(
                            'server_modified_boundary',
                            ng_model='server_modified_boundary',
                        ),
                        css_class='col-sm-6',
                    ),
                    Div(
                        HTML('<label class="control-label">%s</label>' %
                             _('days after the case was last modified.')),
                        css_class='col-sm-6',
                    ),
                    help_bubble_text=_(
                        "This will close the case if it has been "
                        "more than the chosen number of days since "
                        "the case was last modified. Cases are "
                        "checked against this rule weekly."),
                    css_id='server_modified_boundary_multifield',
                    label_class=self.helper.label_class,
                    field_class='col-sm-8 col-md-6',
                ),
                Field(
                    'action',
                    ng_model='action',
                ),
                Div(
                    Field(
                        'update_property_name',
                        ng_model='update_property_name',
                        css_class='case-property-typeahead',
                    ),
                    Field(
                        'update_property_value',
                        ng_model='update_property_value',
                    ),
                    ng_show='showUpdateProperty()',
                ),
            ),
            Fieldset(
                _("Filter Cases to Close (Optional)"),
                Field(
                    'conditions',
                    type='hidden',
                    ng_value='conditions',
                ),
                Div(ng_include='', src="'conditions.tpl'"),
            ),
            FormActions(
                StrictButton(
                    _("Save"),
                    type='submit',
                    css_class='btn btn-primary col-sm-offset-1',
                ), ),
        )