Sha256: 784810ce5e5cf926733b8088c842c5f2b34dca056a4d95a3f3b8dbce29424e44

Contents?: true

Size: 1013 Bytes

Versions: 2

Compression:

Stored size: 1013 Bytes

Contents

module CMS
  module ViewHelper
    def cms_body_class(*args)
      controller_name = controller_path.gsub('/','-')
      classes = [
        params[:cms_body_class],
        controller_name,
        "#{controller_name}-#{action_name}",
        I18n.locale,
      ]
      classes << 'cms-edit-mode' if cms_edit_mode?
      classes.concat(args) if args.any?
      classes.compact.join(' ')
    end

    def cms_flash_messages(*args)
      content_tag :div, class: 'cms-flash-messages', 'data-cms-flash' => true do
        flash_messages(*args)
      end
    end

    def cms_title(default = nil)
      @cms_page_title || default
    end

    def cms_meta_data_tags(default = nil)
      if @cms_page_meta_keywords || @cms_page_meta_description
        html = tag(:meta, name: 'meta_keywords', content: @cms_page_meta_keywords)
        html << "\n"
        html << tag(:meta, name: 'meta_description', content: @cms_page_meta_description)
        html.html_safe
      else
        default
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_admin_cms-0.0.2 app/helpers/cms/view_helper.rb
rails_admin_cms-0.0.1 app/helpers/cms/view_helper.rb