Extract method to use WYSIWYGSanitizer in views
This is similar to methods we use like `sanitize` or `markdown`.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
-
|
||||
<%= l(phase.ends_at.to_date - 1.day, format: :long) if phase.ends_at.present? %>
|
||||
</span>
|
||||
<p><%= auto_link_already_sanitized_html(WYSIWYGSanitizer.new.sanitize(phase.summary)) %></p>
|
||||
<p><%= auto_link_already_sanitized_html(wysiwyg(phase.summary)) %></p>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
<small><%= t("dashboard.recommended_actions.show_description") %></small>
|
||||
</a>
|
||||
<div id="proposed_action_description_<%= dom_id(proposed_action) %>" class="hide" data-toggler=".hide">
|
||||
<%= WYSIWYGSanitizer.new.sanitize(proposed_action.description) %>
|
||||
<%= wysiwyg(proposed_action.description) %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= WYSIWYGSanitizer.new.sanitize(proposed_action.description) %>
|
||||
<%= wysiwyg(proposed_action.description) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<div class="row expanded">
|
||||
<div class="small-12 medium-8 column">
|
||||
<%= WYSIWYGSanitizer.new.sanitize(dashboard_action.description) %>
|
||||
<%= wysiwyg(dashboard_action.description) %>
|
||||
<%= render "dashboard/form" %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<ul>
|
||||
<li><%= first_proposed_action.title %></li>
|
||||
<% if first_proposed_action.description.present? %>
|
||||
<p><%= WYSIWYGSanitizer.new.sanitize(first_proposed_action.description) %></p>
|
||||
<p><%= wysiwyg(first_proposed_action.description) %></p>
|
||||
<% end %>
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<ul>
|
||||
<li><%= first_proposed_action.title %></li>
|
||||
<% if first_proposed_action.description.present? %>
|
||||
<p><%= WYSIWYGSanitizer.new.sanitize(first_proposed_action.description) %></p>
|
||||
<p><%= wysiwyg(first_proposed_action.description) %></p>
|
||||
<% end %>
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= WYSIWYGSanitizer.new.sanitize(@process.milestones_summary) %>
|
||||
<%= wysiwyg(@process.milestones_summary) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<td style="padding-bottom: 20px; padding-left: 10px;">
|
||||
<p style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 14px;line-height: 24px;">
|
||||
<%= auto_link_already_sanitized_html WYSIWYGSanitizer.new.sanitize(@newsletter.body) %>
|
||||
<%= auto_link_already_sanitized_html wysiwyg(@newsletter.body) %>
|
||||
</p>
|
||||
</td>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<div class="small-12 column">
|
||||
<% if show_polls_description? %>
|
||||
<div class="polls-description">
|
||||
<%= auto_link_already_sanitized_html WYSIWYGSanitizer.new.sanitize(@active_poll.description) %>
|
||||
<%= auto_link_already_sanitized_html wysiwyg(@active_poll.description) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user