Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
R
redeleitsystem
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
redl
redeleitsystem
Commits
9b319027
Commit
9b319027
authored
Sep 03, 2015
by
YSelf Tool
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added macros.html
parent
a621ea40
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
0 deletions
+78
-0
templates/macros.html
templates/macros.html
+78
-0
No files found.
templates/macros.html
0 → 100644
View file @
9b319027
{% macro render_field(field, label_visible=true) -%}
{{ field(id=field.id, title=field.description, **kwargs) }}
{% if field.errors %}
{% for e in field.errors %}
<p
class=
"help-block"
>
{{ e }}
</p>
{% endfor %}
{% endif %}
{%- endmacro %}
{% macro render_stringfield(field) -%}
<div
class=
"mdl-textfield mdl-js-textfield"
>
<input
id=
"{{ field.id }}"
name=
"{{ field.id }}"
class=
"mdl-textfield__input"
type=
"text"
/>
<label
class=
"mdl-textfield__label"
for=
"{{ field.id }}"
>
{{ field.label.text }}
</label>
{% if field.errors %}
{% for e in errors %}
<div
class=
"mdl-card__supporting-text"
>
{{ e }}
</div>
{% endfor %}
{% endif %}
</div>
{%- endmacro %}
{% macro render_passwordfield(field) -%}
<div
class=
"mdl-textfield mdl-js-textfield"
>
<input
id=
"{{ field.id }}"
name=
"{{ field.id }}"
class=
"mdl-textfield__input"
type=
"password"
/>
<label
class=
"mdl-textfield__label"
for=
"{{ field.id }}"
>
{{ field.label.text }}
</label>
{% if field.errors %}
{% for e in errors %}
<div
class=
"mdl-card__supporting-text"
>
{{ e }}
</div>
{% endfor %}
{% endif %}
</div>
{%- endmacro %}
{% macro render_booleanfield(field) -%}
<label
class=
"mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect"
for=
"{{ field.id }}"
>
<input
type=
"checkbox"
id=
"{{ field.id }}"
name=
"{{ field.id }}"
class=
"mdl-checkbox__input"
/>
<span
class=
"mdl-checkbox__label"
>
{{ field.label.text }}
</span>
</label>
{%- endmacro %}
{% macro render_csrftokenfield(field, kwargs) -%}
{{ field(title=field.description, **kwargs) }}
{%- endmacro %}
{% macro render_form(form, action_url="", title=None, action_text="Submit", class_="mdl-card mdl-shadow--2dp", title_class="mdl-card__title", title_next_class="mdl-card__title-text", content_class="mdl-card__supporting-text", action_class="mdl-card__actions", btn_class="mdl-button mdl-js-button mdl-button--raised mdl-button-colored") -%}
<div
class=
"{{ class_ }}"
>
<form
method=
"POST"
action=
"{{ action_url }}"
>
<div
class=
"{{ title_class }}"
>
<h2
class=
"{{ title_text_class}}"
>
{{ title if title is not none else action_text }}
</h2>
</div>
<div
class=
"{{ content_class }}"
>
{% for f in form %}
{% if f.type == "StringField" %}
{{ render_stringfield(f) }}
{% elif f.type == "PasswordField" %}
{{ render_passwordfield(f) }}
{% elif f.type == "BooleanField" %}
{{ render_booleanfield(f) }}
{% elif f.type == "CSRFTokenField" %}
{{ render_csrftokenfield(f, kwargs) }}
{% else %}
{{ f.type }}
{{ render_field(f) }}
{% endif %}
{% endfor %}
{% endfor %}
</div>
<div
class=
"{{ action_class }}"
>
<button
type=
"submit"
class=
"{{ btn_class }}"
>
{{ action_text }}
</button>
</div>
</form>
</div>
{%- endmacro %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment