From 795256f80363f66d1fe8e51c48c21b5c5f18a80c Mon Sep 17 00:00:00 2001 From: f Date: Mon, 21 Oct 2024 16:18:27 -0300 Subject: [PATCH] fix: poder vaciar el predefined value --- app/models/metadata_new_predefined_value.rb | 6 +++++- config/locales/en.yml | 2 ++ config/locales/es.yml | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/metadata_new_predefined_value.rb b/app/models/metadata_new_predefined_value.rb index ff839759..929934b2 100644 --- a/app/models/metadata_new_predefined_value.rb +++ b/app/models/metadata_new_predefined_value.rb @@ -1,4 +1,8 @@ # frozen_string_literal: true # Nueva interfaz -class MetadataNewPredefinedValue < MetadataPredefinedValue; end +class MetadataNewPredefinedValue < MetadataPredefinedValue + def values + @values ||= (required ? {} : { I18n.t('posts.attributes.new_predefined_value.empty') => '' }).merge(super) + end +end diff --git a/config/locales/en.yml b/config/locales/en.yml index ec5b34a9..955f3d20 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -761,6 +761,8 @@ en: edit: "Edit" new_predefined_array: edit: "Edit" + new_predefined_value: + empty: "(Empty)" new_array: edit: "Edit" new_has_one: diff --git a/config/locales/es.yml b/config/locales/es.yml index 61c645a0..6f567933 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -768,8 +768,10 @@ es: new_has_and_belongs_to_many: edit: "Editar" new_predefined_array: + empty: "(Vacío)" edit: "Editar" new_predefined_value: + empty: "(Vacío)" edit: "Editar" new_array: edit: "Editar"