예제 #1
0
class PopularityForm(ListForm):
    template = 'admin/box-form.html'
    id = 'settings-form'
    css_class = 'form'
    submit_text = None

    event = events.Admin.Settings.PopularityForm

    fields = [
        ListFieldSet('popularity',
                     suppress_label=True,
                     css_classes=['details_fieldset'],
                     legend=N_('Popularity Algorithm Variables:'),
                     children=[
                         TextField('popularity_decay_exponent',
                                   validator=Int(not_empty=True, min=1),
                                   label_text=N_('Decay Exponent')),
                         TextField('popularity_decay_lifetime',
                                   validator=Int(not_empty=True, min=1),
                                   label_text=N_('Decay Lifetime')),
                     ]),
        SubmitButton('save',
                     default=N_('Save'),
                     css_classes=['btn', 'btn-save', 'blue', 'f-rgt']),
    ]
예제 #2
0
 class fields(WidgetsList):
     file_id = TextField(validator=Int())
     file_type = SingleSelectField(validator=file_type_validator, options=file_type_options, attrs={'id': None, 'autocomplete': 'off'})
     duration = TextField(validator=DurationValidator, attrs={'id': None, 'autocomplete': 'off'})
     width_height = TextField(validator=WXHValidator, attrs={'id': None, 'autocomplete': 'off'})
     bitrate = TextField(validator=Int, attrs={'id': None, 'autocomplete': 'off'})
     delete = SubmitButton(default=N_('Delete file'), named_button=True, css_class='file-delete', attrs={'id': None})
예제 #3
0
class MovieForm(TableForm):

    template = "toscasample.widgets.templates.table_form"
    css = [CSSLink(link=url('/css/tooltips.css'))]
    show_errors = True

    genre_options = [
        x for x in enumerate(('Action & Adventure', 'Animation', 'Comedy',
                              'Documentary', 'Drama', 'Sci-Fi & Fantasy'))
    ]

    fields = [
        TextField('title',
                  validator=NotEmpty,
                  label_text='Movie Title',
                  help_text='Please enter the full title of the movie.'),
        Spacer(),
        TextField('year',
                  validator=Int(min=1900, max=2100),
                  size=4,
                  help_text='Please enter the year this movie was made.'),
        CalendarDatePicker('release_date',
                           validator=DateConverter(),
                           help_text='Please pick the exact release date.'),
        SingleSelectField('genre',
                          options=genre_options,
                          help_text='Please choose the genre of the movie.'),
        Spacer(),
        TextArea('description',
                 attrs=dict(rows=3, cols=25),
                 help_text='Please provide a short description of the plot.'),
        Spacer()
    ]

    submit_text = 'Save Movie'
예제 #4
0
class GeneralForm(ListForm):
    template = 'admin/box-form.html'
    id = 'settings-form'
    css_class = 'form'
    submit_text = None
    
    event = events.Admin.Settings.GeneralForm
    
    fields = [
        ListFieldSet('general', suppress_label=True, legend=N_('General Settings:'), css_classes=['details_fieldset'], children=[
            TextField('general_site_name', maxlength=255,
                label_text=N_('Site Name')),
            SingleSelectField('general_site_title_display_order',
                label_text=N_('Display Site Name'),
                options=title_options,
            ),
            SingleSelectField('primary_language',
                label_text=N_('Default Language'), # TODO v0.9.1: Change to 'Primary Language'
                options=languages,
            ),
            SingleSelectField('featured_category',
                label_text=N_('Featured Category'),
                options=category_options,
                validator=Int(),
            ),
            RadioButtonList('rich_text_editor',
                label_text=N_('Rich Text Editing'),
                options=rich_text_editors,
                validator=rich_text_editors_validator,
            ),
        ]),
        SubmitButton('save', default=N_('Save'), css_classes=['btn', 'btn-save', 'blue', 'f-rgt']),
    ]
예제 #5
0
 def __init__(self, *args, **kw):
     self.min = kw.pop("min")
     self.max = kw.pop("max")
     validator = Int(min=self.min, max=self.max)
     try:
         validator = Pipe(kw["validator"], validator)
     except KeyError:
         pass
     kw["validator"] = validator
     super(UISlider, self).__init__(*args, **kw)
예제 #6
0
class GeneralForm(ListForm):
    template = 'admin/box-form.html'
    id = 'settings-form'
    css_class = 'form'
    submit_text = None
    fields = [
        ListFieldSet(
            'general',
            suppress_label=True,
            legend=N_('General Settings:'),
            css_classes=['details_fieldset'],
            children=[
                TextField('general_site_name',
                          maxlength=255,
                          label_text=N_('Site Name')),
                SingleSelectField(
                    'general_site_title_display_order',
                    label_text=N_('Display Site Name'),
                    options=title_options,
                ),
                SingleSelectField(
                    'primary_language',
                    label_text=N_(
                        'Default Language'
                    ),  # TODO v0.9.1: Change to 'Primary Language'
                    options=languages,
                ),
                SingleSelectField(
                    'featured_category',
                    label_text=N_('Featured Category'),
                    options=category_options,
                    validator=Int(),
                ),
                RadioButtonList(
                    'rich_text_editor',
                    label_text=N_('Rich Text Editing'),
                    options=rich_text_editors,
                    validator=rich_text_editors_validator,
                ),
                # NOTE: Commented out, pending removal in v0.9.1 if no one complains its gone.
                #            ListFieldSet('default_wording', suppress_label=True, legend=N_('Administrative notes on Media:'), css_classes=['details_fieldset'], children=[
                #                CheckBox('wording_display_administrative_notes',
                #                    label_text=N_('Display notes'),
                #                    validator=Bool(if_missing='')),
                #                TextArea('wording_administrative_notes', label_text=N_('Administrative Notes'), attrs=dict(rows=3, cols=25)),
                #            ]),
            ]),
        SubmitButton('save',
                     default=N_('Save'),
                     css_classes=['btn', 'btn-save', 'blue', 'f-rgt']),
    ]
예제 #7
0
class SiteMapsForm(ListForm):
    template = 'admin/box-form.html'
    id = 'settings-form'
    css_class = 'form'
    submit_text = None

    event = events.Admin.Settings.SiteMapsForm

    fields = [
        ListFieldSet('rss',
                     suppress_label=True,
                     legend='',
                     css_classes=['details_fieldset'],
                     children=[
                         CheckBox('sitemaps_display',
                                  css_classes=['checkbox-left'],
                                  label_text=N_('Site Maps'),
                                  validator=Bool(if_missing='')),
                         CheckBox('rss_display',
                                  css_classes=['checkbox-left'],
                                  label_text=N_('RSS Feeds'),
                                  validator=Bool(if_missing='')),
                     ]),
        ListFieldSet(
            'feeds',
            suppress_label=True,
            css_classes=['details_fieldset'],
            legend=N_('RSS Feed Defaults:'),
            children=[
                TextField(
                    u'default_feed_results',
                    validator=Int(not_empty=True, min=1, if_missing=30),
                    label_text=N_(u'number of items'),
                    help_text=N_(
                        u'The number of items in the feed can be overriden per request '
                        U'if you add "?limit=X" to the feed URL. If the "limit" parameter '
                        u'is absent, the default above is used.'),
                ),
            ]),
        SubmitButton('save',
                     default=N_('Save'),
                     css_classes=['btn', 'btn-save', 'blue', 'f-rgt']),
    ]