Merge remote branch 'remotes/gullydwarf-cfdv/f446_use_render_divs_once_per_form'
This commit is contained in:
commit
3ec6fe225c
@ -22,11 +22,11 @@ from mediagoblin.util import fake_ugettext_passthrough as _
|
|||||||
|
|
||||||
|
|
||||||
class SubmitStartForm(wtforms.Form):
|
class SubmitStartForm(wtforms.Form):
|
||||||
|
file = wtforms.FileField(_('File'))
|
||||||
title = wtforms.TextField(
|
title = wtforms.TextField(
|
||||||
_('Title'),
|
_('Title'),
|
||||||
[wtforms.validators.Length(min=0, max=500)])
|
[wtforms.validators.Length(min=0, max=500)])
|
||||||
description = wtforms.TextAreaField('Description of this work')
|
description = wtforms.TextAreaField('Description of this work')
|
||||||
file = wtforms.FileField(_('File'))
|
|
||||||
tags = wtforms.TextField(
|
tags = wtforms.TextField(
|
||||||
_('Tags'),
|
_('Tags'),
|
||||||
[tag_length_validator])
|
[tag_length_validator])
|
||||||
|
@ -24,10 +24,7 @@
|
|||||||
method="POST" enctype="multipart/form-data">
|
method="POST" enctype="multipart/form-data">
|
||||||
<div class="grid_8 prefix_1 suffix_1 form_box">
|
<div class="grid_8 prefix_1 suffix_1 form_box">
|
||||||
<h1>{% trans %}Submit yer media{% endtrans %}</h1>
|
<h1>{% trans %}Submit yer media{% endtrans %}</h1>
|
||||||
{{ wtforms_util.render_field_div(submit_form.file) }}
|
{{ wtforms_util.render_divs(submit_form) }}
|
||||||
{{ wtforms_util.render_field_div(submit_form.title) }}
|
|
||||||
{{ wtforms_util.render_textarea_div(submit_form.description) }}
|
|
||||||
{{ wtforms_util.render_field_div(submit_form.tags) }}
|
|
||||||
<div class="form_submit_buttons">
|
<div class="form_submit_buttons">
|
||||||
<input type="submit" value="{% trans %}Submit{% endtrans %}" class="button" />
|
<input type="submit" value="{% trans %}Submit{% endtrans %}" class="button" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
<form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
|
<form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
|
||||||
user= media.uploader().username,
|
user= media.uploader().username,
|
||||||
media=media._id) }}" method="POST">
|
media=media._id) }}" method="POST">
|
||||||
{{ wtforms_util.render_field_div(comment_form.comment_content) }}
|
{{ wtforms_util.render_divs(comment_form) }}
|
||||||
<div class="form_submit_buttons">
|
<div class="form_submit_buttons">
|
||||||
<input type="submit" value="{% trans %}Post comment!{% endtrans %}" class="button" />
|
<input type="submit" value="{% trans %}Post comment!{% endtrans %}" class="button" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -34,25 +34,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{# Generically render a textarea
|
|
||||||
# ... mostly the same thing except it includes rows and cols #}
|
|
||||||
{% macro render_textarea_div(field, rows=8, cols=20) %}
|
|
||||||
<div class="form_field_box">
|
|
||||||
<div class="form_field_label">{{ _(field.label.text) }}</div>
|
|
||||||
{% if field.description -%}
|
|
||||||
<div class="form_field_description">{{ _(field.description) }}</div>
|
|
||||||
{%- endif %}
|
|
||||||
<div class="form_field_input">{{ field(rows=rows, cols=cols) }}</div>
|
|
||||||
{%- if field.errors -%}
|
|
||||||
{% for error in field.errors %}
|
|
||||||
<div class="form_field_error">
|
|
||||||
{{ error }}
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{%- endif %}
|
|
||||||
</div>
|
|
||||||
{%- endmacro %}
|
|
||||||
|
|
||||||
{# Auto-render a form as a series of divs #}
|
{# Auto-render a form as a series of divs #}
|
||||||
{% macro render_divs(form) -%}
|
{% macro render_divs(form) -%}
|
||||||
{% for field in form %}
|
{% for field in form %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user