diff --git a/app/controllers/admin/budget_investments_controller.rb b/app/controllers/admin/budget_investments_controller.rb index bf15ee7f6..10342081c 100644 --- a/app/controllers/admin/budget_investments_controller.rb +++ b/app/controllers/admin/budget_investments_controller.rb @@ -1,15 +1,21 @@ 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 def index - @budget = Budget.includes(:groups).find params[:budget_id] - @investments = @budget.investments.scoped_filter(params, @current_filter).order(cached_votes_up: :desc, created_at: :desc).page(params[:page]) + @investments = Budget::Investment.scoped_filter(params, @current_filter).order(cached_votes_up: :desc, created_at: :desc).page(params[:page]) end def show - @budget = Budget.includes(:groups).find params[:budget_id] - @investment = @budget.investments.find params[:id] + @investment = Budget::Investment.where(budget_id: @budget.id).find params[:id] end + private + + def load_budget + @budget = Budget.includes(:groups).find params[:budget_id] + end + end \ No newline at end of file diff --git a/app/views/admin/budget_investments/_written_by_author.html.erb b/app/views/admin/budget_investments/_written_by_author.html.erb new file mode 100644 index 000000000..b2c46c6f5 --- /dev/null +++ b/app/views/admin/budget_investments/_written_by_author.html.erb @@ -0,0 +1,36 @@ +
+ <%= t "admin.budget_investments.show.info", budget_name: @budget.name, group_name: @investment.group.name, id: @investment.id %> +
+ +
+

<%= @investment.title %>

+ +
+
+

: <%= @investment.group.name %>"> + <%= t("admin.budget_investments.show.heading") %>: + <%= @investment.heading.name %> +

+
+ +
+

+ <%= t("admin.budget_investments.show.by") %>: + <%= link_to @investment.author.name, admin_user_path(@investment.author) %> +

+
+ +
+

+ <%= t("admin.budget_investments.show.sent") %>: + <%= l @investment.created_at, format: :datetime %> +

+
+ +
+ +<% if @investment.external_url.present? %> +

<%= text_with_links @investment.external_url %> 

+<% end %> + +<%= safe_html_with_links @investment.description %> diff --git a/app/views/admin/budget_investments/show.html.erb b/app/views/admin/budget_investments/show.html.erb index a142a388d..47e66bc37 100644 --- a/app/views/admin/budget_investments/show.html.erb +++ b/app/views/admin/budget_investments/show.html.erb @@ -1 +1,49 @@ -<%= @investment.title %> \ No newline at end of file +<%= link_to admin_budget_budget_investments_path(Budget::Investment.filter_params(params)), data: {no_turbolink: true} do %> + <%= 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)) %> + +
+ +

<%= t("admin.budget_investments.show.classification") %>

+ +

<%= t("admin.budget_investments.show.assigned_admin") %>: + <%= @investment.administrator.try(:name_and_email) || t("admin.budget_investments.show.undefined") %> +

+ +

+ <%= t("admin.budget_investments.show.tags") %>: + + <%= @investment.tags.pluck(:name).join(', ') %> +

+ +

+ <%= t("admin.budget_investments.show.assigned_valuators") %>: + <% if @investment.valuators.any? %> + <%= @investment.valuators.collect(&:name_and_email).join(', ') %> + <% else %> + <%= t("admin.budget_investments.show.undefined") %> + <% end %> +

+ +

+ <%= link_to t("admin.budget_investments.show.edit_classification"), + edit_admin_spending_proposal_path(@investment, + {anchor: 'classification'}.merge(Budget::Investment.filter_params(params))) %> +

+ +
+ +

<%= t("admin.budget_investments.show.dossier") %>

+ +<%# render 'valuation/budget_investments/written_by_valuators' %> + +

+ <%= link_to t("admin.budget_investments.show.edit_dossier"), edit_valuation_spending_proposal_path(@investment) %> +

+ diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 4a9abf7d3..9b5e7c19c 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -114,6 +114,21 @@ en: feasible: "Feasible (%{price})" not_feasible: "Not feasible" 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: index: filter: Filter diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 3600c2448..4f4536950 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -114,6 +114,21 @@ es: feasible: "Viable (%{price})" not_feasible: "Inviable" 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: index: filter: Filtro