Module: Hancock::Catalog::Admin::ItemImage

Defined in:
lib/hancock/catalog/admin/item_image.rb

Class Method Summary collapse

Class Method Details

.config(nav_label = nil, fields = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/hancock/catalog/admin/item_image.rb', line 4

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
  nav_label ||= I18n.t('hancock.catalog')

  if Hancock::Catalog.config.gallery_support
    if Hancock::Catalog.mongoid?
      if block_given?
        Hancock::Gallery::Admin::EmbeddedImage.config(nav_label, fields) do |config|
          yield config
        end
      else
        Hancock::Gallery::Admin::EmbeddedImage.config(nav_label, fields)
      end

    else
      if block_given?
        Hancock::Gallery::Admin::Image.config(nav_label, fields) do |config|
          yield config
        end
      else
        Hancock::Gallery::Admin::Image.config(nav_label, fields)
      end
    end #if Hancock::Catalog.mongoid?
  end #if Hancock::Catalog.config.gallery_support

end