Skip to content

Commit

Permalink
Add 'current applied filters' message to investments partial
Browse files Browse the repository at this point in the history
  • Loading branch information
aitbw committed Jan 22, 2018
1 parent 1027896 commit 3f6a918
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
13 changes: 13 additions & 0 deletions app/views/admin/budget_investments/_filters_description.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<% if params[:filter].present? && params[:second_filter].present? %>
<p class="inline-block"><%= t("#{i18n_namespace}.filters.two_filters_html",
filter: t("#{i18n_namespace}.filters.#{params[:filter]}"),
second_filter: t("#{i18n_namespace}.filters.#{params[:second_filter]}")) %></p>

<% elsif params[:filter].present? %>
<p class="inline-block"><%= t("#{i18n_namespace}.filters.one_filter_html",
filter: t("#{i18n_namespace}.filters.#{params[:filter]}")) %></p>

<% elsif params[:second_filter].present? %>
<p class="inline-block"><%= t("#{i18n_namespace}.filters.one_filter_html",
filter: t("#{i18n_namespace}.filters.#{params[:second_filter]}")) %></p>
<% end %>
5 changes: 4 additions & 1 deletion app/views/admin/budget_investments/_investments.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
class: "float-right small" %>
<% if @investments.any? %>
<h3 class="inline-block"><%= page_entries_info @investments %></h3>
<h3 class="inline-block"><%= page_entries_info @investments %></h3><br>

<%= render "filters_description", i18n_namespace: "admin.budget_investments.index" %>

<table class="table-for-mobile">
<thead>
<tr>
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ en:
max_per_heading: Max. supports per heading
winners: Winners
button: Filter
one_filter_html: "Current applied filter: <b><em>%{filter}</em></b>"
two_filters_html: "Current applied filters: <b><em>%{filter}, %{second_filter}</em></b>"
download_current_selection: "Download current selection"
no_budget_investments: "There are no investment projects."
title: Investment projects
Expand Down
2 changes: 2 additions & 0 deletions config/locales/es/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ es:
max_per_heading: Corte por partida
winners: Ganadores
button: Filtrar
one_filter_html: "Filtro en uso: <b><em>%{filter}</em></b>"
two_filters_html: "Filtros en uso: <b><em>%{filter}, %{second_filter}</em></b>"
download_current_selection: "Descargar selección actual"
no_budget_investments: "No hay proyectos de gasto."
title: Proyectos de gasto
Expand Down

0 comments on commit 3f6a918

Please sign in to comment.