From 360b999dcb049fc13bda3ff30096cc691e02d7bc Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Feb 2021 11:49:15 -0300 Subject: [PATCH] =?UTF-8?q?la=20opci=C3=B3n=20required=20tiene=20m=C3=A1s?= =?UTF-8?q?=20prioridad=20que=20la=20definici=C3=B3n=20closes=20#217?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- app/views/posts/attributes/_image.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a389327a..23b4c995 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -73,7 +73,7 @@ module ApplicationHelper # Opciones por defecto para el campo de un formulario def field_options(attribute, metadata, **extra) - required = metadata.required || extra[:required] + required = extra.key?(:required) ? extra[:required] : metadata.required { class: "form-control #{invalid(metadata.post, attribute)} #{extra[:class]}", diff --git a/app/views/posts/attributes/_image.haml b/app/views/posts/attributes/_image.haml index 06503700..2824b4c9 100644 --- a/app/views/posts/attributes/_image.haml +++ b/app/views/posts/attributes/_image.haml @@ -32,7 +32,7 @@ = text_field(*field_name_for(base, attribute, :description), value: metadata.value['description'], dir: dir, lang: locale, - **field_options(attribute, metadata)) + **field_options(attribute, metadata, required: false)) = render 'posts/attribute_feedback', post: post, attribute: [attribute, :description], metadata: metadata