diff --git a/app/models/metadata_new_array.rb b/app/models/metadata_new_array.rb index a76ff9f2..65993be2 100644 --- a/app/models/metadata_new_array.rb +++ b/app/models/metadata_new_array.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -# Implementa la nueva interfaz de +# Implementa la nueva interfaz de gestión de valores class MetadataNewArray < MetadataArray - end diff --git a/app/views/bootstrap/_btn.haml b/app/views/bootstrap/_btn.haml index 22f60b3e..1bbebb26 100644 --- a/app/views/bootstrap/_btn.haml +++ b/app/views/bootstrap/_btn.haml @@ -5,8 +5,9 @@ @param :action [String] Acción de Stimulus @param :target [String] Objetivo de Stimulus @param [Hash] Atributos en bruto, con mayor prioridad que action y target -- attributes = local_assigns.to_h.except(:content) -- attributes[:data] ||= {} -- attributes[:data][:action] ||= local_assigns[:action] -- attributes[:data][:target] ||= local_assigns[:target] +:ruby + attributes = local_assigns.to_h.except(:content) + attributes[:data] ||= {} + attributes[:data][:action] ||= local_assigns[:action] + attributes[:data][:target] ||= local_assigns[:target] %button.btn.btn-secondary{ type: 'button', **attributes }= content diff --git a/app/views/bootstrap/_custom_checkbox.haml b/app/views/bootstrap/_custom_checkbox.haml index a2cf6c27..c8cd1b41 100644 --- a/app/views/bootstrap/_custom_checkbox.haml +++ b/app/views/bootstrap/_custom_checkbox.haml @@ -1,6 +1,7 @@ -- help_id = "#{id}_help" -- checkbox_attributes = local_assigns.slice(:id, :type, :name, :value, :required, :checked) -- checkbox_attributes[:type] ||= 'checkbox' +:ruby + help_id = "#{id}_help" + checkbox_attributes = local_assigns.slice(:id, :type, :name, :value, :required, :checked) + checkbox_attributes[:type] ||= 'checkbox' .custom-control.custom-checkbox %input.custom-control-input{ **checkbox_attributes } diff --git a/app/views/bootstrap/_modal.haml b/app/views/bootstrap/_modal.haml index b57fc94e..f6dafc2a 100644 --- a/app/views/bootstrap/_modal.haml +++ b/app/views/bootstrap/_modal.haml @@ -18,9 +18,10 @@ - content_for :algo_footer do = 'pie' -- local_assigns[:hide_actions] ||= [] -- local_assigns[:hide_actions] << 'click->modal#hide' -- local_assigns[:modal_content_attributes] ||= {} +:ruby + local_assigns[:hide_actions] ||= [] + local_assigns[:hide_actions] << 'click->modal#hide' + local_assigns[:modal_content_attributes] ||= {} .modal.fade{ tabindex: -1, aria: { hidden: 'true' }, data: { target: 'modal.modal' } } .modal-backdrop.fade{ data: { target: 'modal.backdrop', action: local_assigns[:hide_actions].join(' ') } } diff --git a/app/views/posts/attributes/_new_array.haml b/app/views/posts/attributes/_new_array.haml index 79ba22e2..394345a6 100644 --- a/app/views/posts/attributes/_new_array.haml +++ b/app/views/posts/attributes/_new_array.haml @@ -1,8 +1,9 @@ -# Genera un listado de checkboxes entre los que se puede elegir para guardar -- id = "#{base}_#{attribute}" -- name = "#{base}[#{attribute}][]" -- form_id = "form-#{Nanoid.generate}" +:ruby + id = "#{base}_#{attribute}" + name = "#{base}[#{attribute}][]" + form_id = "form-#{Nanoid.generate}" %div{ data: { controller: 'modal array', 'array-original-value': metadata.value.to_json, 'array-new-array-value': site_posts_new_array_value_path(site) } } .form-group @@ -29,7 +30,7 @@ - content_for :"#{id}_header" do .form-group.flex-grow-1.mb-0 = label_tag id, post_label_t(attribute, post: post) - %input.form-control{data: { target: 'array.search', action: 'input->array#search' }, type: 'search', placeholder: t('.filter') } + %input.form-control{ data: { target: 'array.search', action: 'input->array#search' }, type: 'search', placeholder: t('.filter') } - content_for :"#{id}_body" do .form-group.mb-0{ id: "#{id}_body" } @@ -40,7 +41,7 @@ - content_for :"#{id}_footer" do .input-group.w-auto.flex-grow-1.my-0 - %input.form-control{form: form_id, name: 'value', type: 'text', placeholder: t('.add_new')} + %input.form-control{ form: form_id, name: 'value', type: 'text', placeholder: t('.add_new') } .input-group-append = render 'bootstrap/btn', content: t('.add'), form: form_id, type: 'submit', class: 'mb-0 mr-0' = render 'bootstrap/btn', content: t('.accept'), action: 'array#accept modal#hide', class: 'm-0 mr-1' diff --git a/app/views/posts/new_array.haml b/app/views/posts/new_array.haml index 81cdcdea..62f74854 100644 --- a/app/views/posts/new_array.haml +++ b/app/views/posts/new_array.haml @@ -5,4 +5,4 @@ .flex-grow-1 = render 'bootstrap/custom_checkbox', name: @name, id: "value-#{Nanoid.generate}", value: @value, checked: true, content: @value %div - %button.btn.btn-sm.m-0{ data: { action: 'array#remove', 'remove-target-param': item_id }}= t('.remove') + %button.btn.btn-sm.m-0{ data: { action: 'array#remove', 'remove-target-param': item_id } }= t('.remove')