Sha256: cb6a189f70dca3db4ed536fff897e3e7aec8fa3d4d611b156ae730f98a050a7e

Contents?: true

Size: 892 Bytes

Versions: 4

Compression:

Stored size: 892 Bytes

Contents

require 'dropzone/railtie'
require 'dropzone/action_view/helpers'

module Dropzone
  
  class Engine < ::Rails::Engine
    isolate_namespace Dropzone
  end

  class << self
    attr_accessor :configuration
  end
  
  def self.get_profile(profile)
    profile = Dropzone.configuration.profiles[profile.to_s]
    defaults = Dropzone.configuration.profiles["default"]
    profile.reverse_merge!(defaults)
  end
  
  def self.install!
    config = YAML.load_file("#{Rails.root.to_s}/config/dropzone.yml")[Rails.env]
    Dropzone.configure { |c| 
      c.profiles = config["profiles"] || []
    }
    
    ActiveSupport.on_load :action_controller do
      helper Dropzone::ActionView::Helpers
    end

  end

  def self.configuration
    @configuration ||= Configuration.new
  end

  def self.configure
    yield(configuration)
  end

  class Configuration
     attr_accessor :profiles
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dropzone-1.0.6 lib/dropzone.rb
dropzone-1.0.5 lib/dropzone.rb
dropzone-1.0.3 lib/dropzone.rb
dropzone-1.0.2 lib/dropzone.rb