sutty/app/views/posts/template_field/_select.haml

16 lines
611 B
Text
Raw Permalink Normal View History

2018-06-27 23:56:47 +00:00
- value = [] if value.nil?
- values = template.values.empty? ? [value].flatten : template.values
= 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),
{ class: 'form-control select2',
multiple: template.multiple?,
required: template.required?,
data: { tags: template.open?,
placeholder: t('posts.select.placeholder'),
'allow-clear': template.multiple?,
'maximum-selection-length': template.max }}
- if template.open?
%small.text-muted.form-text= t('posts.open')
- if template.max > 0
%small= t('posts.select.max', max: template.max)