diff --git a/app/models/metadata_related_posts.rb b/app/models/metadata_related_posts.rb index 42d1381b..2728020e 100644 --- a/app/models/metadata_related_posts.rb +++ b/app/models/metadata_related_posts.rb @@ -26,6 +26,13 @@ class MetadataRelatedPosts < MetadataArray posts.where(uuid: value).map(&:title).map(&:value) end + # Encuentra el filtro + # + # @return [Hash] + def filter + layout.metadata.dig(name, 'filter')&.to_h&.symbolize_keys || {} + end + private # Obtiene todos los posts y opcionalmente los filtra @@ -37,11 +44,6 @@ class MetadataRelatedPosts < MetadataArray "#{post&.title&.value || post&.slug&.value} #{post&.date&.value.strftime('%F')} (#{post.layout.humanized_name})" end - # Encuentra el filtro - def filter - layout.metadata.dig(name, 'filter')&.to_h&.symbolize_keys || {} - end - def sanitize(uuid) super(uuid.map do |u| u.to_s.gsub(/[^a-f0-9\-]/i, '') diff --git a/config/locales/en.yml b/config/locales/en.yml index 6a2eb7d8..ebc7b9c2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -729,6 +729,7 @@ en: filter: "Start typing to filter..." accept: "Accept" cancel: "Cancel" + add: "Add %{layout}" new_predefined_array: edit: "Edit" filter: "Start typing to filter..." diff --git a/config/locales/es.yml b/config/locales/es.yml index 1da0edf9..e56a09e5 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -737,6 +737,7 @@ es: filter: "Empezá a escribir para filtrar..." accept: "Aceptar" cancel: "Cancelar" + add: "Agregar %{layout}" new_predefined_array: edit: "Editar" filter: "Empezá a escribir para filtrar..."