Skip to content

Commit

Permalink
[2375] Update form.prepend() macro to handle error message
Browse files Browse the repository at this point in the history
  • Loading branch information
aron committed Jun 6, 2012
1 parent 54ae677 commit 31824cd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ckan/templates/macros/form.html
Expand Up @@ -100,10 +100,14 @@

#}
{% macro prepend(name, id='', label='', prepend='', value='', placeholder='', type='text', error="", classes=[]) %}
{% call block(id or name, label or name, error, classes) %}
{# We manually append the error here as it needs to be inside the .input-prepend block %}
{% set classes = (classes|list) %}
{% do classes.append('error') if error %}
{% call block(id or name, label or name, error=false, classes=classes) %}
<div class="input-prepend">
{% if prepend %}<span class="add-on">{{ prepend }}</span>{%- endif -%}
<input id="{{ id or name }}" type="{{ type }}" name="{{ name }}" value="{{ value | e }}" placeholder="{{ placeholder }}" />
{% if error %}<span class="error-block">{{ error }}</span>{% endif %}
</div>
{% endcall %}
{% endmacro %}
Expand Down

0 comments on commit 31824cd

Please sign in to comment.