def test_accordion_active_false_not_rendered(self, settings):
        test_form = SampleForm()
        test_form.helper = FormHelper()
        test_form.helper.layout = Layout(
            Accordion(AccordionGroup(
                "one",
                "first_name",
            ),
                      # there is no ``active`` kwarg here.
                      ))

        # The first time, there should be one of them there.
        html = render_crispy_form(test_form)

        if settings.CRISPY_TEMPLATE_PACK == "css":
            accordion_class = "accordion-body collapse in"
        elif settings.CRISPY_TEMPLATE_PACK == "bootstrap3":
            accordion_class = "panel-collapse collapse in"
        elif settings.CRISPY_TEMPLATE_PACK == "bootstrap4":
            accordion_class = "collapse show"

        assert html.count('<div id="one" class="%s"' % accordion_class) == 1

        test_form.helper.layout = Layout(
            Accordion(AccordionGroup(
                "one",
                "first_name",
                active=False,
            ), )  # now ``active`` manually set as False
        )

        # This time, it shouldn't be there at all.
        html = render_crispy_form(test_form)
        assert html.count('<div id="one" class="%s collapse in"' %
                          accordion_class) == 0
Example #2
0
    def test_accordion_active_false_not_rendered(self):
        test_form = SampleForm()
        test_form.helper = FormHelper()
        test_form.helper.layout = Layout(
            Accordion(AccordionGroup("one", "first_name"),
                      # there is no ``active`` kwarg here.
                      ))

        # The first time, there should be one of them there.
        html = render_crispy_form(test_form)

        accordion_class = "collapse show"

        assert (html.count('<div id="one" class="accordion-collapse %s"' %
                           accordion_class) == 1)

        test_form.helper.layout = Layout(
            Accordion(AccordionGroup("one", "first_name", active=False),
                      )  # now ``active`` manually set as False
        )

        # This time, it shouldn't be there at all.
        html = render_crispy_form(test_form)
        assert (html.count('<div id="one" class="accordion-collapse %s"' %
                           accordion_class) == 0)
    def test_accordion_and_accordiongroup(self, settings):
        test_form = TestForm()
        test_form.helper = FormHelper()
        test_form.helper.layout = Layout(
            Accordion(
                AccordionGroup(
                    'one',
                    'first_name'
                ),
                AccordionGroup(
                    'two',
                    'password1',
                    'password2'
                )
            )
        )
        html = render_crispy_form(test_form)

        if settings.CRISPY_TEMPLATE_PACK == 'bootstrap':
            assert html.count('<div class="accordion"') == 1
            assert html.count('<div class="accordion-group">') == 2
            assert html.count('<div class="accordion-heading">') == 2
        else:
            assert html.count('<div class="panel panel-default"') == 2
            assert html.count('<div class="panel-group"') == 1
            assert html.count('<div class="panel-heading">') == 2

        assert html.count('<div id="one"') == 1
        assert html.count('<div id="two"') == 1
        assert html.count('name="first_name"') == 1
        assert html.count('name="password1"') == 1
        assert html.count('name="password2"') == 1
Example #4
0
 def __init__(self, *args, **kwargs):
     super(BomberFilterFormHelper, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.form_class = 'genericFilterForm'
     self.form_method = 'GET'
     self.helper.form_tag = False
     self.add_input(Submit('Filter', 'Search'))
     self.layout = Layout(
         Fieldset(
             'Basic search options',
             'name',
             'macr_nr',
             css_id="basic_search_fields"
             ),
         Accordion(
             AccordionGroup(
                 'Advanced search',
                 'target_place',
                 'crash_place',
                 'squadron',
                 'reason_of_crash',
                 css_id="more"
                 ),
             )
         )
Example #5
0
 def __init__(self, *args, **kwargs):
     super(TabGenerationOptionsForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.layout = Layout(
         Div(Div(HTML('<h3>Generation Options</h3>'), css_class='col-md-9'),
             Div(FormActions(
                 Submit('submit', 'Generate', style="margin-top: 20px;")),
                 css_class='col-md-3'),
             css_class='row'),
         Div(
             Div(
                 Accordion(
                     AccordionGroup('Expansion Selection', 'expansions'),
                     AccordionGroup('Global Style', 'cropmarks', 'wrappers',
                                    'tabsonly', 'no_footer'),
                     AccordionGroup('Sizes and Orientation', 'orientation',
                                    'pagesize', 'cardsize'),
                     AccordionGroup('Divider Layout', 'tab_side',
                                    'tab_name_align', 'set_icon',
                                    'cost_icon', 'counts'),
                     AccordionGroup('Text Options', 'divider_front_text',
                                    'divider_back_text', 'language'),
                     AccordionGroup('Order, Groups and Extras', 'order',
                                    'group_special', 'expansion_dividers'),
                 ),
                 css_class='col-md-12',
             ),
             css_class='row',
         ))
     self.helper.form_id = 'id-tabgenoptions'
     self.helper.form_class = 'blueForms'
     self.helper.form_method = 'post'
     self.helper.form_action = '/'
     for field in self.fields.itervalues():
         field.required = False
Example #6
0
class NewInfrastructureForm(forms.ModelForm):
    helper = FormHelper()
    helper.form_tag = False  # removes auto-inclusion of form tag in template
    helper.disable_csrf = True

    helper.layout = Layout(
        Accordion(
            AccordionGroup(
                _('New Infrastructure Details'),
                Field('geom', type='hidden', id='newInfraPoint'),
                Field('dateAdded',
                      id='newInfrastructure_date',
                      template='mapApp/util/%s_datepicker.html',
                      autocomplete='off'),
                Field('infra_type', id=''),
                Field('expires_date',
                      id='newInfrastructure_expiresDate',
                      template='mapApp/util/%s_datepicker_future.html',
                      autocomplete='off'),
                Field('infraDetails',
                      default='Previous reports at this location were reset.'),
            ), ))

    class Meta:
        model = NewInfrastructure
        exclude = ['p_type', 'date', 'details']
    def test_accordion_and_accordiongroup(self, settings):
        test_form = SampleForm()
        test_form.helper = FormHelper()
        test_form.helper.layout = Layout(
            Accordion(AccordionGroup("one", "first_name"),
                      AccordionGroup("two", "password1", "password2")))
        html = render_crispy_form(test_form)

        if settings.CRISPY_TEMPLATE_PACK == "css":
            assert html.count('<div class="accordion"') == 1
            assert html.count('<div class="accordion-group">') == 2
            assert html.count('<div class="accordion-heading">') == 2
        elif settings.CRISPY_TEMPLATE_PACK == "bootstrap3":
            assert html.count('<div class="panel panel-default"') == 2
            assert html.count('<div class="panel-group"') == 1
            assert html.count('<div class="panel-heading">') == 2
        elif settings.CRISPY_TEMPLATE_PACK == "bootstrap4":
            assert html.count('<div id="accordion"') == 1
            assert html.count('<div class="card mb-2"') == 2
            assert html.count('<div class="card-header"') == 2

        assert html.count('<div id="one"') == 1
        assert html.count('<div id="two"') == 1
        assert html.count('name="first_name"') == 1
        assert html.count('name="password1"') == 1
        assert html.count('name="password2"') == 1
    def test_accordion_and_accordiongroup(self, settings):
        test_form = SampleForm()
        test_form.helper = FormHelper()
        test_form.helper.layout = Layout(
            Accordion(
                AccordionGroup("one", "first_name"),
                AccordionGroup("two", "password1", "password2"),
            ))
        html = render_crispy_form(test_form)

        if settings.CRISPY_TEMPLATE_PACK == "bootstrap":
            assert html.count('<div class="accordion"') == 1
            assert html.count('<div class="accordion-group">') == 2
            assert html.count('<div class="accordion-heading">') == 2
        elif settings.CRISPY_TEMPLATE_PACK == "bootstrap3":
            assert html.count('<div class="panel panel-default"') == 2
            assert html.count('<div class="panel-group"') == 1
            assert html.count('<div class="panel-heading">') == 2
        elif settings.CRISPY_TEMPLATE_PACK == "bootstrap4":
            match = re.search('div id="(accordion-\\d+)"', html)
            assert match

            accordion_id = match.group(1)

            assert html.count('<div class="card mb-2"') == 2
            assert html.count('<div class="card-header"') == 2

            assert html.count('data-parent="#{}"'.format(accordion_id)) == 2

        assert html.count('<div id="one"') == 1
        assert html.count('<div id="two"') == 1
        assert html.count('name="first_name"') == 1
        assert html.count('name="password1"') == 1
        assert html.count('name="password2"') == 1
Example #9
0
    def __init__(self, *args, **kwargs):
        self.user = kwargs.pop('user', None)
        super(Kv17ChangeForm, self).__init__(*args, **kwargs)

        days = [[
            str(d['date'].strftime('%Y-%m-%d')),
            str(d['date'].strftime('%d-%m-%Y'))
        ] for d in Kv1JourneyDate.objects.all().filter(
            date__gte=datetime.today() -
            timedelta(days=1)).values('date').distinct('date').order_by('date')
                ]

        operating_day = days[((datetime.now().hour < 4) * -1) +
                             1] if len(days) > 1 else None
        self.fields['operatingday'].choices = days
        self.fields['operatingday'].initial = operating_day
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.layout = Layout(
            Accordion(
                AccordionGroup(_('Datum en tijd'), 'operatingday',
                               'begintime_part', 'endtime_part'),
                AccordionGroup(_('Oorzaak'), 'reasontype', 'subreasontype',
                               'reasoncontent'),
                AccordionGroup(_('Advies'), 'advicetype', 'subadvicetype',
                               'advicecontent')))
Example #10
0
 def __init__(self, *args, **kwargs):
     super(TextFilterFormHelper, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.form_class = 'genericFilterForm'
     self.form_method = 'GET'
     self.helper.form_tag = False
     self.add_input(Submit('Filter', 'Search'))
     self.layout = Layout(
         Fieldset(
             'Basic search options',
             'id',
             css_id="basic_search_fields"
         ),
         Accordion(
             AccordionGroup(
                 'Advanced search',
                 'legacy_pk',
                 'autor',
                 'title',
                 'jahrhundert',
                 'start_date',
                 'end_date',
                 'edition',
                 'art',
                 'ort',
                 'kommentar',
                 css_id="more"
             ),
             AccordionGroup(
                 'admin',
                 'legacy_id',
                 css_id="admin_search"
             ),
         )
     )
Example #11
0
 def __init__(self, *args, **kwargs):
     super(UseCaseFilterFormHelper, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.form_class = 'genericFilterForm'
     self.form_method = 'GET'
     self.helper.form_tag = False
     self.add_input(Submit('Filter', 'Search'))
     self.layout = Layout(
         Fieldset(
             'Basic search options',
             'title',
             'principal_investigator',
             css_id="basic_search_fields"
         ),
         Accordion(
             AccordionGroup(
                 'Advanced search',
                 'pi_norm_id',
                 'description',
                 'has_stelle__text',
                 'has_stelle__text__autor',
                 'has_stelle__key_word',
                 css_id="more"
             )
         )
     )
Example #12
0
 def __init__(self, *args, **kwargs):
     super(KeyWordFilterFormHelper, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.form_class = 'genericFilterForm'
     self.form_method = 'GET'
     self.helper.form_tag = False
     self.add_input(Submit('Filter', 'Search'))
     self.layout = Layout(
         Fieldset(
             'Basic search options',
             'id',
             css_id="basic_search_fields"
         ),
         Accordion(
             AccordionGroup(
                 'Advanced search',
                 'legacy_pk',
                 'stichwort',
                 'rvn_stelle_key_word_keyword__text__autor',
                 'art',
                 'wurzel',
                 'kommentar',
                 'varianten',
                 'rvn_stelle_key_word_keyword',
                 'rvn_stelle_key_word_keyword__text',
                 'rvn_stelle_key_word_keyword__text__autor__ort',
                 css_id="more"
             ),
             AccordionGroup(
                 'admin',
                 'legacy_id',
                 css_id="admin_search"
             ),
         )
     )
Example #13
0
 def __init__(self, *args, **kwargs):
     super(StelleFilterFormHelper, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.form_class = 'genericFilterForm'
     self.form_method = 'GET'
     self.helper.form_tag = False
     self.add_input(Submit('Filter', 'Search'))
     self.layout = Layout(
         Fieldset(
             'Basic search options',
             'id',
             'text',
             'key_word',
             'use_case',
             css_id="basic_search_fields"
         ),
         Accordion(
             AccordionGroup(
                 'Advanced search',
                 'legacy_pk',
                 'summary',
                 'zitat',
                 'translation',
                 'kommentar',
                 css_id="more"
             ),
             AccordionGroup(
                 'admin',
                 'legacy_id',
                 css_id="admin_search"
             ),
         )
     )
Example #14
0
 def __init__(self, *args, **kwargs):
     super(TuckBoxForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.layout = Layout(
         Div(Div(HTML('<h3>Generation Options</h3>'), css_class='col-md-9'),
             Div(FormActions(
                 Submit('submit', 'Generate', style="margin-top: 20px;")),
                 css_class='col-md-3'),
             css_class='row'),
         Div(
             Div(
                 Accordion(
                     AccordionGroup('Measurements', 'width', 'height',
                                    'depth'),
                     AccordionGroup('Images', 'front_image', 'side_image',
                                    'back_image', 'end_image',
                                    'fill_colour', 'preserve_side_aspect',
                                    'preserve_end_aspect')),
                 css_class='col-md-12',
             ),
             'tag',
             css_class='row',
         ))
     self.helper.form_id = 'id-tabgenoptions'
     self.helper.form_class = 'blueForms'
     self.helper.form_method = 'post'
     self.helper.form_action = '/tuckboxes/'
     for field in self.fields.values():
         field.required = False
Example #15
0
 def __init__(self, *args, **kwargs):
     super(TrpTranscriptFilterFormHelper, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.form_class = 'genericFilterForm'
     self.form_method = 'GET'
     self.helper.form_tag = False
     self.add_input(Submit('Filter', 'Search'))
     self.layout = Layout(
         Fieldset('Basic search options',
                  'id',
                  css_id="basic_search_fields"),
         Accordion(
             AccordionGroup('Advanced search',
                            'following',
                            'transcript_key',
                            'part_of',
                            'part_of_document',
                            'transcript_url',
                            'status',
                            'transcriber',
                            'transcriber_id',
                            'timestamp',
                            'nr_of_regions',
                            'nr_of_transcribed_regions',
                            'nr_of_words_in_regions',
                            'nr_of_lines',
                            'nr_of_words_in_lines',
                            'nr_of_words',
                            'gt_id',
                            css_id="more"),
             AccordionGroup('admin', 'legacy_id', css_id="admin_search"),
         ))
Example #16
0
 def __init__(self, *args, **kwargs):
     super(TrpPageFilterFormHelper, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.form_class = 'genericFilterForm'
     self.form_method = 'GET'
     self.helper.form_tag = False
     self.add_input(Submit('Filter', 'Search'))
     self.layout = Layout(
         Fieldset('Basic search options',
                  'id',
                  css_id="basic_search_fields"),
         Accordion(
             AccordionGroup('Advanced search',
                            'part_of',
                            'page_nr',
                            'page_key',
                            'image_id',
                            'page_url',
                            'thum_url',
                            'img_file_name',
                            'width',
                            'height',
                            'created',
                            'indexed',
                            css_id="more"),
             AccordionGroup('admin', 'legacy_id', css_id="admin_search"),
         ))
Example #17
0
    def __init__(self, *args, **kwargs):
        self.user_delegation = kwargs.pop('user_delegation')
        super(LanguageForm, self).__init__(*args, **kwargs)
        instance = getattr(self, 'instance', None)
        if instance and instance.pk:
            self.fields['name'].widget.attrs['readonly'] = True

        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field('name', placeholder='Name'),
            Field('style'),
            Accordion(
                AccordionGroup(
                    'Advanced settings',
                    Field('direction'),
                    Field('polyglossia'),
                    Field('polyglossia_options'),
                    Field('font'),
                    active=False,
                ),
            ),
        )
        self.helper.html5_required = True
        self.helper.form_show_labels = True
        self.form_tag = False
        self.helper.disable_csrf = True
Example #18
0
 def __init__(self, *args, **kwargs):
     super(PersonFilterFormHelper, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.form_class = 'genericFilterForm'
     self.form_method = 'GET'
     self.helper.form_tag = False
     self.add_input(Submit('Filter', 'Search'))
     self.layout = Layout(
         Accordion(
             AccordionGroup('Namen, Geschlecht',
                            'name',
                            'forename',
                            'written_name',
                            'gender',
                            css_id="basic_search_fields"),
             AccordionGroup('Berufe, Orte',
                            'belongs_to_place',
                            'profession',
                            css_id="more"),
             AccordionGroup('Erwähnungen',
                            'is_main_vfbr',
                            'is_main',
                            'is_adm',
                            'is_related',
                            'is_other',
                            css_id="mentions"),
             AccordionGroup('Duplikate',
                            'dedupe_cluster_id',
                            css_id="duplicates"),
         ))
Example #19
0
 def __init__(self, *args, **kwargs):
     super(DomainFilter, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_method = "get"
     self.helper.form_class = "newitem"
     self.helper.form_show_labels = False
     # Layout the form for Bootstrap
     self.helper.layout = Layout(
         Row(
             Column(
                 PrependedText("name", '<i class="fas fa-filter"></i>'),
                 css_class="col-md-4 offset-md-2",
             ),
             Column(
                 PrependedText("all_cat", '<i class="fas fa-filter"></i>'),
                 css_class=" col-md-4",
             ),
             css_class="form-row",
         ),
         Accordion(
             AccordionGroup("Domain Status",
                            InlineCheckboxes("domain_status")),
             AccordionGroup("Health Status",
                            InlineCheckboxes("health_status")),
         ),
         ButtonHolder(
             Submit("submit_btn",
                    "Filter",
                    css_class="btn btn-primary col-md-2"),
             HTML("""
                 <a class="btn btn-outline-secondary col-md-2" role="button" href="{%  url 'shepherd:domains' %}">Reset</a>
                 """),
         ),
     )
Example #20
0
 def __init__(self, *args, **kwargs):
     super(TempSpatialFilterFormHelper, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.form_class = 'genericFilterForm'
     self.form_method = 'GET'
     self.helper.form_tag = False
     self.add_input(Submit('Filter', 'Search'))
     self.layout = Layout(
         Fieldset(
             'Basic search options',
             'all_name',
             'name',
             'alt_name',
             css_id="basic_search_fields"
             ),
         Accordion(
             AccordionGroup(
                 'Advanced search',
                 'start_date',
                 'end_date',
                 'administrative_unit',
                 'source',
                 css_id="more"
                 ),
             )
         )
Example #21
0
    def __init__(self, *args, **kwargs):
        user = kwargs.pop('user', None)

        if user:
            kwargs.update(initial={
                'displayToUsers': [user.id,],
                'submissionUser': user.id,
            })

        super(AddPrivateEventForm,self).__init__(*args,**kwargs)
        self.fields['submissionUser'].widget = forms.HiddenInput()
        self.fields['status'].widget = forms.HiddenInput()
        self.fields['status'].initial = Event.RegStatus.hidden
        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.form_tag = False  # Our template must explicitly include the <form tag>
        self.helper.layout = Layout(
            'status',
            'submissionUser',
            'title',
            Div(
                Field('category', wrapper_class='col'),
                Field('visibleTo', wrapper_class='col'),
                css_class='form-row'),
            Div('displayToUsers'),
            Div('displayToGroup'),
            Accordion(
                AccordionGroup(_('Add A Description'),'descriptionField',active=False),
                AccordionGroup(_('Add A Location'),Div('location','room','locationString')),
                AccordionGroup(_('Add a Link'),'link'),
            ),
        )
Example #22
0
    def __init__(self, *args, **kwargs):
        super(InstitutionEditForm, self).__init__(*args, **kwargs)

        # If you pass FormHelper constructor a form instance
        # It builds a default layout with all its fields
        self.helper = FormHelper(self)
        self.helper.layout = Layout(
            Accordion(
                AccordionGroup(
                    'General',
                    Field('name'),
                    Field('active'),
                    Field('email'),
                    Field('phone'),
                    Field('domain'),
                    Field('institution_unit'),
                    Field('public_certificate'),
                    # Field('public_key'),
                    active=True,
                ),
                AccordionGroup('Avanzado',
                               Field('bccr_negocio'),
                               Field('bccr_entidad'),
                               active=False)),
            Submit('save', 'save'))
Example #23
0
    def _init_form_layout(self):
        # Add Details section
        accordion_groups = [
            AccordionGroup(
                "Host Details",
                "mac_address",
                "hostname",
                self.primary_address_html,
                self.secondary_address_html,
                "address_type",
                "network_or_ip",
                "network",
                "ip_address",
                self.expire_date,
                "expire_days",
                "description",
                PrependedText("show_hide_dhcp_group", ""),
                "dhcp_group",
            )
        ]

        # Add owners and groups section
        accordion_groups.append(AccordionGroup("Owners", "user_owners", "group_owners"))

        # Add attributes section
        accordion_groups.append(AccordionGroup(*self.attribute_field_keys))

        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.label_class = "col-sm-2 col-md-2 col-lg-2"
        self.helper.field_class = "col-sm-6 col-md-6 col-lg-6"
        self.helper.layout = Layout(Accordion(*accordion_groups))
Example #24
0
 def __init__(self, *args, **kwargs):
     super(UserPreferencesForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_class = 'wger-form'
     self.helper.layout = Layout(
         Accordion(
             AccordionGroup(_("Email"),
                            'email',
                            Row(Column('first_name', css_class='form-group col-6 mb-0'),
                                Column('last_name', css_class='form-group col-6 mb-0'),
                                css_class='form-row'),
                            ),
             AccordionGroup(_("Workout reminders"),
                            'workout_reminder_active',
                            'workout_reminder',
                            'workout_duration',
                            ),
             AccordionGroup("{} ({})".format(_("Gym mode"), _("mobile version only")),
                            "timer_active",
                            "timer_pause"
                            ),
             AccordionGroup(_("Other settings"),
                            "ro_access",
                            "notification_language",
                            "weight_unit",
                            "show_comments",
                            "show_english_ingredients",
                            "num_days_weight_reminder",
                            "birthdate",
                            )
         ),
         ButtonHolder(Submit('submit', _("Save"), css_class='btn-success btn-block'))
     )
Example #25
0
 def __init__(self, *args, **kwargs):
     self.helper = FormHelper()
     self.helper.form_tag = False
     self.helper.form_show_labels = False
     self.helper.layout = Layout(
         Accordion(
             AccordionGroup('Event Details',
                 PrependedText('title', 'Title', placeholder="Title of the Event"),
                 Div(
                     PrependedAppendedText('start_time', 'Begins', '<span class="glyphicon glyphicon-calendar"></span>', placeholder="dd/mm/yyyy hh:mm"),
                         css_class="input-group date col-sm-6"
                 ),
                 Div(
                     PrependedAppendedText('end_time', 'Ends', '<span class="glyphicon glyphicon-calendar"></span>', placeholder="dd/mm/yyyy hh:mm"),
                         css_class="input-group date col-sm-6"
                 )
             ),
             AccordionGroup('Voters',
                 'voters',
                 HTML("<p>Comma seperated (.csv) file of valid email addresses</p>"),
                 'votersTextFile'
             ),
         ),
     )
     super(EventEditForm, self).__init__(*args, **kwargs)
Example #26
0
 def __init__(self, *args, **kwargs):
     super(PolygonLayerStyleForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_tag = False
     self.helper.disable_csrf = True
     self.helper.label_class = 'col-lg-5'
     self.helper.field_class = 'col-lg-7'
     self.helper.layout = Layout(
         Accordion(
             AccordionGroup('Style options',
                            Field('fill', css_class='spectrum'),
                            'fill_opacity',
                            Field('stroke_color', css_class='spectrum'),
                            'stroke_width',
                            'stroke_opacity',
                            'stroke_offset',
                            'dash_array',
                            active=True),
             AccordionGroup('Advanced options',
                            'gamma',
                            'gamma_method',
                            'smooth',
                            'simplify_tolerance',
                            active=False),
             AccordionGroup('Filter & constraints',
                            'filter',
                            'minScale',
                            'maxScale',
                            active=False)),
         Div('id', 'DELETE', css_class="hiddenDiv", style="display:none"))
Example #27
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_method = "get"
     self.helper.form_class = "newitem"
     self.helper.form_show_labels = False
     # Layout the form for Bootstrap
     self.helper.layout = Layout(
         Row(
             Column(
                 PrependedText("ip_address",
                               '<i class="fas fa-filter"></i>'),
                 css_class="col-md-6",
             ),
             Column(
                 PrependedText("name", '<i class="fas fa-filter"></i>'),
                 css_class=" col-md-6",
             ),
             css_class="form-row",
         ),
         Accordion(
             AccordionGroup("Server Status",
                            InlineCheckboxes("server_status")), ),
         ButtonHolder(
             HTML("""
                 <a class="btn btn-info col-md-2" role="button" href="{%  url 'shepherd:server_create' %}">Create</a>
                 """),
             Submit("submit_btn",
                    "Filter",
                    css_class="btn btn-primary col-md-2"),
             HTML("""
                 <a class="btn btn-outline-secondary col-md-2" role="button" href="{%  url 'shepherd:servers' %}">Reset</a>
                 """),
         ),
     )
Example #28
0
 def __init__(self, *args, **kwargs):
     super(HapaBelegFilterFormHelper, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.form_class = 'genericFilterForm'
     self.form_method = 'GET'
     self.helper.form_tag = False
     self.add_input(Submit('Filter', 'Search'))
     self.layout = Layout(
         Fieldset('Basic search options',
                  'short_quote',
                  css_id="basic_search_fields"),
         Accordion(
             AccordionGroup('Advanced search',
                            'zotero_id',
                            'text',
                            'full_quote',
                            'time_of_origin_start',
                            'time_of_origin_end',
                            'comment',
                            css_id="more"),
             AccordionGroup('admin',
                            'id',
                            'tags',
                            'internal_comment',
                            css_id="admin_search"),
         ))
Example #29
0
 def __init__(self, *args, **kwargs):
     super(FcCollectionFilterFormHelper, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.form_class = 'genericFilterForm'
     self.form_method = 'GET'
     self.helper.form_tag = False
     self.add_input(Submit('Filter', 'Search'))
     self.layout = Layout(
         Fieldset('Basic search options',
                  'id',
                  'fc_fullname',
                  'fc_name',
                  css_id="basic_search_fields"),
         Accordion(
             AccordionGroup('Advanced search',
                            'fc_ordername',
                            'fc_firstmod',
                            'fc_lastmod',
                            'fc_size',
                            'fc_items',
                            'parent',
                            'fc_arche_id',
                            'fc_arche_description',
                            'lft',
                            'rght',
                            'tree_id',
                            'level',
                            css_id="more"), ))
Example #30
0
 def __init__(self, *args, **kwargs):
     super(PointLayerStyleForm, self).__init__(*args, **kwargs)
     markers = Marker.objects.all()
     ##        choices = [(marker.id, '%s' % marker.name)]
     ##        choices.insert(0,('0','Please Choose'))
     self.fields['marker'] = forms.ModelChoiceField(
         queryset=markers, empty_label="-- Select a symbol --")
     self.helper = FormHelper()
     self.helper.form_tag = False
     self.helper.disable_csrf = True
     self.helper.label_class = 'col-lg-5'
     self.helper.field_class = 'col-lg-7'
     self.helper.layout = Layout(
         Accordion(
             AccordionGroup('Style options',
                            Field('marker', css_class="markerSelect"),
                            Field('fill', css_class='spectrum'),
                            'fill_opacity',
                            Field('stroke_color', css_class='spectrum'),
                            'stroke_width',
                            'stroke_opacity',
                            'transform',
                            active=True),
             AccordionGroup('Placement options',
                            'allow_overlap',
                            'spacing',
                            'max_error',
                            active=False),
             AccordionGroup('Filter & constraints',
                            'minScale',
                            'maxScale',
                            'filter',
                            active=False)),
         Div('id', 'DELETE', css_class="hiddenDiv", style="display:none"))