Module: Cms::FormTagHelper

Defined in:
app/helpers/cms/form_tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#cms_form_for(*args, &block) ⇒ Object

Simple wrapper for Rails form_for that will use the CMS CustomFormBuilder. Can be used by portlets or other random public facing views to render content.



16
17
18
19
20
# File 'app/helpers/cms/form_tag_helper.rb', line 16

def cms_form_for(*args, &block)
  options = args.extract_options!
  options.merge!(:builder => Cms::FormBuilder::ContentBlockFormBuilder)
  form_for(*(args + [options]), &block)
end

#content_block_form_for(object, *args, &block) ⇒ Object

Generates a form (i.e. Rails form_for) for creating/updating content blocks. Exposes additional methods to to create inputs. Implements a superset of SimpleForm behavior (i.e. simple_form_for).

This also includes deprecated methods from pre-4.0 form building (like f.cms_text_field) for backwards compatiable support.



9
10
11
12
# File 'app/helpers/cms/form_tag_helper.rb', line 9

def content_block_form_for(object, *args, &block)
  options = args.extract_options!
  simple_form_for(engine_aware_path(object), *(args << options.merge(builder: Cms::FormBuilder::ContentBlockFormBuilder, wrapper: 'browsercms')), &block)
end

#forecasting_a_new_section?(form_object) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/helpers/cms/form_tag_helper.rb', line 22

def forecasting_a_new_section?(form_object)
  Cms::Section.with_path(form_object.object.class.path).first.nil?
end

#slug_source_if(boolean) ⇒ Object



27
28
29
30
31
32
33
# File 'app/helpers/cms/form_tag_helper.rb', line 27

def slug_source_if(boolean)
  if boolean
    {input_html: {class: 'slug-source'}}
  else
    {}
  end
end