Module: Occams::Admin::CmsHelper
- Defined in:
- app/helpers/occams/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, … }}.
- #occams_admin_partial(path, params = {}) ⇒ Object
-
#occams_form_with(**options, &block) ⇒ Object
Wrapper around Occams::FormBuilder.
Instance Method Details
#cms_file_link_tag(file) ⇒ String
Returns cms:file_link #{file.id, … }}.
41 42 43 44 45 46 47 |
# File 'app/helpers/occams/admin/cms_helper.rb', line 41 def cms_file_link_tag(file) if file..image? "{{ cms:image #{file.label} }}" else "{{ cms:file_link #{file.id} }}" end end |
#cms_hook(name, options = {}) ⇒ Object
Injects some content somewhere inside cms admin area
25 26 27 |
# File 'app/helpers/occams/admin/cms_helper.rb', line 25 def cms_hook(name, = {}) Occams::ViewHooks.render(name, self, ) end |
#cms_page_file_link_tag(fragment_id:, attachment:, multiple:) ⇒ String
Returns cms:page_file_link #{fragment_id, … }}.
33 34 35 36 37 |
# File 'app/helpers/occams/admin/cms_helper.rb', line 33 def cms_page_file_link_tag(fragment_id:, attachment:, multiple:) filename = ", filename: \"#{.filename}\"" if multiple as = ', as: image' if .image? "{{ cms:page_file_link #{fragment_id}#{filename}#{as} }}" end |
#occams_admin_partial(path, params = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/occams/admin/cms_helper.rb', line 14 def occams_admin_partial(path, params = {}) render path, params rescue ActionView::MissingTemplate if Occams.config.reveal_cms_partials content_tag(:div, class: 'occams-admin-partial') do path end end end |
#occams_form_with(**options, &block) ⇒ Object
Wrapper around Occams::FormBuilder
7 8 9 10 11 12 |
# File 'app/helpers/occams/admin/cms_helper.rb', line 7 def occams_form_with(**, &block) = .merge(builder: Occams::FormBuilder) [:bootstrap] = { layout: :horizontal } [:local] = true bootstrap_form_with(**, &block) end |