Module: Comfy::Admin::CmsHelper
- Defined in:
- app/helpers/comfy/admin/cms_helper.rb
Instance Method Summary collapse
-
#cms_file_link_tag(file) ⇒ String
cms:file_link #{file.id, … }}.
-
#cms_hook(name, options = {}) ⇒ Object
Injects some content somewhere inside cms admin area.
-
#cms_page_file_link_tag(fragment_id:, attachment:, multiple:) ⇒ String
cms:page_file_link #{fragment_id, … }}.
- #comfy_admin_partial(path, params = {}) ⇒ Object
-
#comfy_form_with(**options, &block) ⇒ Object
Wrapper around ComfortableMexicanSofa::FormBuilder.
Instance Method Details
#cms_file_link_tag(file) ⇒ String
Returns cms:file_link #{file.id, … }}.
42 43 44 45 |
# File 'app/helpers/comfy/admin/cms_helper.rb', line 42 def cms_file_link_tag(file) as = ", as: image" if file..image? "{{ cms:file_link #{file.id}#{as} }}" end |
#cms_hook(name, options = {}) ⇒ Object
Injects some content somewhere inside cms admin area
26 27 28 |
# File 'app/helpers/comfy/admin/cms_helper.rb', line 26 def cms_hook(name, = {}) ComfortableMexicanSofa::ViewHooks.render(name, self, ) end |
#cms_page_file_link_tag(fragment_id:, attachment:, multiple:) ⇒ String
Returns cms:page_file_link #{fragment_id, … }}.
34 35 36 37 38 |
# File 'app/helpers/comfy/admin/cms_helper.rb', line 34 def cms_page_file_link_tag(fragment_id:, attachment:, multiple:) filename = ", filename: \"#{attachment.filename}\"" if multiple as = ", as: image" if .image? "{{ cms:page_file_link #{fragment_id}#{filename}#{as} }}" end |
#comfy_admin_partial(path, params = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/comfy/admin/cms_helper.rb', line 15 def comfy_admin_partial(path, params = {}) render path, params rescue ActionView::MissingTemplate if ComfortableMexicanSofa.config.reveal_cms_partials content_tag(:div, class: "comfy-admin-partial") do path end end end |
#comfy_form_with(**options, &block) ⇒ Object
Wrapper around ComfortableMexicanSofa::FormBuilder
8 9 10 11 12 13 |
# File 'app/helpers/comfy/admin/cms_helper.rb', line 8 def comfy_form_with(**, &block) = .merge(builder: ComfortableMexicanSofa::FormBuilder) [:bootstrap] = { layout: :horizontal } [:local] = true bootstrap_form_with(**, &block) end |