From 754e8fbbcc19b9df0793694f1415f137a8a74c34 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 7 May 2021 17:32:54 -0300 Subject: [PATCH] =?UTF-8?q?mostrar=20cu=C3=A1les=20son=20los=20filtros=20a?= =?UTF-8?q?ctuales=20y=20poder=20removerlos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit además, crear una sección de notas al pie con definiciones disponibles para lectores de pantalla. (no quiere decir que sean completas, `title` solo funciona con usuaries de mouse) --- app/views/posts/index.haml | 16 ++++++++++++++++ config/locales/en.yml | 1 + config/locales/es.yml | 1 + 3 files changed, 18 insertions(+) diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index 8fcb86b..717460c 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -60,6 +60,16 @@ - @site.locales.each do |locale| = link_to t("locales.#{locale}.name"), site_posts_path(@site, **@filter_params.merge(locale: locale)), class: "mr-2 mt-2 mb-2 #{locale == @locale ? 'active font-weight-bold' : ''}" + .pl-2-plus + - @filter_params.each do |param, value| + - if param == 'layout' + - value = @site.layouts[value.to_sym].humanized_name + = link_to site_posts_path(@site, **@filter_params.reject { |k, _| k == param }), + class: 'btn btn-secondary btn-sm', + title: t('posts.remove_filter_help', filter: value), + aria: { labelledby: "help-filter-#{param}" } do + = value + × - if @posts.empty? %h2= t('posts.empty') - else @@ -121,3 +131,9 @@ = link_to t('posts.edit'), edit_site_post_path(@site, post.path), class: 'btn btn-block' - if @usuarie || policy(post).destroy? = link_to t('posts.destroy'), site_post_path(@site, post.path), class: 'btn btn-block', method: :delete, data: { confirm: t('posts.confirm_destroy') } + +#footnotes{ hidden: true } + - @filter_params.each do |param, value| + - if param == 'layout' + - value = @site.layouts[value.to_sym].humanized_name + %label{ id: "help-filter-#{param}" }= t('posts.remove_filter_help', filter: value) diff --git a/config/locales/en.yml b/config/locales/en.yml index 54b6115..da1028f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -451,6 +451,7 @@ en: add: 'Add' filter: 'Filter' remove_filter: 'Back' + remove_filter_help: 'Remove the filter: %{filter}' categories: 'Everything' index: 'Posts' edit: 'Edit' diff --git a/config/locales/es.yml b/config/locales/es.yml index b98ae14..a9e8cac 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -515,6 +515,7 @@ es: add: 'Agregar' filter: 'Filtrar' remove_filter: 'Volver' + remove_filter_help: 'Quitar este filtro: %{filter}' index: 'Artículos' edit: 'Editar' preview: