Sha256: 1fc2356674f1443d1320dac9ff322b7a03724640ae8ceb0207f7328e1f4578b3

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require "ds_node"
require "slim"
require "sassc-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

2 entries across 2 versions & 1 rubygems

Version Path
ds_media_library-0.7.1 lib/ds_media_library/engine.rb
ds_media_library-0.7.0 lib/ds_media_library/engine.rb