Templates: added m helper

This commit is contained in:
Saverio Trioni
2016-05-14 19:37:44 +02:00
parent cfe3cd24f5
commit 34fec819d1
2 changed files with 10 additions and 2 deletions

View File

@ -54,6 +54,15 @@ module ApplicationHelper
html.html_safe
end
# Use as <%= markdown content %> or <%= m content %>
# Content can be nil, in that case
# it will be the same as an empty string.
def markdown(content)
RDiscount.new(content || ''.freeze).to_html.html_safe
end
alias m markdown
private
def locale_menu_item(locale)

View File

@ -5,6 +5,5 @@
</h4>
</div>
<div class="modal-body">
<%# TODO: create a helper 'm' like 'j', so this is just <%= m @document.content %>
<%= RDiscount.new(@document.content).to_html.html_safe %>
<%= m @document.content %>
</div>