adds valuation's spending proposal show
This commit is contained in:
@@ -4,7 +4,7 @@ class Valuation::SpendingProposalsController < Valuation::BaseController
|
||||
|
||||
has_filters %w{valuation_open valuating valuation_finished}, only: :index
|
||||
|
||||
load_resource
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
@spending_proposals = SpendingProposal.search(params, @current_filter).order(created_at: :desc).page(params[:page])
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<strong><%= spending_proposal.id %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to spending_proposal.title, spending_proposal_path(spending_proposal) %>
|
||||
<%= link_to spending_proposal.title, valuation_spending_proposal_path(spending_proposal) %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<% if spending_proposal.administrator.present? %>
|
||||
|
||||
74
app/views/valuation/spending_proposals/show.html.erb
Normal file
74
app/views/valuation/spending_proposals/show.html.erb
Normal file
@@ -0,0 +1,74 @@
|
||||
<%= link_to t("valuation.spending_proposals.show.back"), :back, class: 'back' %>
|
||||
<h2><%= t("valuation.spending_proposals.show.heading") %> <%= @spending_proposal.id %></h2>
|
||||
<h1><%= @spending_proposal.title %></h1>
|
||||
|
||||
<%= safe_html_with_links @spending_proposal.description %>
|
||||
|
||||
<% if @spending_proposal.external_url.present? %>
|
||||
<p><%= text_with_links @spending_proposal.external_url %></p>
|
||||
<% end %>
|
||||
|
||||
<h2><%= t("valuation.spending_proposals.show.info") %></h2>
|
||||
|
||||
<p><strong><%= t("valuation.spending_proposals.show.by") %>:</strong>
|
||||
<%= link_to @spending_proposal.author.name, user_path(@spending_proposal.author) %>
|
||||
</p>
|
||||
|
||||
<% if @spending_proposal.association_name.present? %>
|
||||
<p><strong><%= t("valuation.spending_proposals.show.association_name") %>:</strong>
|
||||
<%= @spending_proposal.association_name %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<p><strong><%= t("valuation.spending_proposals.show.geozone") %>:</strong>
|
||||
<%= geozone_name(@spending_proposal) %>
|
||||
</p>
|
||||
|
||||
<p><strong><%= t("valuation.spending_proposals.show.sent") %>:</strong>
|
||||
<%= l @spending_proposal.created_at, format: :datetime %>
|
||||
</p>
|
||||
|
||||
<h2><%= t("valuation.spending_proposals.show.responsibles") %></h2>
|
||||
|
||||
<p><strong><%= t("valuation.spending_proposals.show.assigned_admin") %>:</strong>
|
||||
<% if @spending_proposal.administrator.present? %>
|
||||
<%= @spending_proposal.administrator.name %> (<%= @spending_proposal.administrator.email %>)
|
||||
<% else %>
|
||||
<%= t("valuation.spending_proposals.show.undefined") %></li>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<p><strong><%= t("valuation.spending_proposals.show.assigned_valuators") %>:</strong></p>
|
||||
<div id="assigned_valuators">
|
||||
<ul>
|
||||
<% @spending_proposal.valuators.each do |valuator| %>
|
||||
<li><%= valuator.name %> (<%= valuator.email %>)</li>
|
||||
<% end %>
|
||||
|
||||
<% if @spending_proposal.valuators.empty? %>
|
||||
<li><%= t("valuation.spending_proposals.show.undefined") %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<h2><%= t("valuation.spending_proposals.show.dossier") %></h2>
|
||||
|
||||
<p><strong><%= t("valuation.spending_proposals.show.price") %> (<%= t("valuation.spending_proposals.show.currency") %>):</strong>
|
||||
<%= @spending_proposal.price.present? ? @spending_proposal.price : t("valuation.spending_proposals.show.undefined") %>
|
||||
</p>
|
||||
<%= simple_format(safe_html_with_links(@spending_proposal.price_explanation.html_safe), {}, sanitize: false) if @spending_proposal.price_explanation.present? %>
|
||||
|
||||
<p><strong><%= t("valuation.spending_proposals.show.feasibility") %>:</strong>
|
||||
<%= t("valuation.spending_proposals.show.#{@spending_proposal.feasibility}") %>
|
||||
</p>
|
||||
<%= simple_format(safe_html_with_links(@spending_proposal.feasible_explanation.html_safe), {}, sanitize: false) if @spending_proposal.feasible_explanation.present? %>
|
||||
|
||||
<% if @spending_proposal.valuation_finished %>
|
||||
<p><strong><%= t("valuation.spending_proposals.show.valuation_finished") %></strong>
|
||||
<% end %>
|
||||
|
||||
<% if @spending_proposal.internal_comments.present? %>
|
||||
<h2><%= t("valuation.spending_proposals.show.internal_comments") %></h2>
|
||||
<%= simple_format(safe_html_with_links(@spending_proposal.internal_comments.html_safe), {}, sanitize: false) %>
|
||||
<% end %>
|
||||
@@ -18,4 +18,24 @@ en:
|
||||
valuators_assigned:
|
||||
one: Assigned valuator
|
||||
other: "%{count} valuators assigned"
|
||||
no_valuators_assigned: No valuators assigned
|
||||
no_valuators_assigned: No valuators assigned
|
||||
show:
|
||||
back: Back
|
||||
heading: Investment project
|
||||
info: Author info
|
||||
association_name: Asociación
|
||||
by: Sent by
|
||||
sent: Sent at
|
||||
geozone: Scope
|
||||
dossier: Dossier
|
||||
price: Price
|
||||
currency: "€"
|
||||
feasibility: Feasibility
|
||||
feasible: Feasible
|
||||
not_feasible: Not feasible
|
||||
undefined: Undefined
|
||||
valuation_finished: Valuation finished
|
||||
internal_comments: Internal comments
|
||||
responsibles: Responsibles
|
||||
assigned_admin: Assigned admin
|
||||
assigned_valuators: Assigned valuators
|
||||
|
||||
@@ -18,4 +18,24 @@ es:
|
||||
valuators_assigned:
|
||||
one: Evaluador asignado
|
||||
other: "%{count} evaluadores asignados"
|
||||
no_valuators_assigned: Sin evaluador
|
||||
no_valuators_assigned: Sin evaluador
|
||||
show:
|
||||
back: Volver
|
||||
heading: Propuesta de inversión
|
||||
info: Datos de envío
|
||||
association_name: Asociación
|
||||
by: Enviada por
|
||||
sent: Fecha de creación
|
||||
geozone: Ámbito
|
||||
dossier: Informe
|
||||
price: Coste
|
||||
currency: "€"
|
||||
feasibility: Viabilidad
|
||||
feasible: Viable
|
||||
not_feasible: No viable
|
||||
undefined: Sin definir
|
||||
valuation_finished: Informe finalizado
|
||||
internal_comments: Commentarios internos
|
||||
responsibles: Responsables
|
||||
assigned_admin: Administrador asignado
|
||||
assigned_valuators: Evaluadores asignados
|
||||
|
||||
@@ -140,4 +140,35 @@ feature 'Valuation spending proposals' do
|
||||
expect(page).to have_content("Old idea")
|
||||
end
|
||||
|
||||
scenario 'Show' do
|
||||
administrator = create(:administrator, user: create(:user, username: 'Ana', email: 'ana@admins.org'))
|
||||
valuator = create(:valuator, user: create(:user, username: 'Rachel', email: 'rachel@valuators.org'))
|
||||
spending_proposal = create(:spending_proposal,
|
||||
geozone: create(:geozone),
|
||||
association_name: 'People of the neighbourhood',
|
||||
price: 1234.56,
|
||||
feasible: false,
|
||||
feasible_explanation: 'It is impossible',
|
||||
administrator: administrator)
|
||||
spending_proposal.valuators << valuator
|
||||
|
||||
visit valuation_spending_proposals_path
|
||||
|
||||
click_link spending_proposal.title
|
||||
|
||||
expect(page).to have_content(spending_proposal.title)
|
||||
expect(page).to have_content(spending_proposal.description)
|
||||
expect(page).to have_content(spending_proposal.author.name)
|
||||
expect(page).to have_content(spending_proposal.association_name)
|
||||
expect(page).to have_content(spending_proposal.geozone.name)
|
||||
expect(page).to have_content('1234.56')
|
||||
expect(page).to have_content('Not feasible')
|
||||
expect(page).to have_content('It is impossible')
|
||||
expect(page).to have_content('Ana (ana@admins.org)')
|
||||
|
||||
within('#assigned_valuators') do
|
||||
expect(page).to have_content('Rachel (rachel@valuators.org)')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user