module Hancock::Pages::Admin

Public Class Methods

menu_block(is_active = false, options = {}) { |self| ... } click to toggle source
wrapper_block(is_active = false, options = {}) { |self| ... } click to toggle source
# File lib/hancock/pages/admin.rb, line 39
def self.wrapper_block(is_active = false, options = {})
  if is_active.is_a?(Hash)
    is_active, options = (is_active[:active] || false), is_active
  end

  Proc.new {
    active is_active
    options[:label] and label(options[:label])
    field :use_wrapper, :toggle
    field :wrapper_tag, :string do
      searchable true
    end
    field :wrapper_class, :string do
      searchable true
    end
    field :wrapper_id, :string do
      searchable true
    end
    field :wrapper_attributes, :text do
      searchable true
      formatted_value do
        bindings[:object] and bindings[:object].wrapper_attributes ? bindings[:object].wrapper_attributes.to_json : "{}"
      end
    end

    Hancock::RailsAdminGroupPatch::hancock_cms_group(self, options[:fields] || {})

    if block_given?
      yield self
    end
  }
end