diff options
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/application_helper.rb | 10 | ||||
| -rw-r--r-- | app/helpers/comments_helper.rb | 5 |
2 files changed, 13 insertions, 2 deletions
| diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 861dd11..14d56cf 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb | |||
| @@ -19,9 +19,15 @@ module ApplicationHelper | |||
| 19 | link_to title, {:sort => col, :dir => direction}, {:class => css_class} | 19 | link_to title, {:sort => col, :dir => direction}, {:class => css_class} |
| 20 | end | 20 | end |
| 21 | 21 | ||
| 22 | def markdown(text) | 22 | def markdown(text, params = {}) |
| 23 | options = { fenced_code_blocks: true, highlight: true } | 23 | options = { fenced_code_blocks: true, highlight: true } |
| 24 | Redcarpet::Markdown.new(HTML.new(), options).render(text).html_safe | 24 | |
| 25 | html_options = {} | ||
| 26 | if params[:restricted] | ||
| 27 | html_options[:filter_html] = true | ||
| 28 | end | ||
| 29 | |||
| 30 | Redcarpet::Markdown.new(HTML.new(html_options), options).render(text).html_safe | ||
| 25 | end | 31 | end |
| 26 | 32 | ||
| 27 | end | 33 | end |
| diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb new file mode 100644 index 0000000..5939adc --- /dev/null +++ b/app/helpers/comments_helper.rb | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | module CommentsHelper | ||
| 2 | def show_comments(blog) | ||
| 3 | render "comments/layout", blog: blog | ||
| 4 | end | ||
| 5 | end | ||
