2018-06-27 23:56:47 +00:00
|
|
|
- value = [] if value.nil?
|
2018-07-24 19:28:58 +00:00
|
|
|
- values = template.values.empty? ? [value].flatten : template.values
|
2018-06-19 20:38:43 +00:00
|
|
|
= select_tag field_name_for_post_as_string(name),
|
2018-12-14 13:52:22 +00:00
|
|
|
options_for_select([t('posts.blank'), nil] + values, value),
|
2018-06-19 20:38:43 +00:00
|
|
|
{ class: 'form-control select2',
|
|
|
|
multiple: template.multiple?,
|
|
|
|
required: template.required?,
|
|
|
|
data: { tags: template.open?,
|
2018-06-20 18:00:32 +00:00
|
|
|
placeholder: t('posts.select.placeholder'),
|
|
|
|
'allow-clear': template.multiple?,
|
|
|
|
'maximum-selection-length': template.max }}
|
2018-06-19 20:38:43 +00:00
|
|
|
- if template.open?
|
|
|
|
%small.text-muted.form-text= t('posts.open')
|
2018-06-22 19:48:58 +00:00
|
|
|
- if template.max > 0
|
|
|
|
%small= t('posts.select.max', max: template.max)
|