diff --git a/app/views/posts/attributes/_boolean.haml b/app/views/posts/attributes/_boolean.haml index 46ab667a..c959e4b5 100644 --- a/app/views/posts/attributes/_boolean.haml +++ b/app/views/posts/attributes/_boolean.haml @@ -1,11 +1,12 @@ .form-check - = hidden_field_tag "post[#{attribute}]", '0' - = check_box_tag "post[#{attribute}]", '1', metadata.value, - class: "form-check-input #{invalid(post, attribute)}", - aria: { describedby: id_for_help(attribute) }, - autofocus: autofocus - = label_tag "post_#{attribute}", post_label_t(attribute, post: post), - class: 'form-check-label' + = hidden_field_tag "post[#{attribute}]", '0', id: '' + .custom-control.custom-switch + = check_box_tag "post[#{attribute}]", '1', metadata.value, + class: "custom-control-input #{invalid(post, attribute)}", + aria: { describedby: id_for_help(attribute) }, + autofocus: autofocus + = label_tag "post_#{attribute}", post_label_t(attribute, post: post), + class: 'custom-control-label' - = render 'posts/attribute_feedback', - post: post, attribute: attribute, metadata: metadata + = render 'posts/attribute_feedback', + post: post, attribute: attribute, metadata: metadata diff --git a/app/views/posts/template_field/_check_box.haml b/app/views/posts/template_field/_check_box.haml deleted file mode 100644 index 0a8ee026..00000000 --- a/app/views/posts/template_field/_check_box.haml +++ /dev/null @@ -1,8 +0,0 @@ -- field_name = field_name_for_post_as_string(name) -= hidden_field_tag field_name, 'false' -.form-check - = check_box_tag field_name, - 'true', - value == 'true', - class: 'form-check-input' - = label_tag field_name, t('posts.checkbox'), class: 'form-check-label' diff --git a/app/views/posts/template_field/_check_box_group.haml b/app/views/posts/template_field/_check_box_group.haml deleted file mode 100644 index 1a035e95..00000000 --- a/app/views/posts/template_field/_check_box_group.haml +++ /dev/null @@ -1,12 +0,0 @@ --# 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 - = check_box_tag field_name+'[]', - v, - @post.fetch_front_matter(name, []).include?(v), - class: 'form-check-input' - = label_tag field_name, v, class: 'form-check-label' diff --git a/app/views/posts/template_field/_radio_group.haml b/app/views/posts/template_field/_radio_group.haml deleted file mode 100644 index 02facb03..00000000 --- a/app/views/posts/template_field/_radio_group.haml +++ /dev/null @@ -1,15 +0,0 @@ --# 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