From 8dd41325be006d804f38beec8cb0e77fc30d41b3 Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 9 Jan 2018 19:17:19 +0100 Subject: [PATCH] hide budget investment table heading if no results --- .../budget_investments/_investments.html.erb | 188 +++++++++--------- config/locales/en/admin.yml | 1 + config/locales/es/admin.yml | 1 + 3 files changed, 98 insertions(+), 92 deletions(-) diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb index 741ccd9fd..62494a362 100644 --- a/app/views/admin/budget_investments/_investments.html.erb +++ b/app/views/admin/budget_investments/_investments.html.erb @@ -2,100 +2,104 @@ <%= link_to t("admin.budget_investments.index.download_current_selection"), admin_budget_budget_investments_path(csv_params), class: 'advanced-search small' %> - -

<%= page_entries_info @investments %>

- - - - - - - - - - - - - <% if params[:filter] == 'selected' %> - - <% end %> - - +<% if @investments.any? %> +

<%= page_entries_info @investments %>

+
<%= t("admin.budget_investments.index.table_id") %><%= t("admin.budget_investments.index.table_title") %><%= t("admin.budget_investments.index.table_supports") %><%= t("admin.budget_investments.index.table_admin") %><%= t("admin.budget_investments.index.table_valuator") %><%= t("admin.budget_investments.index.table_geozone") %><%= t("admin.budget_investments.index.table_feasibility") %><%= t("admin.budget_investments.index.table_valuation_finished") %><%= t("admin.budget_investments.index.table_selection") %><%= t("admin.budget_investments.index.table_incompatible") %>
+ + + + + + + + + + + + <% if params[:filter] == 'selected' %> + + <% end %> + + - <% @investments.each do |investment| %> - - - - - - - - - - - <% if params[:filter] == 'selected' %> - + - <% end %> - - <% end %> -
<%= t("admin.budget_investments.index.table_id") %><%= t("admin.budget_investments.index.table_title") %><%= t("admin.budget_investments.index.table_supports") %><%= t("admin.budget_investments.index.table_admin") %><%= t("admin.budget_investments.index.table_valuator") %><%= t("admin.budget_investments.index.table_geozone") %><%= t("admin.budget_investments.index.table_feasibility") %><%= t("admin.budget_investments.index.table_valuation_finished") %><%= t("admin.budget_investments.index.table_selection") %><%= t("admin.budget_investments.index.table_incompatible") %>
- <%= investment.id %> - - <%= link_to investment.title, - admin_budget_budget_investment_path(budget_id: @budget.id, - id: investment.id, - params: Budget::Investment.filter_params(params)), - target: "_blank" %> - - <%= investment.total_votes %> - - <% if investment.administrator.present? %> - - <%= investment.administrator.name %> - - <% else %> - <%= t("admin.budget_investments.index.no_admin_assigned") %> - <% end %> - - <% if investment.valuators.size == 0 %> - <%= t("admin.budget_investments.index.no_valuators_assigned") %> - <% else %> - <%= investment.valuators.collect(&:description_or_name).join(', ') %> - <% end %> - - <%= investment.heading.name %> - - <%= t("admin.budget_investments.index.feasibility.#{investment.feasibility}", - price: investment.formatted_price) - %> - - <%= investment.valuation_finished? ? t('shared.yes'): t('shared.no') %> - - <% if investment.selected? %> - <%= link_to_unless investment.budget.finished?, - t("admin.budget_investments.index.selected"), - toggle_selection_admin_budget_budget_investment_path(@budget, - investment, - filter: params[:filter], - page: params[:page]), - method: :patch, - remote: true, - class: "button small expanded" %> - <% elsif investment.feasible? && investment.valuation_finished? %> - <%= link_to_unless investment.budget.finished?, - t("admin.budget_investments.index.select"), - toggle_selection_admin_budget_budget_investment_path(@budget, - investment, - filter: params[:filter], - page: params[:page]), - method: :patch, - remote: true, - class: "button small hollow expanded" %> - <% end %> - - <%= investment.incompatible? ? t('shared.yes'): t('shared.no') %> + <% @investments.each do |investment| %> +
+ <%= investment.id %>
+ + <%= link_to investment.title, + admin_budget_budget_investment_path(budget_id: @budget.id, + id: investment.id, + params: Budget::Investment.filter_params(params)) %> + + + <%= investment.total_votes %> + + + <% if investment.administrator.present? %> + + <%= investment.administrator.name %> + + <% else %> + <%= t("admin.budget_investments.index.no_admin_assigned") %> + <% end %> + + + <% if investment.valuators.size == 0 %> + <%= t("admin.budget_investments.index.no_valuators_assigned") %> + <% else %> + <%= investment.valuators.collect(&:description_or_name).join(', ') %> + <% end %> + + + <%= investment.heading.name %> + + + <%= t("admin.budget_investments.index.feasibility.#{investment.feasibility}", + price: investment.formatted_price) + %> + + + <%= investment.valuation_finished? ? t('shared.yes'): t('shared.no') %> + + + <% if investment.selected? %> + <%= link_to_unless investment.budget.finished?, + t("admin.budget_investments.index.selected"), + toggle_selection_admin_budget_budget_investment_path(@budget, + investment, + filter: params[:filter], + page: params[:page]), + method: :patch, + remote: true, + class: "button small expanded" %> + <% elsif investment.feasible? && investment.valuation_finished? %> + <%= link_to_unless investment.budget.finished?, + t("admin.budget_investments.index.select"), + toggle_selection_admin_budget_budget_investment_path(@budget, + investment, + filter: params[:filter], + page: params[:page]), + method: :patch, + remote: true, + class: "button small hollow expanded" %> + <% end %> + + <% if params[:filter] == 'selected' %> + + <%= investment.incompatible? ? t('shared.yes'): t('shared.no') %> + + <% end %> + + <% end %> + -<%= paginate @investments %> + <%= paginate @investments %> +<% else %> +
+ <%= t("admin.budget_investments.index.no_budget_investments") %> +
+<% end %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index da02108ff..624c6335a 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -129,6 +129,7 @@ en: selected: Selected winners: Winners all: All + no_budget_investments: "There are no investment projects." title: Investment projects assigned_admin: Assigned administrator no_admin_assigned: No admin assigned diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 5240b9e5c..2e3ece939 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -130,6 +130,7 @@ es: selected: Seleccionadas winners: Ganadoras all: Todas + no_budget_investments: "No hay proyectos de inversión." title: Proyectos de inversión assigned_admin: Administrador asignado no_admin_assigned: Sin admin asignado