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}")))
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();'))))
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', data_bind='value: apiKey', )), crispy.Div( css_class="help-block", data_bind="visible: apiKeyError, text: apiKeyError", ), data_bind="css: {'has-error': apiKeyError}", ), hqcrispy.B3MultiField( _("Project ID"), Div( hqcrispy.MultiInlineField( 'project_id', data_bind='value: projectId', )), crispy.Div( css_class="help-block", data_bind= "visible: projectIdError, text: projectIdError", ), data_bind="css: {'has-error': projectIdError}", ), hqcrispy.B3MultiField( _("Phone ID"), Div( hqcrispy.MultiInlineField( 'phone_id', data_bind='value: phoneId', )), crispy.Div( css_class="help-block", data_bind="visible: phoneIdError, text: phoneIdError", ), data_bind="css: {'has-error': phoneIdError}", )))
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', data_bind='value: testPhoneNumber', )), crispy.Div( css_class="help-block", data_bind= "visible: testPhoneNumberError, text: testPhoneNumberError", ), Div( StrictButton( "", id='id_send_sms_button', css_class='btn', data_bind= "text: sendSmsButtonText, click: sendTestSMS, " "css: {'btn-primary': !sendSmsButtonError(), " "'btn-danger': sendSmsButtonError()}", )), data_bind="css: {'has-error': testPhoneNumberError}", )))
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}" ) ) )
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', data_bind='value: name', )), crispy.Div( css_class="help-block", data_bind="visible: nameError, text: nameError", ), data_bind="css: {'has-error': nameError}", ), hqcrispy.B3MultiField( _("Set as default gateway"), Div( hqcrispy.MultiInlineField( 'set_as_default', data_bind='value: setAsDefault', style='margin-left: 0px;')), crispy.Div( css_class="help-block", data_bind= "visible: setAsDefaultError, text: setAsDefaultError", ), data_bind="css: {'has-error': setAsDefaultError}", ), FormActions( StrictButton( "", id="id_create_backend", css_class='btn-primary', data_bind= "text: backendButtonText, click: createBackend, disable: creatingBackend," "css: {'btn-primary': !backendButtonError(), " "'btn-danger': backendButtonError()}", ))))
def __init__(self, *args, **kwargs): if 'domain' not in kwargs: raise Exception("Expected domain in kwargs") self.domain = kwargs.pop('domain') self.enhancements_enabled = AUTO_CASE_UPDATE_ENHANCEMENTS.enabled( self.domain) super(AddAutomaticCaseUpdateRuleForm, self).__init__(*args, **kwargs) if not self.enhancements_enabled: # Always set the value of filter_on_server_modified to true when the # enhancement toggle is not set self.data = self.data.copy() self.initial['filter_on_server_modified'] = 'true' self.data['filter_on_server_modified'] = 'true' # 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>' 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 = '#' if self.enhancements_enabled: self.allow_updates_without_closing() _update_property_fields = [ _f for _f in [ Field( 'update_property_name', ng_model='update_property_name', css_class='case-property-typeahead', ), Field( 'property_value_type', ng_model='property_value_type', ) if self.enhancements_enabled else None, Field( 'update_property_value', ng_model='update_property_value', ) ] if _f ] _basic_info_fields = [ _f for _f in [ Field( 'name', ng_model='name', ), Field( 'case_type', ng_model='case_type', ), Field( 'filter_on_server_modified', ng_model='filter_on_server_modified', ) if self.enhancements_enabled else None, 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', ng_show='showServerModifiedBoundaryField()', ), Field( 'action', ng_model='action', ), Div(*_update_property_fields, ng_show='showUpdateProperty()') ] if _f ] self.set_case_type_choices(self.initial.get('case_type')) self.helper.layout = Layout( Fieldset(_("Basic Information"), *_basic_info_fields), 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', ), ), )