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))
|
sanitize(Redcarpet::Markdown.new(renderer, extensions).render(text))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def wysiwyg(text)
|
||||||
|
WYSIWYGSanitizer.new.sanitize(text)
|
||||||
|
end
|
||||||
|
|
||||||
def author_of?(authorable, user)
|
def author_of?(authorable, user)
|
||||||
return false if authorable.blank? || user.blank?
|
return false if authorable.blank? || user.blank?
|
||||||
authorable.author_id == user.id
|
authorable.author_id == user.id
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
-
|
-
|
||||||
<%= l(phase.ends_at.to_date - 1.day, format: :long) if phase.ends_at.present? %>
|
<%= l(phase.ends_at.to_date - 1.day, format: :long) if phase.ends_at.present? %>
|
||||||
</span>
|
</span>
|
||||||
<p><%= auto_link_already_sanitized_html(WYSIWYGSanitizer.new.sanitize(phase.summary)) %></p>
|
<p><%= auto_link_already_sanitized_html(wysiwyg(phase.summary)) %></p>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -38,10 +38,10 @@
|
|||||||
<small><%= t("dashboard.recommended_actions.show_description") %></small>
|
<small><%= t("dashboard.recommended_actions.show_description") %></small>
|
||||||
</a>
|
</a>
|
||||||
<div id="proposed_action_description_<%= dom_id(proposed_action) %>" class="hide" data-toggler=".hide">
|
<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>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= WYSIWYGSanitizer.new.sanitize(proposed_action.description) %>
|
<%= wysiwyg(proposed_action.description) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<div class="row expanded">
|
<div class="row expanded">
|
||||||
<div class="small-12 medium-8 column">
|
<div class="small-12 medium-8 column">
|
||||||
<%= WYSIWYGSanitizer.new.sanitize(dashboard_action.description) %>
|
<%= wysiwyg(dashboard_action.description) %>
|
||||||
<%= render "dashboard/form" %>
|
<%= render "dashboard/form" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><%= first_proposed_action.title %></li>
|
<li><%= first_proposed_action.title %></li>
|
||||||
<% if first_proposed_action.description.present? %>
|
<% if first_proposed_action.description.present? %>
|
||||||
<p><%= WYSIWYGSanitizer.new.sanitize(first_proposed_action.description) %></p>
|
<p><%= wysiwyg(first_proposed_action.description) %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><%= first_proposed_action.title %></li>
|
<li><%= first_proposed_action.title %></li>
|
||||||
<% if first_proposed_action.description.present? %>
|
<% if first_proposed_action.description.present? %>
|
||||||
<p><%= WYSIWYGSanitizer.new.sanitize(first_proposed_action.description) %></p>
|
<p><%= wysiwyg(first_proposed_action.description) %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
<%= WYSIWYGSanitizer.new.sanitize(@process.milestones_summary) %>
|
<%= wysiwyg(@process.milestones_summary) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<td style="padding-bottom: 20px; padding-left: 10px;">
|
<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;">
|
<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>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
<% if show_polls_description? %>
|
<% if show_polls_description? %>
|
||||||
<div class="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>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user