-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsmart_admin_layout.html.twig
More file actions
151 lines (120 loc) · 4.5 KB
/
Copy pathsmart_admin_layout.html.twig
File metadata and controls
151 lines (120 loc) · 4.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
{% use "form_div_layout.html.twig" with form_widget_simple as base_form_widget_simple %}
{% use "form_div_layout.html.twig" with form_widget_simple as base_form_widget_simple %}
{# START #}
{%- block form_start -%}
<style>
.smart-form .tooltip{
background: transparent;
}
.tooltip.in {
opacity: .9;
}
</style>
{% set attr = attr|merge({class: (attr.class|default('') ~ ' smart-form')|trim}) %}
{{- parent() -}}
{%- endblock form_start -%}
{# ROW #}
{%- block form_row -%}
<section>
{{- form_label(form) -}}
{{- form_widget(form) -}}
{{- form_errors(form) -}}
</section>
{%- endblock form_row -%}
{# LABEL #}
{%- block form_label -%}
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' label')|trim}) %}
{{- parent() -}}
{%- endblock form_label -%}
{# ERRORS #}
{%- block form_errors -%}
<em class="invalid">
{%- for error in errors -%}
<div>{{ error.message }}</div>
{%- endfor -%}
</em>
{%- endblock form_errors -%}
{# INPUT #}
{%- block form_widget_simple -%}
<label class="input{% if not valid %} state-error{% endif %}">
{{- block('base_form_widget_simple') -}}
</label>
{%- endblock form_widget_simple -%}
{# TEXTAREA #}
{%- block textarea_widget -%}
<label class="textarea{% if not valid %} state-error{% endif %}">
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-scroll')|trim, rows: (attr.rows|default(3))}) -%}
<textarea {{ block('widget_attributes') }}>{{ value }}</textarea>
</label>
{%- endblock textarea_widget -%}
{# MONEY #}
{%- block money_widget -%}
<label class="input{% if not valid %} state-error{% endif %}">
{%- set symbol = money_pattern|replace({ '{{ widget }}': '' }) -%}
{% if money_pattern ends with '{{ widget }}' %}<i class="icon-prepend">{{ symbol }}</i>{% endif -%}
{{ block('base_form_widget_simple') -}}
{% if money_pattern starts with '{{ widget }}' %}<i class="icon-append">{{ symbol }}</i>{% endif -%}
</label>
{%- endblock money_widget -%}
{# PERCENT #}
{%- block percent_widget -%}
<label class="input{% if not valid %} state-error{% endif %}">
{{- block('base_form_widget_simple') -}}
<i class="icon-append">%</i>
</label>
{%- endblock percent_widget -%}
{# RANGE #}
{%- block range_widget -%}
{% set attr = attr|merge({class: (attr.class|default('') ~ ' slider slider-primary')|trim,
'data-slider-min': attr.min|default,
'data-slider-max': attr.max|default,
'data-slider-value': value}) -%}
{{ block('base_form_widget_simple') }}
{%- endblock range_widget %}
{# SINGLE RADIO OR CHECKBOX ROW #}
{%- block single_choice_row_expanded -%}
<section>
{{- form_errors(form) -}}
<label class="{{ multiple ? 'checkbox' : 'radio'}}{% if not valid %} state-error{% endif %}">
{{- block(multiple ? 'checkbox_widget' : 'radio_widget') -}}
<i></i>
{{- translation_domain is same as(false) ? label : label|trans({}, translation_domain) -}}
</label>
</section>
{%- endblock single_choice_row_expanded -%}
{# CHECKBOX #}
{%- block checkbox_row -%}
{% set multiple = true -%}
{{ block('single_choice_row_expanded') }}
{%- endblock checkbox_row -%}
{# RADIO #}
{%- block radio_row -%}
{% set multiple = false -%}
{{ block('single_choice_row_expanded') }}
{%- endblock radio_row -%}
{# RADIOS AND CHECKBOXES WIDGET #}
{%- block choice_widget_expanded -%}
<div {{ block('widget_container_attributes') }}>
{%- for child in form -%}
{{ form_row(child) }} {# radio_row or checkbox_row #}
{%- endfor -%}
</div>
{%- endblock choice_widget_expanded -%}
{# SELECT #}
{%- block choice_widget_collapsed -%}
{% set attr = multiple ? attr|merge({class: (attr.class|default ~ ' custom-scroll')|trim}) : attr -%}
<label class="select{% if multiple %} select-multiple{% endif %}{% if not valid %} state-error{% endif %}">
{{- parent() -}}
{% if not multiple %}<i></i>{% endif -%}
</label>
{%- endblock choice_widget_collapsed -%}
{# FILE #}
{% block file_widget -%}
<div class="input input-file{% if not valid %} state-error{% endif %}">
<span class="button">
{{- block('base_form_widget_simple') -}}
{{ 'browse'|trans -}}
</span>
<input type="text" placeholder="{{ 'no_file_chosen'|trans }}" readonly="">
</div>
{%- endblock file_widget %}