hide budget investment table heading if no results

This commit is contained in:
decabeza
2018-01-09 19:17:19 +01:00
parent 458b2aeb2d
commit 271c6869cd
3 changed files with 73 additions and 65 deletions

View File

@@ -1,72 +1,78 @@
<div class='relative'> <div class='relative'>
<%= link_to 'download current selecction',admin_budget_budget_investments_path(csv_params), class: 'advanced-search small' %> <%= link_to 'download current selecction',admin_budget_budget_investments_path(csv_params), class: 'advanced-search small' %>
<h3><%= page_entries_info @investments %></h3>
</div> </div>
<table> <% if @investments.any? %>
<thead> <h3><%= page_entries_info @investments %></h3>
<tr> <table>
<th><%= t("admin.budget_investments.index.table_id") %></th> <thead>
<th><%= t("admin.budget_investments.index.table_title") %></th> <tr>
<th><%= t("admin.budget_investments.index.table_supports") %></th> <th><%= t("admin.budget_investments.index.table_id") %></th>
<th><%= t("admin.budget_investments.index.table_admin") %></th> <th><%= t("admin.budget_investments.index.table_title") %></th>
<th><%= t("admin.budget_investments.index.table_valuator") %></th> <th><%= t("admin.budget_investments.index.table_supports") %></th>
<th><%= t("admin.budget_investments.index.table_geozone") %></th> <th><%= t("admin.budget_investments.index.table_admin") %></th>
<th><%= t("admin.budget_investments.index.table_feasibility") %></th> <th><%= t("admin.budget_investments.index.table_valuator") %></th>
<th class="text-center"><%= t("admin.budget_investments.index.table_valuation_finished") %></th> <th><%= t("admin.budget_investments.index.table_geozone") %></th>
<th class="text-center"><%= t("admin.budget_investments.index.table_selection") %></th> <th><%= t("admin.budget_investments.index.table_feasibility") %></th>
<% if params[:filter] == 'selected' %> <th class="text-center"><%= t("admin.budget_investments.index.table_valuation_finished") %></th>
<th class="text-center"><%= t("admin.budget_investments.index.table_incompatible") %></th> <th class="text-center"><%= t("admin.budget_investments.index.table_selection") %></th>
<% end %> <% if params[:filter] == 'selected' %>
</tr> <th class="text-center"><%= t("admin.budget_investments.index.table_incompatible") %></th>
</thead> <% end %>
</tr>
</thead>
<% @investments.each do |investment| %> <% @investments.each do |investment| %>
<tr id="<%= dom_id(investment) %>" class="budget_investment"> <tr id="<%= dom_id(investment) %>" class="budget_investment">
<td class="text-right"> <td class="text-right">
<strong><%= investment.id %></strong> <strong><%= investment.id %></strong>
</td>
<td>
<%= link_to investment.title, admin_budget_budget_investment_path(budget_id: @budget.id, id: investment.id, params: Budget::Investment.filter_params(params)) %>
</td>
<td class="text-center">
<%= investment.total_votes %>
</td>
<td class="small">
<% if investment.administrator.present? %>
<span title="<%= t('admin.budget_investments.index.assigned_admin') %>"><%= investment.administrator.name %></span>
<% else %>
<%= t("admin.budget_investments.index.no_admin_assigned") %>
<% end %>
</td>
<td class="small">
<% if investment.valuators.size == 0 %>
<%= t("admin.budget_investments.index.no_valuators_assigned") %>
<% else %>
<%= investment.valuators.collect(&:description_or_name).join(', ') %>
<% end %>
</td>
<td class="small">
<%= investment.heading.name %>
</td>
<td class="small">
<%= t("admin.budget_investments.index.feasibility.#{investment.feasibility}",
price: investment.formatted_price)
%>
</td>
<td class="small text-center">
<%= investment.valuation_finished? ? t('shared.yes'): t('shared.no') %>
</td>
<td class="small">
<%= investment_selected_link(investment) %>
</td>
<% if params[:filter] == 'selected' %>
<td class="small text-center">
<%= investment.incompatible? ? t('shared.yes'): t('shared.no') %>
</td> </td>
<% end %> <td>
</tr> <%= link_to investment.title, admin_budget_budget_investment_path(budget_id: @budget.id, id: investment.id, params: Budget::Investment.filter_params(params)) %>
<% end %> </td>
</table> <td class="text-center">
<%= investment.total_votes %>
</td>
<td class="small">
<% if investment.administrator.present? %>
<span title="<%= t('admin.budget_investments.index.assigned_admin') %>"><%= investment.administrator.name %></span>
<% else %>
<%= t("admin.budget_investments.index.no_admin_assigned") %>
<% end %>
</td>
<td class="small">
<% if investment.valuators.size == 0 %>
<%= t("admin.budget_investments.index.no_valuators_assigned") %>
<% else %>
<%= investment.valuators.collect(&:description_or_name).join(', ') %>
<% end %>
</td>
<td class="small">
<%= investment.heading.name %>
</td>
<td class="small">
<%= t("admin.budget_investments.index.feasibility.#{investment.feasibility}",
price: investment.formatted_price)
%>
</td>
<td class="small text-center">
<%= investment.valuation_finished? ? t('shared.yes'): t('shared.no') %>
</td>
<td class="small">
<%= investment_selected_link(investment) %>
</td>
<% if params[:filter] == 'selected' %>
<td class="small text-center">
<%= investment.incompatible? ? t('shared.yes'): t('shared.no') %>
</td>
<% end %>
</tr>
<% end %>
</table>
<%= paginate @investments %> <%= paginate @investments %>
<% else %>
<div class="callout primary">
<%= t("admin.budget_investments.index.no_budget_investments") %>
</div>
<% end %>

View File

@@ -129,6 +129,7 @@ en:
selected: Selected selected: Selected
winners: Winners winners: Winners
all: All all: All
no_budget_investments: "There are no investment projects."
title: Investment projects title: Investment projects
assigned_admin: Assigned administrator assigned_admin: Assigned administrator
no_admin_assigned: No admin assigned no_admin_assigned: No admin assigned

View File

@@ -130,6 +130,7 @@ es:
selected: Seleccionadas selected: Seleccionadas
winners: Ganadoras winners: Ganadoras
all: Todas all: Todas
no_budget_investments: "No hay proyectos de inversión."
title: Proyectos de inversión title: Proyectos de inversión
assigned_admin: Administrador asignado assigned_admin: Administrador asignado
no_admin_assigned: Sin admin asignado no_admin_assigned: Sin admin asignado