Exemple #1
0
    def __init__(self, can_toggle_is_staff, *args, **kwargs):
        super(SuperuserManagementForm, self).__init__(*args, **kwargs)

        if can_toggle_is_staff:
            self.fields['privileges'].choices.append(
                ('is_staff', 'mark as developer'))

        self.helper = FormHelper()
        self.helper.form_class = "form-horizontal"
        self.helper.label_class = 'col-sm-3 col-md-2'
        self.helper.field_class = 'col-sm-9 col-md-8 col-lg-6'
        self.helper.layout = crispy.Layout(
            'csv_email_list', 'privileges',
            FormActions(
                crispy.Submit('superuser_management', 'Update privileges')))
Exemple #2
0
    def __init__(self, *args, **kwargs):
        super(ImportIndicatorsFromJsonFileForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_method = 'POST'
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-8'
        self.helper.layout = crispy.Layout(
            crispy.Field('json_file'),
            crispy.Field('override_existing'),
            FormActions(
                twbs.StrictButton(_("Import Indicators"),
                                  type='submit',
                                  css_class='btn-primary'), ),
        )
Exemple #3
0
    def __init__(self, *args, **kwargs):
        super(ReprocessMessagingCaseUpdatesForm,
              self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_class = "form-horizontal"
        self.helper.form_id = 'reprocess-messaging-updates'
        self.helper.label_class = 'col-sm-3 col-md-2'
        self.helper.field_class = 'col-sm-9 col-md-8'
        self.helper.layout = crispy.Layout(
            FieldWithHelpBubble(
                'case_ids',
                help_bubble_text=_(
                    "Enter a space-separated list of case ids to reprocess. "
                    "Reminder rules will be rerun for the case, and the case's phone "
                    "number entries will be synced."),
            ), FormActions(crispy.Submit('submit', 'Submit')))
Exemple #4
0
    def __init__(self, *args, **kwargs):
        super(AuthenticateAsForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_class = "form-horizontal"
        self.helper.form_id = 'auth-as-form'
        self.helper.label_class = 'col-sm-3 col-md-2'
        self.helper.field_class = 'col-sm-9 col-md-8 col-lg-6'
        self.helper.layout = crispy.Layout(
            'username',
            'domain',
            FormActions(
                crispy.Submit(
                    'authenticate_as',
                    'Authenticate As'
                )
            )
        )
Exemple #5
0
    def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.form_id = 'id-scheduledReportForm'
        self.helper.label_class = 'col-sm-3 col-md-2'
        self.helper.field_class = 'col-sm-9 col-md-8 col-lg-6'
        self.helper.add_layout(
            crispy.Layout(
                crispy.Fieldset(
                    ugettext("Configure Scheduled Report"),
                    'config_ids',
                    'interval',
                    'day',
                    'hour',
                    B3MultiField(
                        ugettext("Send Options"),
                        'send_to_owner'
                    ),
                    B3MultiField(
                        ugettext("Excel Attachment"),
                        'attach_excel'
                    ),
                    crispy.Field(
                        'email_subject',
                        css_class='input-xlarge',
                    ),
                    'recipient_emails',
                    'language',
                    crispy.HTML(
                        render_to_string('reports/partials/privacy_disclaimer.html')
                    )
                ),
                FormActions(
                    crispy.Submit('submit_btn', 'Submit')
                )
            )
        )

        super(ScheduledReportForm, self).__init__(*args, **kwargs)
Exemple #6
0
 def helper(self):
     helper = HQFormHelper()
     from corehq.apps.reports.views import TableauVisualizationListView
     helper.layout = crispy.Layout(
         crispy.Field('server'),
         crispy.Field('view_url'),
         FormActions(
             StrictButton(
                 _("Save"),
                 type="submit",
                 css_class="btn btn-primary",
             ),
             LinkButton(
                 _("Cancel"),
                 reverse(
                     TableauVisualizationListView.urlname,
                     kwargs={'domain': self.domain},
                 ),
                 css_class="btn btn-default",
             ),
         ),
     )
     return helper