diff --git a/Gemfile b/Gemfile index 588f4b4c..5034947e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,17 +1,17 @@ source 'https://rubygems.org' -source 'https://rails-assets.org' # Specify your gem's dependencies in best_in_place.gemspec gemspec -gem 'activerecord' +gem "rails", github: "rails/rails" gem 'rails-assets-jquery', '1.11.1' gem 'rails-assets-jquery-ui', '1.10.4' gem 'rdiscount' gem 'rspec-rails' gem 'nokogiri' gem 'combustion' -gem 'sprockets-rails' +gem "sprockets", "~> 3" +gem 'sprockets-rails', "~> 3" gem 'capybara' gem 'poltergeist' gem 'sqlite3' diff --git a/lib/best_in_place.rb b/lib/best_in_place.rb index 76f94c34..8946dad9 100644 --- a/lib/best_in_place.rb +++ b/lib/best_in_place.rb @@ -3,6 +3,10 @@ require 'action_controller/railtie' module BestInPlace + def self.deprecator + @deprecator ||= ActiveSupport::Deprecation.new("1.0", "BestInPlace") + end + def self.configure @configuration ||= Configuration.new yield @configuration if block_given? @@ -30,4 +34,4 @@ def initialize require 'best_in_place/helper' require 'best_in_place/railtie' require 'best_in_place/controller_extensions' -require 'best_in_place/display_methods' \ No newline at end of file +require 'best_in_place/display_methods' diff --git a/lib/best_in_place/display_methods.rb b/lib/best_in_place/display_methods.rb index ad930fb5..4f55100e 100644 --- a/lib/best_in_place/display_methods.rb +++ b/lib/best_in_place/display_methods.rb @@ -30,15 +30,15 @@ def lookup(klass, attr) end def add_model_method(klass, attr, display_as) - model_attributes(klass)[attr.to_s] = Renderer.new method: display_as.to_sym, type: :model + model_attributes(klass)[attr.to_s] = Renderer.new({ method: display_as.to_sym, type: :model }) end def add_helper_method(klass, attr, helper_method, helper_options = nil) - model_attributes(klass)[attr.to_s] = Renderer.new method: helper_method.to_sym, type: :helper, attr: attr, helper_options: helper_options + model_attributes(klass)[attr.to_s] = Renderer.new({ method: helper_method.to_sym, type: :helper, attr: attr, helper_options: helper_options }) end def add_helper_proc(klass, attr, helper_proc) - model_attributes(klass)[attr.to_s] = Renderer.new type: :proc, attr: attr, proc: helper_proc + model_attributes(klass)[attr.to_s] = Renderer.new({ type: :proc, attr: attr, proc: helper_proc }) end def model_attributes(klass) diff --git a/lib/best_in_place/engine.rb b/lib/best_in_place/engine.rb index 1f1c5b5c..8a433538 100644 --- a/lib/best_in_place/engine.rb +++ b/lib/best_in_place/engine.rb @@ -1,8 +1,10 @@ module BestInPlace class Engine < Rails::Engine initializer 'best_in_place' do - ActionView::Base.send(:include, BestInPlace::Helper) - ActionController::Base.send(:include, BestInPlace::ControllerExtensions) + ActiveSupport.on_load(:action_controller) do + ActionView::Base.send(:include, BestInPlace::Helper) + ActionController::Base.send(:include, BestInPlace::ControllerExtensions) + end end end end diff --git a/lib/best_in_place/helper.rb b/lib/best_in_place/helper.rb index e9be0795..f0e5baee 100644 --- a/lib/best_in_place/helper.rb +++ b/lib/best_in_place/helper.rb @@ -152,7 +152,7 @@ def best_in_place_deprecated_options(opts) deprecations.each do |deprecation| if deprecated_option = opts.delete(deprecation[:from]) opts[deprecation[:from]] = deprecated_option - ActiveSupport::Deprecation.warn("[Best_in_place] :#{deprecation[:from]} is deprecated in favor of :#{deprecation[:to]} ") + BestInPlace.deprecator.warn("[Best_in_place] :#{deprecation[:from]} is deprecated in favor of :#{deprecation[:to]} ") end end end diff --git a/lib/best_in_place/railtie.rb b/lib/best_in_place/railtie.rb index f67e191b..23035623 100644 --- a/lib/best_in_place/railtie.rb +++ b/lib/best_in_place/railtie.rb @@ -4,7 +4,11 @@ module BestInPlace class Railtie < ::Rails::Railtie #:nodoc: config.after_initialize do - BestInPlace::ViewHelpers = ActionView::Base.new + BestInPlace::ViewHelpers = ActionView::Base.respond_to?(:empty) ? ActionView::Base.empty : ActionView::Base.new + end + + initializer "best_in_place.deprecator" do |app| + app.deprecators[:best_in_place] = BestInPlace.deprecator if app.respond_to?(:deprecators) end end end diff --git a/spec/helper_spec.rb b/spec/helper_spec.rb index 6bdf76cc..3e9347de 100644 --- a/spec/helper_spec.rb +++ b/spec/helper_spec.rb @@ -32,7 +32,7 @@ end it "should show deprecation warning" do - expect(ActiveSupport::Deprecation).to receive(:warn).with("[Best_in_place] :path is deprecated in favor of :url ") + expect(BestInPlace.deprecator).to receive(:warn).with("[Best_in_place] :path is deprecated in favor of :url ") helper.best_in_place @user, :name, path: "http://example.com" end diff --git a/vendor/assets/javascripts/jquery.autosize.js b/vendor/assets/javascripts/jquery.autosize.js index 61c862af..4e966990 100755 --- a/vendor/assets/javascripts/jquery.autosize.js +++ b/vendor/assets/javascripts/jquery.autosize.js @@ -1,12 +1,11 @@ /*! - Autosize v1.18.9 - 2014-05-27 - Automatically adjust textarea height based on user input. - (c) 2014 Jack Moore - http://www.jacklmoore.com/autosize - license: http://www.opensource.org/licenses/mit-license.php + Autosize 1.18.18 + license: MIT + http://www.jacklmoore.com/autosize */ (function ($) { - 'use strict'; - var defaults = { + var + defaults = { className: 'autosizejs', id: 'autosizejs', append: '\n', @@ -15,9 +14,6 @@ placeholder: true }, - // border:0 is unnecessary, but avoids a bug in Firefox on OSX - copy = '