From 7231f72e0101d2f2f3c0b99fabdd2d1f73ca6001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Tue, 8 Mar 2016 13:40:35 +0100 Subject: [PATCH] cleans up show view --- app/helpers/text_with_links_helper.rb | 4 +++ .../spending_proposals/show.html.erb | 33 ++++++++++++------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/app/helpers/text_with_links_helper.rb b/app/helpers/text_with_links_helper.rb index fe726c51e..ac965dafa 100644 --- a/app/helpers/text_with_links_helper.rb +++ b/app/helpers/text_with_links_helper.rb @@ -11,4 +11,8 @@ module TextWithLinksHelper Rinku.auto_link(html, :all, 'target="_blank" rel="nofollow"').html_safe end + def simple_format_no_tags_no_sanitize(html) + simple_format(html, {}, sanitize: false) + end + end diff --git a/app/views/valuation/spending_proposals/show.html.erb b/app/views/valuation/spending_proposals/show.html.erb index 9ebaa0c24..e98968fee 100644 --- a/app/views/valuation/spending_proposals/show.html.erb +++ b/app/views/valuation/spending_proposals/show.html.erb @@ -53,30 +53,39 @@

<%= t("valuation.spending_proposals.show.dossier") %>

-

<%= link_to t("valuation.spending_proposals.show.edit_dossier"), edit_valuation_spending_proposal_path(@spending_proposal) %>

- -

<%= t("valuation.spending_proposals.show.price") %> (<%= t("valuation.spending_proposals.show.currency") %>): - <%= @spending_proposal.price.present? ? @spending_proposal.price : t("valuation.spending_proposals.show.undefined") %> +

+ <%= link_to t("valuation.spending_proposals.show.edit_dossier"), edit_valuation_spending_proposal_path(@spending_proposal) %>

-

<%= t("valuation.spending_proposals.show.price_first_year") %> (<%= t("valuation.spending_proposals.show.currency") %>): - <%= @spending_proposal.price_first_year.present? ? @spending_proposal.price_first_year : t("valuation.spending_proposals.show.undefined") %> + +

+ <%= t("valuation.spending_proposals.show.price") %> (<%= t("valuation.spending_proposals.show.currency") %>): + <%= @spending_proposal.price.presence or t("valuation.spending_proposals.show.undefined") %> +

+

+ <%= 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? %> -

<%= t("valuation.spending_proposals.show.time_scope") %>: - <%= @spending_proposal.time_scope.present? ? @spending_proposal.time_scope : t("valuation.spending_proposals.show.undefined") %> +

+ <%= t("valuation.spending_proposals.show.time_scope") %>: + <%= @spending_proposal.time_scope.presence or t("valuation.spending_proposals.show.undefined") %>

-

<%= t("valuation.spending_proposals.show.feasibility") %>: +

+ <%= t("valuation.spending_proposals.show.feasibility") %>: <%= t("valuation.spending_proposals.show.#{@spending_proposal.feasibility}") %>

-<%= simple_format(safe_html_with_links(@spending_proposal.feasible_explanation.html_safe), {}, sanitize: false) if @spending_proposal.feasible_explanation.present? %> + +<%= simple_format_no_tags_no_sanitize(safe_html_with_links(@spending_proposal.feasible_explanation.html_safe)) if @spending_proposal.feasible_explanation.present? %> <% if @spending_proposal.valuation_finished %> -

<%= t("valuation.spending_proposals.show.valuation_finished") %> +

+ <%= t("valuation.spending_proposals.show.valuation_finished") %> +

<% end %> <% if @spending_proposal.internal_comments.present? %>

<%= t("valuation.spending_proposals.show.internal_comments") %>

- <%= simple_format(safe_html_with_links(@spending_proposal.internal_comments.html_safe), {}, sanitize: false) %> + <%= simple_format_no_tags_no_sanitize(safe_html_with_links(@spending_proposal.internal_comments.html_safe)) %> <% end %>