Sha256: e6efd1b6043ae09ec9cc7d1bb2bd242e2dd122989ec2eb9b971b4017fbc79ced

Contents?: true

Size: 1.25 KB

Versions: 10

Compression:

Stored size: 1.25 KB

Contents

module Cms
  module FormTagHelper

    # 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.
    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

    # 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.
    def cms_form_for(*args, &block)
      options = args.extract_options!
      options.merge!(:builder => Cms::FormBuilder::ContentBlockFormBuilder)
      form_for(*(args + [options]), &block)
    end

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


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

  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
browsercms-artirix-4.0.4 app/helpers/cms/form_tag_helper.rb
browsercms-artirix-4.0.3.3 app/helpers/cms/form_tag_helper.rb
browsercms-artirix-4.0.3.2 app/helpers/cms/form_tag_helper.rb
browsercms-artirix-4.0.3.1 app/helpers/cms/form_tag_helper.rb
browsercms-artirix-4.0.3 app/helpers/cms/form_tag_helper.rb
browsercms-artirix-4.0.2 app/helpers/cms/form_tag_helper.rb
browsercms-artirix-4.0.1.1 app/helpers/cms/form_tag_helper.rb
browsercms-artirix-4.0.0.rc1.art4 app/helpers/cms/form_tag_helper.rb
browsercms-4.0.0.rc1 app/helpers/cms/form_tag_helper.rb
browsercms-4.0.0.beta app/helpers/cms/form_tag_helper.rb