Sha256: 080b4ab222e0286d2f16d9168e67161d888a3d0dcbdf3c8f849effd2f9b8c61f

Contents?: true

Size: 926 Bytes

Versions: 3

Compression:

Stored size: 926 Bytes

Contents

module Enjoy::Gallery
  module Admin
    module EmbeddedImage
      def self.config(fields = {})
        jcrop_proc = Proc.new do
          jcrop_options :image_jcrop_options
        end

        if fields
          if fields.is_a?(Hash)
            fields.reverse_merge!({image: [:jcrop, jcrop_proc]})
          else
            finded = false
            fields.each { |g|
              finded = !!g[:fields][:image] unless finded
            }
            unless finded
              fields << {
                name: :image,
                fields: {
                  image: [:jcrop, jcrop_proc]
                }
              }
            end
          end
        end

        if block_given?
          Enjoy::Admin::EmbeddedElement.config(nil, fields) do |config|
            yield config
          end
        else
          Enjoy::Admin::EmbeddedElement.config(nil, fields)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
enjoy_cms_gallery-0.4.0 lib/enjoy/gallery/admin/embedded_image.rb
enjoy_cms_gallery-0.4.0.beta3 lib/enjoy/gallery/admin/embedded_image.rb
enjoy_cms_gallery-0.4.0.beta1 lib/enjoy/gallery/admin/embedded_image.rb