Sha256: a1cd27370d8a736563520989bf30291cf2a6fe608f1ea0a7d7bbe3b6d58c3f05

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

module Hancock::Gallery
  module Admin
    module Image
      def self.config(nav_label = nil, without_gallery = false, fields = {})
        if nav_label.is_a?(Hash)
          nav_label, without_gallery, fields = nav_label[:nav_label], (nav_label[:without_gallery].nil? ? true : nav_label[:without_gallery]), nav_label
        elsif nav_label.is_a?(Array)
          nav_label, without_gallery, fields = nil, true, nav_label
        end
        if nav_label.is_a?(Boolean)
          if without_gallery.is_a?(Hash)
            nav_label, without_gallery, fields = without_gallery[:nav_label], nav_label, without_gallery
          end
          nav_label, without_gallery, fields = fields[:nav_label], nav_label, fields
        end

        Proc.new {
          navigation_label(!nav_label.blank? ? nav_label : I18n.t('hancock.gallery'))

          field :enabled, :toggle do
            searchable false
          end
          unless without_gallery
            field :gallery do
              searchable :name
            end
          end
          field :name, :string do
            searchable true
          end
          field :image, :hancock_image

          if Hancock::Gallery.config.cache_support
            group :caching, &Hancock::Cache::Admin.caching_block
          end

          nested_set({max_depth: 1, scopes: []})

          Hancock::RailsAdminGroupPatch::hancock_cms_group(self, fields)

          if block_given?
            yield self
          end
        }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hancock_cms_gallery-1.0.2 lib/hancock/gallery/admin/image.rb