diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9785c46cf..cb4fb879c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -36,6 +36,10 @@ module ApplicationHelper sanitize(Redcarpet::Markdown.new(renderer, extensions).render(text)) end + def wysiwyg(text) + WYSIWYGSanitizer.new.sanitize(text) + end + def author_of?(authorable, user) return false if authorable.blank? || user.blank? authorable.author_id == user.id diff --git a/app/views/budgets/_phases.html.erb b/app/views/budgets/_phases.html.erb index f9791a43e..9a05b8ae7 100644 --- a/app/views/budgets/_phases.html.erb +++ b/app/views/budgets/_phases.html.erb @@ -7,7 +7,7 @@ - <%= l(phase.ends_at.to_date - 1.day, format: :long) if phase.ends_at.present? %> -

<%= auto_link_already_sanitized_html(WYSIWYGSanitizer.new.sanitize(phase.summary)) %>

+

<%= auto_link_already_sanitized_html(wysiwyg(phase.summary)) %>

<% end %> diff --git a/app/views/dashboard/_proposed_action.html.erb b/app/views/dashboard/_proposed_action.html.erb index 48e69c21a..83536298a 100644 --- a/app/views/dashboard/_proposed_action.html.erb +++ b/app/views/dashboard/_proposed_action.html.erb @@ -38,10 +38,10 @@ <%= t("dashboard.recommended_actions.show_description") %>
- <%= WYSIWYGSanitizer.new.sanitize(proposed_action.description) %> + <%= wysiwyg(proposed_action.description) %>
<% else %> - <%= WYSIWYGSanitizer.new.sanitize(proposed_action.description) %> + <%= wysiwyg(proposed_action.description) %> <% end %> <% end %> diff --git a/app/views/dashboard/actions/new_request.html.erb b/app/views/dashboard/actions/new_request.html.erb index ba6486ce5..4359f17c8 100644 --- a/app/views/dashboard/actions/new_request.html.erb +++ b/app/views/dashboard/actions/new_request.html.erb @@ -2,7 +2,7 @@
- <%= WYSIWYGSanitizer.new.sanitize(dashboard_action.description) %> + <%= wysiwyg(dashboard_action.description) %> <%= render "dashboard/form" %>
diff --git a/app/views/dashboard/mailer/new_actions_notification_rake_created.html.erb b/app/views/dashboard/mailer/new_actions_notification_rake_created.html.erb index 7f4d74cb1..f43c1600a 100644 --- a/app/views/dashboard/mailer/new_actions_notification_rake_created.html.erb +++ b/app/views/dashboard/mailer/new_actions_notification_rake_created.html.erb @@ -35,7 +35,7 @@
diff --git a/app/views/dashboard/mailer/new_actions_notification_rake_published.html.erb b/app/views/dashboard/mailer/new_actions_notification_rake_published.html.erb index f4b00ba40..f120ab1bc 100644 --- a/app/views/dashboard/mailer/new_actions_notification_rake_published.html.erb +++ b/app/views/dashboard/mailer/new_actions_notification_rake_published.html.erb @@ -36,7 +36,7 @@
diff --git a/app/views/legislation/processes/milestones.html.erb b/app/views/legislation/processes/milestones.html.erb index 8ea3b6c9b..be66be7b2 100644 --- a/app/views/legislation/processes/milestones.html.erb +++ b/app/views/legislation/processes/milestones.html.erb @@ -6,7 +6,7 @@
- <%= WYSIWYGSanitizer.new.sanitize(@process.milestones_summary) %> + <%= wysiwyg(@process.milestones_summary) %>
diff --git a/app/views/mailer/newsletter.html.erb b/app/views/mailer/newsletter.html.erb index e77eaa1f0..3b45f6105 100644 --- a/app/views/mailer/newsletter.html.erb +++ b/app/views/mailer/newsletter.html.erb @@ -1,5 +1,5 @@

- <%= auto_link_already_sanitized_html WYSIWYGSanitizer.new.sanitize(@newsletter.body) %> + <%= auto_link_already_sanitized_html wysiwyg(@newsletter.body) %>

diff --git a/app/views/polls/index.html.erb b/app/views/polls/index.html.erb index c4c722435..251e8493f 100644 --- a/app/views/polls/index.html.erb +++ b/app/views/polls/index.html.erb @@ -14,7 +14,7 @@
<% if show_polls_description? %>
- <%= auto_link_already_sanitized_html WYSIWYGSanitizer.new.sanitize(@active_poll.description) %> + <%= auto_link_already_sanitized_html wysiwyg(@active_poll.description) %>
<% end %>