Sha256: ad806e9f2bccc71614a07ac5ad013caa5e46b0307a7900840bed8612c0225b82

Contents?: true

Size: 1.46 KB

Versions: 7

Compression:

Stored size: 1.46 KB

Contents

module Hancock
  module Admin
    def self.map_config(is_active = false)
      Proc.new {
        active is_active
        label I18n.t('hancock.map')
        field :address, :string
        field :map_address, :string
        field :map_hint, :string
        field :coordinates, :string do
          read_only true
          formatted_value{ bindings[:object].coordinates.to_json }
        end
        field :lat
        field :lon

        if block_given?
          yield self
        end
      }
    end

    def self.caching_block(is_active = false)
      Proc.new {
        active is_active
        label I18n.t('hancock.cache')
        field :perform_caching, :toggle
        field :cache_keys_str, :text

        if block_given?
          yield self
        end
      }
    end

    def self.url_block(is_active = false)
      Proc.new {
        active is_active
        label I18n.t('hancock.url')
        field :slugs, :hancock_slugs
        field :text_slug
      }
    end

    def self.content_block(is_active = false, options = {})
      if is_active.is_a?(Hash)
        is_active, fields = (is_active[:active] || false), is_active
      end

      _excluded_fields = options.delete(:excluded_fields) || []
      Proc.new {
        active is_active
        label I18n.t('hancock.content')
        field :excerpt, :hancock_html unless _excluded_fields.include?(:excerpt)
        field :content, :hancock_html unless _excluded_fields.include?(:content)
      }
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hancock_cms-2.0.0.2 lib/hancock/admin.rb
hancock_cms-1.0.0.4 lib/hancock/admin.rb
hancock_cms-1.0.0.3 lib/hancock/admin.rb
hancock_cms-2.0.0.1 lib/hancock/admin.rb
hancock_cms-1.0.0.2 lib/hancock/admin.rb
hancock_cms-2.0.0 lib/hancock/admin.rb
hancock_cms-1.0.0 lib/hancock/admin.rb