Add editable content helpers
This commit is contained in:
10
app/helpers/editable_content_helper.rb
Normal file
10
app/helpers/editable_content_helper.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
module EditableContentHelper
|
||||
def editable_content_for(path, key, default: nil, create_rich: false)
|
||||
@content = EditableContent.find_by(path: "contributions/other", key: key)
|
||||
@content.content.present? ? @content.content : default
|
||||
end
|
||||
|
||||
def markdown_to_html(string)
|
||||
raw Kramdown::Document.new(string, { input: "GFM" }).to_html
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user