Sha256: 2773a9b70e1034797b1f715c37029849ca77dda4f3624fa4f76bf968dc25bb58

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

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

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

          field :enabled, :toggle do
            searchable false
          end

          field :name, :string do
            searchable true
          end
          group :URL, &Hancock::Admin.url_block
          # group :URL do
          #   active false
          #   field :slugs, :hancock_slugs
          #   field :text_slug
          # end

          field :image, :hancock_image

          field :gallerable do
            read_only true
          end

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

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

          if defined?(RailsAdminMultipleFileUpload)
            multiple_file_upload(
                {
                    fields: [:gallery_images]
                }
            )
          end

          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/gallery.rb