Exemplo n.º 1
0
class EditDescriptionForm(Form):
    action = 'update_description'

    class child(BaseLayout):
        inline_engine_name = 'kajiki'

        template = '''

<div py:strip="">
    <py:for each="c in w.children_hidden">
        ${c.display()}
    </py:for>

    <div class="form form-horizontal">
        <div class="form-group">
        <div class="mail-templates-title">Edit model description</div>
            <div class="col-md-12">
             <div py:with="c=w.children.description"
                     class="form-group ${c.error_msg and 'has-error' or ''}">
                    <label for="${c.compound_id}" class="col-md-2 control-label">${c.label}</label>
                    <div class="col-md-10">
                        ${c.display()}
                        <span class="help-block" py:content="c.error_msg"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
'''
        model_id = HiddenField()
        description = TextArea(label='Description', css_class='form-control')

    submit = SubmitButton(css_class='btn btn-primary pull-right', value=l_('Save'))
Exemplo n.º 2
0
class NewCategory(Form):
    class child(FormLayout):
        image_small_id = HiddenField()
        image_big_id = HiddenField()

        name = TextField(label=l_('Name'),
                         css_class='form-control',
                         validator=Required)

        description = TextArea(label=l_('Description'),
                               rows=10,
                               css_class='form-control',
                               validator=Required)

        image_small = FileField(label=pluggable_config.get(
            'image1_label', l_('Small Image')),
                                css_class='form-control',
                                attrs=dict(accept='image/*'))
        image_big = FileField(label=pluggable_config.get(
            'image2_label', l_('Big Image')),
                              css_class='form-control',
                              attrs=dict(accept='image/*'))
        parent_id = SingleSelectField(
            css_class='form-control',
            options=Deferred(lambda: [(c._id, c.name) for c in model.provider.
                                      query(model.Category, filters={})[1]]))

    submit = SubmitButton(css_class='btn btn-primary pull-right',
                          value=l_('Create'))
Exemplo n.º 3
0
class NewPermission(Form):
    class child(KajikiBootstrapFormLayout):
        permission_name = TextField(label=l_('Name'),
                                    css_class='form-control',
                                    validator=UnicodeString(not_empty=True))

        description = TextArea(label=l_('Description'),
                               rows=10,
                               css_class='form-control',
                               validator=UnicodeString(not_empty=True))

        groups = MultipleSelectField(label=l_('Groups'),
                                     css_class="form-control",
                                     options=Deferred(h.query_groups))

    submit = SubmitButton(css_class='btn btn-primary pull-right',
                          value=l_('Create'))
Exemplo n.º 4
0
class TestEmailForm(Form):
    action = 'send_test_email'

    class child(BaseLayout):
        inline_engine_name = 'kajiki'

        template = '''

    <div py:strip="">
        <py:for each="c in w.children_hidden">
            ${c.display()}
        </py:for>

        <div class="form form-horizontal">
            <div class="form-group">
            <div class="mail-templates-title">Send Test Email</div>
                <div class="col-md-12">
                 <div py:with="c=w.children.email"
                         class="form-group ${c.error_msg and 'has-error' or ''}">
                        <label for="${c.compound_id}" class="col-md-2 control-label">${c.label}</label>
                        <div class="col-md-10">
                            ${c.display()}
                            <span class="help-block" py:content="c.error_msg"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    '''
        translation_id = HiddenField()
        language = HiddenField()
        body = HiddenField()
        subject = HiddenField()
        email = TextField(label='Recipient', css_class='form-control',
                          validator=twc.EmailValidator(not_empty=True))

    submit = SubmitButton(css_class='btn btn-primary pull-right', value=l_('Send'))
Exemplo n.º 5
0
class EditCategory(NewCategory):
    submit = SubmitButton(css_class='btn btn-primary pull-right',
                          value=l_('Edit'))
Exemplo n.º 6
0
class EditPermission(NewPermission):
    submit = SubmitButton(css_class='btn btn-primary pull-right',
                          value=l_('Edit'))
Exemplo n.º 7
0
class CreateTranslationForm(Form):
    action = 'create_translation'

    class child(BaseLayout):
        inline_engine_name = 'kajiki'

        template = '''
<div py:strip="">
    <py:for each="c in w.children_hidden">
        ${c.display()}
    </py:for>

    <div class="form form-horizontal">
     <div class="mail-templates-title">New mail translation</div>
        <div class="form-group">
            <div class="col-md-12">
                <div py:with="c=w.children.language"
                     class="form-group ${c.error_msg and 'has-error' or ''}">
                    <label for="${c.compound_id}" class="col-md-2 control-label">${c.label}</label>
                    <div class="col-md-2">
                        ${c.display()}
                        <span class="help-block" py:content="c.error_msg"/>
                    </div>
                     <span class="alert alert-danger" py:for="error in w.rollup_errors"> ${error}</span>
                </div>

                <div py:with="c=w.children.subject"
                     class="form-group ${c.error_msg and 'has-error' or ''}">
                    <label for="${c.compound_id}" class="col-md-2 control-label">${c.label}</label>
                    <div class="col-md-10">
                        ${c.display()}
                        <span class="help-block" py:content="c.error_msg"/>
                    </div>
                </div>
                <div py:with="c=w.children.body"
                     class="form-group ${c.error_msg and 'has-error' or ''}">
                    <label for="${c.compound_id}" class="col-md-2 control-label">${c.label}</label>
                    <div class="col-md-10">
                        ${c.display()}
                        <span class="help-block" py:content="c.error_msg"/>
                    </div>
                </div>

            </div>
        </div>

    </div>
     <input type="submit" class="btn btn-warning col-md-1 col-md-push-10" formaction="validate_template" value="Validate"></input>
</div>
'''
        model_id = HiddenField()
        language = TextField(label='Language', css_class='form-control',
                             validator=UnicodeString(not_empty=True, outputEncoding=None))
        subject = TextField(label='Subject', css_class='form-control',
                            validator=KajikiTextTemplateValidator())

        body = TextArea(label='Email content', rows=10, css_class='form-control',
                        validator=KajikiTemplateValidator())

    validator = UniqueLanguageValidator('model_id', 'language')
    submit = SubmitButton(css_class='btn btn-primary pull-right', value=l_('Create'))
Exemplo n.º 8
0
class NewModelForm(Form):
    action = 'create_model'

    class child(BaseLayout):
        inline_engine_name = 'kajiki'

        template = '''

<div py:strip="">
    <py:for each="c in w.children_hidden">
        ${c.display()}
    </py:for>

    <div class="form form-horizontal">
        <div class="form-group">
        <div class="mail-templates-title">New Mail Model</div>
            <div class="col-md-12">
             <div py:with="c=w.children.name"
                     class="form-group ${c.error_msg and 'has-error' or ''}">
                        <label for="${c.compound_id}" class="col-md-2 control-label">${c.label}</label>
                    <div class="col-md-10">
                        ${c.display()}
                        <span class="help-block" py:content="c.error_msg"/>
                    </div>
                </div>
                <div py:with="c=w.children.usage"
                     class="form-group ${c.error_msg and 'has-error' or ''}">
                    <label for="${c.compound_id}" class="col-md-2 control-label">${c.label}</label>
                    <div class="col-md-10">
                        ${c.display()}
                         <span class="help-block" py:content="c.error_msg"/>
                         <span class="help-block"> This is the description of the usage of this new email,
                         including the context of usage. Use this field to explain where and when this mail will be
                            sent in your app. </span>

                    </div>
                </div>
                <div py:with="c=w.children.language"
                     class="form-group ${c.error_msg and 'has-error' or ''}">
                    <label for="${c.compound_id}" class="col-md-2 control-label">${c.label}</label>
                    <div class="col-md-2">
                        ${c.display()}
                        <span class="help-block" py:content="c.error_msg"/>

                    </div>
                </div>
                <div py:with="c=w.children.subject"
                     class="form-group ${c.error_msg and 'has-error' or ''}">
                    <label for="${c.compound_id}" class="col-md-2 control-label">${c.label}</label>
                    <div class="col-md-10">
                        ${c.display()}
                        <span class="help-block" py:content="c.error_msg"/>
                    </div>
                </div>
                <div py:with="c=w.children.body"
                     class="form-group ${c.error_msg and 'has-error' or ''}">
                    <label for="${c.compound_id}" class="col-md-2 control-label">${c.label}</label>
                    <div class="col-md-10">
                        ${c.display()}
                        <span class="help-block" py:content="c.error_msg"/>
                    </div>
                </div>

            </div>
        </div>

    </div>
     <input type="submit" class="btn btn-warning col-md-1 col-md-push-10" formaction="validate_template_model" value="Validate"></input>

</div>
'''
        name = TextField(label='Model Name', css_class='form-control',
                         validator=UniqueModelNameValidator(not_empty=True, outputEncoding=None))
        usage = TextArea(label='Description', css_class='form-control',
                         validator=UnicodeString(not_empty=True, outputEncoding=None))
        language = TextField(label='Language', css_class='form-control',
                             validator=UnicodeString(not_empty=True, outputEncoding=None))
        subject = TextField(label='Subject', css_class='form-control',
                            validator=KajikiTextTemplateValidator())

        body = TextArea(label='Email content', rows=10, css_class='form-control',
                        validator=KajikiTemplateValidator())

    submit = SubmitButton(css_class='btn btn-primary pull-right', value=l_('Create'))