Sha256: decd789141d91782b4650839cd8bd59f89ce9e587ad55eba3bfd02c4ca000e12

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 KB

Contents

require "ds_node"
require "slim"
require "sass-rails"
require "font-awesome-rails"
require "jquery-rails"
require "jquery-ui-rails"
require "coffee-rails"

module DSMediaLibrary
  class Engine < Rails::Engine
    initializer "ds_media_library.form_helper" do
      ActionView::Helpers::FormBuilder.class_eval do
        prepend FormHelper
      end
    end

    initializer "ds_media_library.ds_node" do
      DSNode::Resource.class_eval do
        belongs_to :folder, class_name: "DSMediaLibrary::Folder", required: false

        def css_class
          "dsml-media-link"
        end

        def type_name
          case media_type
          when "i" then "Image"
          when "v" then "Video"
          when "a" then "Audio"
          when "p" then "PDF"
          else "Unknown"
          end
        end

        def updated_on
          updated_at.try(:to_date)
        end
      end
    end

    initializer "ds_media_library.assets" do
      config.assets.precompile += %w( ds_media_library.css ds_media_library.js )
    end

    isolate_namespace DSMediaLibrary
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ds_media_library-0.6.1 lib/ds_media_library/engine.rb
ds_media_library-0.6.0 lib/ds_media_library/engine.rb
ds_media_library-0.5.6 lib/ds_media_library/engine.rb
ds_media_library-0.5.5 lib/ds_media_library/engine.rb
ds_media_library-0.5.4 lib/ds_media_library/engine.rb
ds_media_library-0.5.3 lib/ds_media_library/engine.rb
ds_media_library-0.5.2 lib/ds_media_library/engine.rb
ds_media_library-0.5.1 lib/ds_media_library/engine.rb
ds_media_library-0.5.0 lib/ds_media_library/engine.rb