5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 11:26:22 +00:00
panel/app/views/posts/attributes/_has_many.haml

24 lines
872 B
Text
Raw Normal View History

2020-07-22 23:35:43 +00:00
.form-group
= label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post)
2021-02-11 19:16:25 +00:00
= hidden_field_tag "#{base}[#{attribute}][]", ''
2020-07-22 23:35:43 +00:00
.mapable{ dir: dir, lang: locale,
data: { values: metadata.value.to_json,
'default-values': metadata.values.to_json,
name: "#{base}[#{attribute}][]", list: id_for_datalist(attribute),
2020-07-22 23:35:43 +00:00
remove: 'false', legend: post_label_t(attribute, post: post),
button: t('posts.attributes.add'),
described: id_for_help(attribute) } }
= text_field(*field_name_for(base, attribute, '[]'),
2020-07-22 23:35:43 +00:00
value: metadata.value.join(', '),
dir: dir, lang: locale,
**field_options(attribute, metadata))
= render 'posts/attribute_feedback',
post: post, attribute: attribute, metadata: metadata
%datalist{ id: id_for_datalist(attribute) }
- metadata.values.keys.each do |value|
%option{ value: value }