5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-10-02 04:26:56 +00:00
panel/app/views/posts/template_field/_radio_group.haml

16 lines
527 B
Text
Raw Permalink Normal View History

2019-01-11 18:27:19 +00:00
-# Obtener el nombre del campo
- field_name = field_name_for_post_as_string(name)
-# Obtener todos los valores
- value = [] if value.nil?
- values = template.values.empty? ? [value].flatten : template.values
- values.each do |v|
.form-check
= radio_button_tag field_name+'[]',
v,
@post.fetch_front_matter(name, []).include?(v),
class: 'form-check-input'
= label_tag [field_name,v].join(' '), class: 'form-check-label' do
= v.split(':', 2).first
%br/
%small= v.split(':', 2).last