Add editable content helpers
This commit is contained in:
parent
2f86b3c16f
commit
315cf4dd9f
1
Gemfile
1
Gemfile
@ -42,6 +42,7 @@ gem 'flipper-active_record'
|
|||||||
gem 'flipper-ui'
|
gem 'flipper-ui'
|
||||||
gem 'gpgme', '~> 2.0.24'
|
gem 'gpgme', '~> 2.0.24'
|
||||||
gem 'zbase32', '~> 0.1.1'
|
gem 'zbase32', '~> 0.1.1'
|
||||||
|
gem 'kramdown'
|
||||||
|
|
||||||
# HTTP requests
|
# HTTP requests
|
||||||
gem 'faraday'
|
gem 'faraday'
|
||||||
|
@ -549,6 +549,7 @@ DEPENDENCIES
|
|||||||
image_processing (~> 1.12.2)
|
image_processing (~> 1.12.2)
|
||||||
importmap-rails
|
importmap-rails
|
||||||
jbuilder (~> 2.7)
|
jbuilder (~> 2.7)
|
||||||
|
kramdown
|
||||||
letter_opener
|
letter_opener
|
||||||
letter_opener_web
|
letter_opener_web
|
||||||
listen (~> 3.2)
|
listen (~> 3.2)
|
||||||
|
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
|
Loading…
x
Reference in New Issue
Block a user