From 2f4621ab09aa41dc2918fb5e977496745ac9b4f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?=
Date: Tue, 8 Mar 2016 14:01:16 +0100
Subject: [PATCH] adds helper for explanation fields
---
app/helpers/valuation_helper.rb | 4 ++++
app/views/valuation/spending_proposals/show.html.erb | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/app/helpers/valuation_helper.rb b/app/helpers/valuation_helper.rb
index cd70a6732..9e3a054c1 100644
--- a/app/helpers/valuation_helper.rb
+++ b/app/helpers/valuation_helper.rb
@@ -23,4 +23,8 @@ module ValuationHelper
end
end
+ def explanation_field(field)
+ simple_format_no_tags_no_sanitize(safe_html_with_links(field.html_safe)) if field.present?
+ end
+
end
\ No newline at end of file
diff --git a/app/views/valuation/spending_proposals/show.html.erb b/app/views/valuation/spending_proposals/show.html.erb
index e98968fee..16f83dbe4 100644
--- a/app/views/valuation/spending_proposals/show.html.erb
+++ b/app/views/valuation/spending_proposals/show.html.erb
@@ -65,7 +65,8 @@
<%= t("valuation.spending_proposals.show.price_first_year") %> (<%= t("valuation.spending_proposals.show.currency") %>):
<%= @spending_proposal.price_first_year.presence or t("valuation.spending_proposals.show.undefined") %>
-<%= simple_format(safe_html_with_links(@spending_proposal.price_explanation.html_safe), {}, sanitize: false) if @spending_proposal.price_explanation.present? %>
+
+<%= explanation_field @spending_proposal.price_explanation %>
<%= t("valuation.spending_proposals.show.time_scope") %>:
@@ -77,7 +78,7 @@
<%= t("valuation.spending_proposals.show.#{@spending_proposal.feasibility}") %>
-<%= simple_format_no_tags_no_sanitize(safe_html_with_links(@spending_proposal.feasible_explanation.html_safe)) if @spending_proposal.feasible_explanation.present? %>
+<%= explanation_field @spending_proposal.feasible_explanation %>
<% if @spending_proposal.valuation_finished %>