From 835af696703484208882a70cc5dd47c5838ecf58 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 12 Oct 2023 17:10:34 -0400 Subject: Added blog post commenting --- app/helpers/application_helper.rb | 10 ++++++++-- app/helpers/comments_helper.rb | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 app/helpers/comments_helper.rb (limited to 'app/helpers') 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 link_to title, {:sort => col, :dir => direction}, {:class => css_class} end - def markdown(text) + def markdown(text, params = {}) options = { fenced_code_blocks: true, highlight: true } - Redcarpet::Markdown.new(HTML.new(), options).render(text).html_safe + + html_options = {} + if params[:restricted] + html_options[:filter_html] = true + end + + Redcarpet::Markdown.new(HTML.new(html_options), options).render(text).html_safe end 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 @@ +module CommentsHelper + def show_comments(blog) + render "comments/layout", blog: blog + end +end -- cgit 1.4.1