summaryrefslogtreecommitdiff
path: root/resources/views/macros
diff options
context:
space:
mode:
Diffstat (limited to 'resources/views/macros')
-rw-r--r--resources/views/macros/form.twig35
1 files changed, 26 insertions, 9 deletions
diff --git a/resources/views/macros/form.twig b/resources/views/macros/form.twig
index 5d41b085..ece85fcf 100644
--- a/resources/views/macros/form.twig
+++ b/resources/views/macros/form.twig
@@ -1,18 +1,35 @@
-{% macro input(name, label, type, required) %}
+{% macro input(name, label, type, opt) %}
<div class="form-group">
- {% if label %}
+ {% if label -%}
<label for="{{ name }}">{{ label }}</label>
- {% endif %}
- <input type="{{ type|default('text') }}" class="form-control" id="{{ name }}" name="{{ name }}"
- {%- if required|default(false) %} required="required"{% endif -%}
+ {%- endif %}
+ <input type="{{ type|default('text') }}" class="form-control"
+ id="{{ name }}" name="{{ name }}"
+ value="{{ opt.value|default('') }}"
+ {%- if opt.required|default(false) %}
+ required="required"
+ {%- endif -%}
>
</div>
-{% endmacro %}
+{%- endmacro %}
+
+{% macro select(name, data, label, selected) %}
+ <div class="form-group">
+ {% if label -%}
+ <label for="{{ name }}">{{ label }}</label>
+ {% endif %}
+ <select id="{{ name }}" name="{{ name }}" class="form-control">
+ {% for value,decription in data -%}
+ <option value="{{ value }}" {% if name == selected %} selected{% endif %}>{{ decription }}</option>
+ {% endfor %}
+ </select>
+ </div>
+{%- endmacro %}
{% macro hidden(name, value) %}
<input type="hidden" id="{{ name }}" name="{{ name }}" value="{{ value }}">
-{% endmacro %}
+{%- endmacro %}
{% macro submit(label) %}
- <button type="submit" class="btn btn-default">{{ label|default(__('form.submit')) }}</button>
-{% endmacro %}
+ <button type="submit" class="btn btn-primary">{{ label|default(__('form.submit')) }}</button>
+{%- endmacro %}