adds simple investment show view to admin

valuators info is missing
This commit is contained in:
Juanjo Bazán
2016-09-06 17:04:31 +02:00
parent 31ef3f4c98
commit 6542812647
5 changed files with 125 additions and 5 deletions

View File

@@ -1,15 +1,21 @@
class Admin::BudgetInvestmentsController < Admin::BaseController class Admin::BudgetInvestmentsController < Admin::BaseController
before_action :load_budget, only: [:index, :show]
has_filters %w{valuation_open without_admin managed valuating valuation_finished all}, only: :index has_filters %w{valuation_open without_admin managed valuating valuation_finished all}, only: :index
def index def index
@budget = Budget.includes(:groups).find params[:budget_id] @investments = Budget::Investment.scoped_filter(params, @current_filter).order(cached_votes_up: :desc, created_at: :desc).page(params[:page])
@investments = @budget.investments.scoped_filter(params, @current_filter).order(cached_votes_up: :desc, created_at: :desc).page(params[:page])
end end
def show def show
@budget = Budget.includes(:groups).find params[:budget_id] @investment = Budget::Investment.where(budget_id: @budget.id).find params[:id]
@investment = @budget.investments.find params[:id]
end end
private
def load_budget
@budget = Budget.includes(:groups).find params[:budget_id]
end
end end

View File

@@ -0,0 +1,36 @@
<div class="callout primary float-right">
<%= t "admin.budget_investments.show.info", budget_name: @budget.name, group_name: @investment.group.name, id: @investment.id %>
</div>
<br>
<h1 class="inline-block"><%= @investment.title %></h1>
<div class="row small-collapse spending-proposal-info">
<div class="small-12 medium-4 column">
<p title="<%= t("admin.budget_investments.show.group") %>: <%= @investment.group.name %>">
<strong><%= t("admin.budget_investments.show.heading") %>:</strong>
<%= @investment.heading.name %>
</p>
</div>
<div class="small-12 medium-4 column">
<p>
<strong><%= t("admin.budget_investments.show.by") %>:</strong>
<%= link_to @investment.author.name, admin_user_path(@investment.author) %>
</p>
</div>
<div class="small-12 medium-4 column">
<p>
<strong><%= t("admin.budget_investments.show.sent") %>:</strong>
<%= l @investment.created_at, format: :datetime %>
</p>
</div>
</div>
<% if @investment.external_url.present? %>
<p><%= text_with_links @investment.external_url %>&nbsp;<span class="icon-external small"></span></p>
<% end %>
<%= safe_html_with_links @investment.description %>

View File

@@ -1 +1,49 @@
<%= @investment.title %> <%= link_to admin_budget_budget_investments_path(Budget::Investment.filter_params(params)), data: {no_turbolink: true} do %>
<span class="icon-angle-left"></span> <%= t("shared.back") %>
<% end %>
<%= render 'written_by_author' %>
<%= link_to t("admin.budget_investments.show.edit"),
admin_budget_budget_investment_path(@budget, @investment,
Budget::Investment.filter_params(params)) %>
<hr>
<h2 id="classification"><%= t("admin.budget_investments.show.classification") %></h2>
<p><strong><%= t("admin.budget_investments.show.assigned_admin") %>:</strong>
<%= @investment.administrator.try(:name_and_email) || t("admin.budget_investments.show.undefined") %>
</p>
<p id="tags">
<strong><%= t("admin.budget_investments.show.tags") %>:</strong>
<%= @investment.tags.pluck(:name).join(', ') %>
</p>
<p id="assigned_valuators">
<strong><%= t("admin.budget_investments.show.assigned_valuators") %>:</strong>
<% if @investment.valuators.any? %>
<%= @investment.valuators.collect(&:name_and_email).join(', ') %>
<% else %>
<%= t("admin.budget_investments.show.undefined") %>
<% end %>
</p>
<p>
<%= link_to t("admin.budget_investments.show.edit_classification"),
edit_admin_spending_proposal_path(@investment,
{anchor: 'classification'}.merge(Budget::Investment.filter_params(params))) %>
</p>
<hr>
<h2><%= t("admin.budget_investments.show.dossier") %></h2>
<%# render 'valuation/budget_investments/written_by_valuators' %>
<p>
<%= link_to t("admin.budget_investments.show.edit_dossier"), edit_valuation_spending_proposal_path(@investment) %>
</p>

View File

@@ -114,6 +114,21 @@ en:
feasible: "Feasible (%{price})" feasible: "Feasible (%{price})"
not_feasible: "Not feasible" not_feasible: "Not feasible"
undefined: "Undefined" undefined: "Undefined"
show:
assigned_admin: Assigned administrator
assigned_valuators: Assigned valuators
classification: Clasification
info: "%{budget_name} - Group: %{group_name} - Investment project %{id}"
edit: Edit
edit_classification: Edit classification
by: By
sent: Sent
group: Grupo
heading: Partida
dossier: Dossier
edit_dossier: Edit dossier
tags: Tags
undefined: Undefined
comments: comments:
index: index:
filter: Filter filter: Filter

View File

@@ -114,6 +114,21 @@ es:
feasible: "Viable (%{price})" feasible: "Viable (%{price})"
not_feasible: "Inviable" not_feasible: "Inviable"
undefined: "Sin definir" undefined: "Sin definir"
show:
assigned_admin: Administrador asignado
assigned_valuators: Evaluadores asignados
classification: Clasificación
info: "%{budget_name} - Grupo: %{group_name} - Propuesta de inversión %{id}"
edit: Editar
edit_classification: Editar clasificación
by: Autor
sent: Fecha
group: Grupo
heading: Partida
dossier: Informe
edit_dossier: Editar informe
tags: Etiquetas
undefined: Sin definir
comments: comments:
index: index:
filter: Filtro filter: Filtro