Sha256: 88c72bad27a90d6f1123580cee9facd20de76a7ebcc3cc7db3382fcfa9504b95

Contents?: true

Size: 972 Bytes

Versions: 2

Compression:

Stored size: 972 Bytes

Contents

# Configure Rails 3.0 to use public/javascripts/mootools et al
module Mootools
  module Rails

    class Railtie < ::Rails::Railtie
      config.before_configuration do
        require "mootools-rails/assert_select_mootools" if ::Rails.env.test?

        if ::Rails.root.join("public/javascripts/mootools-more.min.js").exist?
          jq_defaults = %w(mootools mootools-more)
          jq_defaults.map!{|a| a + ".min" } if ::Rails.env.production?
        else
          jq_defaults = ::Rails.env.production? ? %w(mootools.min) : %w(mootools)
        end

        # Merge the MooTools scripts, remove the Prototype defaults and finally add 'rails'
        # at the end, because load order is important
        config.action_view.javascript_expansions[:defaults] -= PROTOTYPE_JS + ['rails']
        config.action_view.javascript_expansions[:defaults] |= jq_defaults
        config.action_view.javascript_expansions[:defaults] << 'mootools_ujs'
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mootools-rails-0.4 lib/mootools-rails/railtie.rb
mootools-rails-0.3 lib/mootools-rails/railtie.rb