Sha256: 4e5f519216595520dd1463f3a9381b29b3f6d2849eb85f5273572a4492645a15

Contents?: true

Size: 1.02 KB

Versions: 13

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8
require 'securerandom'

module Uploader
  autoload :Fileuploads, 'uploader/fileuploads'
  autoload :Asset, 'uploader/asset'
  
  module Helpers
    autoload :FormTagHelper, 'uploader/helpers/form_tag_helper'
    autoload :FormBuilder, 'uploader/helpers/form_builder'
    autoload :FieldTag, 'uploader/helpers/field_tag'
  end

  def self.guid
    SecureRandom.base64(16).tr('+/=', 'xyz').slice(0, 20)
  end
  
  def self.root_path
    @root_path ||= Pathname.new( File.dirname(File.expand_path('../', __FILE__)) )
  end
  
  def self.assets
    Dir[root_path.join('vendor/assets/**/uploader/**', '*.{js,css,png,gif}')].inject([]) do |list, path|
      folder = path.split('/assets/')[1].split('/')[0]
      list << Pathname.new(path).relative_path_from(root_path.join("vendor/assets/#{folder}")).to_s
      list
    end
  end

  def self.constantize(klass)
    return if klass.blank?
    klass.safe_constantize
  end
end

require 'uploader/engine'

if Object.const_defined?("RailsAdmin")
  require "uploader/rails_admin/field"
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
glebtv-rails-uploader-0.12.0 lib/uploader.rb
glebtv-rails-uploader-0.11.1 lib/uploader.rb
glebtv-rails-uploader-0.11.0 lib/uploader.rb
glebtv-rails-uploader-0.10.1 lib/uploader.rb
glebtv-rails-uploader-0.10.0 lib/uploader.rb
glebtv-rails-uploader-0.9.0 lib/uploader.rb
glebtv-rails-uploader-0.8.0 lib/uploader.rb
glebtv-rails-uploader-0.7.1 lib/uploader.rb
glebtv-rails-uploader-0.7.0 lib/uploader.rb
glebtv-rails-uploader-0.6.1 lib/uploader.rb
glebtv-rails-uploader-0.6.0 lib/uploader.rb
glebtv-rails-uploader-0.5.1 lib/uploader.rb
glebtv-rails-uploader-0.5.0 lib/uploader.rb