Sha256: 3919b8e2219534b4fad3af725099f6c6373436ac483ad6846bc055ecb89b2585

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

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

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

          field :originable
          field :original
          field :original_as_image do
            pretty_value do
              _value = value.sub(/\>\s*\z/, " style='max-width: 100%; max-height: 100%;'>")
              "<div style='max-width: 300px; height: 100px;'>#{_value}</div>".html_safe
            end
            read_only true
          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/original_image.rb