Sha256: e29e2dac2ea0e1d164e0ebef17339d6c4651fc2011fde346ba2f031d3adec405

Contents?: true

Size: 855 Bytes

Versions: 1

Compression:

Stored size: 855 Bytes

Contents

require 'activeadmin'
require "rubygems"

module ActiveAdmin
  module SortableTree
    class Engine < ::Rails::Engine
      engine_name 'active_admin-sortable_tree'


      def jquery_ui_six?
        Gem::Version.new(Jquery::Ui::Rails::VERSION) >= Gem::Version.new("6.0.0")
      end

      def sortable_js
        if jquery_ui_six?
          "active_admin/sortable.js"
        else
          "active_admin/sortable_ui5.js"
        end
      end

      initializer "Rails precompile hook", group: :all do |app|
        app.config.assets.precompile += [ "active_admin/sortable.css",
                                          sortable_js ]
      end

      initializer "add assets" do
        ActiveAdmin.application.register_stylesheet "active_admin/sortable.css"
        ActiveAdmin.application.register_javascript sortable_js
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_admin-sortable_tree-1.0.0 lib/active_admin/sortable_tree/engine.rb