Created
August 13, 2016 22:05
-
-
Save jibe0123/c9c1013f0f031cab0459ecd48e78fdd1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- block choice_widget -%} | |
{% if expanded %} | |
{% if attr.isInline is defined and attr.isInline %} | |
{{- block('choice_widget_expanded_inline') -}} | |
{% elseif attr.isCheckbox is defined and attr.isCheckbox %} | |
{{- block('choice_widget_expanded_checkbox') -}} | |
{% else %} | |
{{- block('choice_widget_expanded') -}} | |
{% endif %} | |
{% else %} | |
{% if attr.isSlider is defined and attr.isSlider %} | |
{{- block('choice_widget_collapsed_slider') -}} | |
{% else %} | |
{{- block('choice_widget_collapsed') -}} | |
{% endif %} | |
{% endif %} | |
{%- endblock choice_widget -%} | |
{#%- block form_widget_simple -%} | |
{%- set type = type|default('text') -%} | |
{% if type == "text" %} | |
<input type="{{ type }}" class="form-control {% if type != "hidden" %}floating-label" placeholder="{{- form_label(form)|trim -}}"{% else %}"{% endif %} {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %} /> | |
{% elseif type == "file" %} | |
<input type="text" readonly="" class="form-control {% if type != "hidden" %}floating-label" placeholder="{{- form_label(form)|trim -}}"{% else %}"{% endif %} {% if value is not empty %}value="{{ value }}" {% endif %}> | |
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}> | |
{% else %} | |
<input type="{{ type }}" class="form-control {% if type != "hidden" %}floating-label" placeholder="{{- form_label(form)|trim -}}"{% else %}"{% endif %} {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %} /> | |
{% endif %} | |
{%- endblock form_widget_simple -%#} | |
{#%- block textarea_widget -%} | |
<textarea class="form-control" placeholder="{{- form_label(form)|trim -}}" {{ block('widget_attributes') }}>{{ value }}</textarea> | |
{%- endblock textarea_widget -%#} | |
{%- block choice_widget_expanded -%} | |
<div class="pull-left"> | |
<label class="control-label">{{- form_label(form) -}}</label> | |
{%- for child in form %} | |
<div class="radio radio-primary" {{ block('widget_container_attributes') }}> | |
<label> | |
{{- form_widget(child) -}} | |
{{- form_label(child, null, {translation_domain: choice_translation_domain}) -}} | |
</label> | |
</div> | |
{% endfor -%} | |
</div> | |
{%- endblock choice_widget_expanded -%} | |
{%- block choice_widget_expanded_inline -%} | |
<label class="control-label">{{- form_label(form) -}}</label> | |
<div {{ block('widget_container_attributes') }}> | |
{%- for child in form %} | |
<div class="radio radio-primary"> | |
<label> | |
{{- form_widget(child) -}} | |
{{- form_label(child, null, {translation_domain: choice_translation_domain}) -}} | |
</label> | |
</div> | |
{% endfor -%} | |
</div> | |
{%- endblock choice_widget_expanded_inline -%} | |
{%- block choice_widget_expanded_checkbox -%} | |
<label class="control-label">{{- form_label(form) -}}</label> | |
<div {{ block('widget_container_attributes') }}> | |
{%- for child in form %} | |
<div class="checkbox col-sm-4"> | |
<label> | |
{{- form_widget(child) -}} | |
</label> | |
</div> | |
{% endfor -%} | |
</div> | |
{%- endblock choice_widget_expanded_checkbox -%} | |
{%- block checkbox_widget -%} | |
<div class="checkbox"> | |
<label> | |
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} /> {{ block('form_label') }} | |
</label> | |
</div> | |
{%- endblock checkbox_widget -%} | |
{%- block radio_widget -%} | |
<input type="radio" {{ block('widget_attributes') }} {% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} /> | |
{%- endblock radio_widget -%} | |
{#%- block form_label -%} | |
{% if label is not sameas(false) -%} | |
{% if not compound -%} | |
{% set label_attr = label_attr|merge({'for': id}) %} | |
{%- endif %} | |
{% if required -%} | |
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} | |
{%- endif %} | |
{% if label is empty -%} | |
{%- if label_format is not empty -%} | |
{% set label = label_format|replace({ | |
'%name%': name, | |
'%id%': id, | |
}) %} | |
{%- else -%} | |
{% set label = name|humanize %} | |
{%- endif -%} | |
{%- endif -%} | |
{{ label|trans }} | |
{%- endif -%} | |
{%- endblock form_label -%#} | |
{%- block form_row -%} | |
<div class="form-control-wrapper form-group {% if attr.addClass is defined and attr.addClass %}{{ attr.addClass }}{% endif %}"> | |
{{- form_widget(form) -}} | |
{{- form_errors(form) -}} | |
</div> | |
{%- endblock form_row -%} | |
{% block date_widget %} | |
{% if attr.isBirthday is defined and attr.isBirthday %} | |
{% set maxDate = "now"|date_modify("-16 year")|date("m/d/Y") %} | |
{% set initDate = "now"|date_modify("-16 year")|date("d/m/Y") %} | |
{% endif %} | |
{% set ngModel = 'dt' %} | |
{% if attr['ng-model'] is defined and attr['ng-model'] %} | |
{% set ngModel = attr['ng-model'] %} | |
{% endif %} | |
{% set type = type|default('text') %} | |
<div ng-controller="datePickerCtrl" ng-init="{% if value is not empty %}{{ ngModel }}='{{ value }}'{% endif %}"> | |
<label class="control-label">{{- form_label(form) -}}</label> | |
<input type="{{ type }}" | |
ng-click="open($event)" | |
show-weeks="false" | |
datepicker-popup="dd/MM/yyyy" | |
is-open="status.opened" | |
show-button-bar="false" | |
starting-day="1" | |
class="form-control" | |
{% if placeholder is defined %}placeholder="{{ placeholder }}"{% endif %} | |
{% if maxDate is defined %} max-date="'{{ maxDate }}'" {% endif %} | |
{{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}"{% endif %}/> | |
</div> | |
{% endblock %} | |
{%- block choice_widget_collapsed -%} | |
{%- if required and placeholder is none and not placeholder_in_choices and not multiple -%} | |
{% set required = false %} | |
{%- endif -%} | |
<select class="form-control" {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}> | |
{%- if placeholder is not none -%} | |
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder != '' ? placeholder|trans({}, translation_domain) }}</option> | |
{%- endif -%} | |
{%- if preferred_choices|length > 0 -%} | |
{% set options = preferred_choices %} | |
{{- block('choice_widget_options') -}} | |
{%- if choices|length > 0 and separator is not none -%} | |
<option disabled="disabled">{{ separator }}</option> | |
{%- endif -%} | |
{%- endif -%} | |
{%- set options = choices -%} | |
{{- block('choice_widget_options') -}} | |
</select> | |
{%- endblock choice_widget_collapsed -%} | |
{%- block choice_widget_collapsed_slider -%} | |
{%- if required and placeholder is none and not placeholder_in_choices and not multiple -%} | |
{% set required = false %} | |
{%- endif -%} | |
<div class="input-slider-container"> | |
<div class="first-value"></div> | |
<div class="last-value"></div> | |
<div class="input-slider-orange" id="{{ attr.sliderID }}"></div> | |
</div> | |
<select class="form-control" {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}> | |
{%- if placeholder is not none -%} | |
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder != '' ? placeholder|trans({}, translation_domain) }}</option> | |
{%- endif -%} | |
{%- if preferred_choices|length > 0 -%} | |
{% set options = preferred_choices %} | |
{{- block('choice_widget_options') -}} | |
{%- if choices|length > 0 and separator is not none -%} | |
<option disabled="disabled">{{ separator }}</option> | |
{%- endif -%} | |
{%- endif -%} | |
{%- set options = choices -%} | |
{{- block('choice_widget_options') -}} | |
</select> | |
{%- endblock choice_widget_collapsed_slider -%} | |
{%- block choice_widget_options -%} | |
{% for group_label, choice in options %} | |
{%- if choice is iterable -%} | |
<optgroup label="{{ choice_translation_domain is same as(false) ? group_label : group_label|trans({}, choice_translation_domain) }}"> | |
{% set options = choice %} | |
{{- block('choice_widget_options') -}} | |
</optgroup> | |
{%- else -%} | |
{% set attr = choice.attr %} | |
<option value="{{ choice.value }}" {{ block('attributes') }}{% if choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ choice.label|trans }}</option> | |
{%- endif -%} | |
{% endfor %} | |
{%- endblock choice_widget_options -%} | |
{#%- block form_errors -%} | |
{%- if errors|length > 0 -%} | |
{%- for error in errors -%} | |
<span class="text-danger">{{ error.message }}</span> - | |
{%- endfor -%} | |
{%- endif -%} | |
{%- endblock form_errors -%#} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment