best_in_place 2.1.0 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -5
  3. data/.rspec +1 -0
  4. data/.travis.yml +12 -5
  5. data/Appraisals +17 -0
  6. data/CHANGELOG.md +51 -30
  7. data/Gemfile +15 -2
  8. data/README.md +52 -105
  9. data/best_in_place.gemspec +13 -11
  10. data/config.ru +7 -0
  11. data/gemfiles/rails_3.2.gemfile +24 -0
  12. data/gemfiles/rails_4.0.gemfile +23 -0
  13. data/gemfiles/rails_4.1.gemfile +23 -0
  14. data/gemfiles/rails_edge.gemfile +25 -0
  15. data/lib/assets/javascripts/best_in_place.jquery-ui.js +57 -0
  16. data/lib/assets/javascripts/best_in_place.js +551 -650
  17. data/lib/assets/javascripts/best_in_place.purr.js +16 -6
  18. data/lib/best_in_place.rb +29 -9
  19. data/lib/best_in_place/controller_extensions.rb +10 -13
  20. data/lib/best_in_place/display_methods.rb +26 -21
  21. data/lib/best_in_place/engine.rb +2 -2
  22. data/lib/best_in_place/helper.rb +145 -87
  23. data/lib/best_in_place/railtie.rb +5 -2
  24. data/lib/best_in_place/test_helpers.rb +0 -1
  25. data/lib/best_in_place/utils.rb +20 -12
  26. data/lib/best_in_place/version.rb +1 -1
  27. data/spec/{helpers/best_in_place_spec.rb → helper_spec.rb} +134 -99
  28. data/spec/integration/double_init_spec.rb +3 -5
  29. data/spec/integration/js_spec.rb +193 -123
  30. data/spec/integration/live_spec.rb +3 -4
  31. data/spec/integration/text_area_spec.rb +4 -4
  32. data/spec/internal/app/assets/images/info.png +0 -0
  33. data/{test_app → spec/internal}/app/assets/images/no.png +0 -0
  34. data/spec/internal/app/assets/images/purrBottom.png +0 -0
  35. data/spec/internal/app/assets/images/purrClose.png +0 -0
  36. data/spec/internal/app/assets/images/purrTop.png +0 -0
  37. data/{test_app → spec/internal}/app/assets/images/red_pen.png +0 -0
  38. data/{test_app → spec/internal}/app/assets/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  39. data/{test_app → spec/internal}/app/assets/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  40. data/{test_app → spec/internal}/app/assets/images/ui-bg_flat_10_000000_40x100.png +0 -0
  41. data/{test_app → spec/internal}/app/assets/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  42. data/{test_app → spec/internal}/app/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  43. data/{test_app → spec/internal}/app/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  44. data/{test_app → spec/internal}/app/assets/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  45. data/{test_app → spec/internal}/app/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  46. data/{test_app → spec/internal}/app/assets/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  47. data/{test_app → spec/internal}/app/assets/images/ui-icons_222222_256x240.png +0 -0
  48. data/{test_app → spec/internal}/app/assets/images/ui-icons_228ef1_256x240.png +0 -0
  49. data/{test_app → spec/internal}/app/assets/images/ui-icons_ef8c08_256x240.png +0 -0
  50. data/{test_app → spec/internal}/app/assets/images/ui-icons_ffd27a_256x240.png +0 -0
  51. data/{test_app → spec/internal}/app/assets/images/ui-icons_ffffff_256x240.png +0 -0
  52. data/{test_app → spec/internal}/app/assets/images/yes.png +0 -0
  53. data/spec/internal/app/assets/javascripts/application.js +37 -0
  54. data/{test_app → spec/internal}/app/assets/stylesheets/.gitkeep +0 -0
  55. data/{test_app → spec/internal}/app/assets/stylesheets/jquery-ui-1.8.16.custom.css.erb +1 -2
  56. data/{test_app → spec/internal}/app/assets/stylesheets/scaffold.css +1 -1
  57. data/{test_app → spec/internal}/app/assets/stylesheets/style.css.erb +2 -4
  58. data/{test_app → spec/internal}/app/controllers/admin/users_controller.rb +8 -3
  59. data/{test_app → spec/internal}/app/controllers/application_controller.rb +0 -0
  60. data/{test_app → spec/internal}/app/controllers/cuca/cars_controller.rb +0 -0
  61. data/{test_app → spec/internal}/app/controllers/users_controller.rb +8 -40
  62. data/{test_app → spec/internal}/app/helpers/application_helper.rb +0 -0
  63. data/spec/internal/app/helpers/users_helper.rb +29 -0
  64. data/{test_app → spec/internal}/app/models/cuca/car.rb +0 -0
  65. data/{test_app → spec/internal}/app/models/user.rb +5 -1
  66. data/{test_app → spec/internal}/app/views/admin/users/show.html.erb +2 -2
  67. data/{test_app → spec/internal}/app/views/cuca/cars/show.html.erb +0 -0
  68. data/{test_app → spec/internal}/app/views/layouts/application.html.erb +1 -1
  69. data/{test_app → spec/internal}/app/views/users/_form.html.erb +2 -2
  70. data/{test_app → spec/internal}/app/views/users/double_init.html.erb +4 -10
  71. data/spec/internal/app/views/users/edit.html.erb +5 -0
  72. data/{test_app → spec/internal}/app/views/users/email_field.html.erb +0 -0
  73. data/{test_app → spec/internal}/app/views/users/index.html.erb +0 -0
  74. data/{test_app → spec/internal}/app/views/users/new.html.erb +0 -0
  75. data/{test_app → spec/internal}/app/views/users/show.html.erb +32 -24
  76. data/{test_app → spec/internal}/app/views/users/show_ajax.html.erb +0 -0
  77. data/spec/internal/config/database.yml +5 -0
  78. data/{test_app → spec/internal}/config/initializers/countries.rb +0 -0
  79. data/{test_app → spec/internal}/config/initializers/default_date_format.rb +0 -0
  80. data/spec/internal/config/initializers/development.rb +8 -0
  81. data/{test_app → spec/internal}/config/routes.rb +1 -2
  82. data/spec/internal/db/schema.rb +26 -0
  83. data/{test_app → spec/internal}/public/favicon.ico +0 -0
  84. data/spec/rails_helper.rb +21 -0
  85. data/spec/support/retry_on_timeout.rb +4 -7
  86. data/spec/utils_spec.rb +21 -0
  87. data/vendor/assets/javascripts/jquery.autosize.js +272 -0
  88. data/{lib → vendor}/assets/javascripts/jquery.purr.js +1 -1
  89. metadata +92 -175
  90. data/lib/best_in_place/check_version.rb +0 -8
  91. data/spec/spec_helper.rb +0 -23
  92. data/test_app/Gemfile +0 -16
  93. data/test_app/README +0 -256
  94. data/test_app/Rakefile +0 -7
  95. data/test_app/app/assets/javascripts/application.js +0 -35
  96. data/test_app/app/helpers/users_helper.rb +0 -29
  97. data/test_app/config.ru +0 -4
  98. data/test_app/config/application.rb +0 -51
  99. data/test_app/config/boot.rb +0 -13
  100. data/test_app/config/database.yml +0 -22
  101. data/test_app/config/environment.rb +0 -5
  102. data/test_app/config/environments/development.rb +0 -25
  103. data/test_app/config/environments/production.rb +0 -49
  104. data/test_app/config/environments/test.rb +0 -35
  105. data/test_app/config/initializers/backtrace_silencers.rb +0 -7
  106. data/test_app/config/initializers/inflections.rb +0 -10
  107. data/test_app/config/initializers/mime_types.rb +0 -5
  108. data/test_app/config/initializers/secret_token.rb +0 -7
  109. data/test_app/config/initializers/session_store.rb +0 -8
  110. data/test_app/config/locales/en.yml +0 -5
  111. data/test_app/db/migrate/20101206205922_create_users.rb +0 -18
  112. data/test_app/db/migrate/20101212170114_add_receive_email_to_user.rb +0 -9
  113. data/test_app/db/migrate/20110115204441_add_description_to_user.rb +0 -9
  114. data/test_app/db/migrate/20111210084202_add_favorite_color_to_users.rb +0 -5
  115. data/test_app/db/migrate/20111210084251_add_favorite_books_to_users.rb +0 -5
  116. data/test_app/db/migrate/20111217215935_add_birth_date_to_users.rb +0 -5
  117. data/test_app/db/migrate/20111224181356_add_money_to_user.rb +0 -5
  118. data/test_app/db/migrate/20120513003308_create_cars.rb +0 -11
  119. data/test_app/db/migrate/20120607172609_add_favorite_movie_to_users.rb +0 -5
  120. data/test_app/db/migrate/20120616170454_add_money_proc_to_users.rb +0 -6
  121. data/test_app/db/migrate/20120620165212_add_height_to_user.rb +0 -5
  122. data/test_app/db/migrate/20130213224102_add_favorite_locale_to_users.rb +0 -5
  123. data/test_app/db/schema.rb +0 -41
  124. data/test_app/db/seeds.rb +0 -19
  125. data/test_app/doc/README_FOR_APP +0 -2
  126. data/test_app/lib/tasks/.gitkeep +0 -0
  127. data/test_app/lib/tasks/cron.rake +0 -7
  128. data/test_app/public/404.html +0 -26
  129. data/test_app/public/422.html +0 -26
  130. data/test_app/public/500.html +0 -26
  131. data/test_app/public/robots.txt +0 -5
  132. data/test_app/script/rails +0 -6
  133. data/test_app/test/fixtures/users.yml +0 -17
  134. data/test_app/test/functional/users_controller_test.rb +0 -49
  135. data/test_app/test/performance/browsing_test.rb +0 -9
  136. data/test_app/test/test_helper.rb +0 -13
  137. data/test_app/test/unit/helpers/users_helper_test.rb +0 -4
  138. data/test_app/test/unit/user_test.rb +0 -8
  139. data/test_app/vendor/plugins/.gitkeep +0 -0
@@ -1,5 +0,0 @@
1
- class AddHeightToUser < ActiveRecord::Migration
2
- def change
3
- add_column :users, :height, :string
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddFavoriteLocaleToUsers < ActiveRecord::Migration
2
- def change
3
- add_column :users, :favorite_locale, :string
4
- end
5
- end
@@ -1,41 +0,0 @@
1
- # encoding: UTF-8
2
- # This file is auto-generated from the current state of the database. Instead
3
- # of editing this file, please use the migrations feature of Active Record to
4
- # incrementally modify your database, and then regenerate this schema definition.
5
- #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
11
- #
12
- # It's strongly recommended to check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(:version => 20130213224102) do
15
-
16
- create_table "cars", :force => true do |t|
17
- t.string "model"
18
- end
19
-
20
- create_table "users", :force => true do |t|
21
- t.string "name"
22
- t.string "last_name"
23
- t.string "address"
24
- t.string "email", :null => false
25
- t.string "zip"
26
- t.string "country"
27
- t.datetime "created_at", :null => false
28
- t.datetime "updated_at", :null => false
29
- t.boolean "receive_email"
30
- t.text "description"
31
- t.string "favorite_color"
32
- t.text "favorite_books"
33
- t.datetime "birth_date"
34
- t.float "money"
35
- t.string "favorite_movie"
36
- t.float "money_proc"
37
- t.string "height"
38
- t.string "favorite_locale"
39
- end
40
-
41
- end
data/test_app/db/seeds.rb DELETED
@@ -1,19 +0,0 @@
1
- # encoding: utf-8
2
- # This file should contain all the record creation needed to seed the database with its default values.
3
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
4
- #
5
- # Examples:
6
- #
7
- # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
8
- # Mayor.create(:name => 'Daley', :city => cities.first)
9
-
10
- User.delete_all
11
-
12
- User.create!(:name => "Lucia", :last_name => "Napoli", :email => "lucianapoli@gmail.com", :address => "Via Roma 99", :zip => "25123", :country => "1", :receive_email => false, :birth_date => Date.today - 21.years, :description => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus a lectus et lacus ultrices auctor. Morbi aliquet convallis tincidunt. Praesent enim libero, iaculis at commodo nec, fermentum a dolor. Quisque eget eros id felis lacinia faucibus feugiat et ante. Aenean justo nisi, aliquam vel egestas vel, porta in ligula. Etiam molestie, lacus eget tincidunt accumsan, elit justo rhoncus urna, nec pretium neque mi et lorem. Aliquam posuere, dolor quis pulvinar luctus, felis dolor tincidunt leo, eget pretium orci purus ac nibh. Ut enim sem, suscipit ac elementum vitae, sodales vel sem.")
13
- User.create!(:name => "Carmen", :last_name => "Luciago", :email => "carmen@luciago.com", :address => "c/Ambrosio 10", :zip => "21333", :country => "2", :receive_email => true, :birth_date => Date.today - 18.years, :description => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus a lectus et lacus ultrices auctor. Morbi aliquet convallis tincidunt. Praesent enim libero, iaculis at commodo nec, fermentum a dolor. Quisque eget eros id felis lacinia faucibus feugiat et ante. Aenean justo nisi, aliquam vel egestas vel, porta in ligula. Etiam molestie, lacus eget tincidunt accumsan, elit justo rhoncus urna, nec pretium neque mi et lorem. Aliquam posuere, dolor quis pulvinar luctus, felis dolor tincidunt leo, eget pretium orci purus ac nibh. Ut enim sem, suscipit ac elementum vitae, sodales vel sem.")
14
- User.create!(:name => "Angels", :last_name => "Domènech", :email => "angels@gmail.com", :address => "Avinguda Sant Andreu 1", :zip => "08033", :country => "3", :receive_email => false, :birth_date => Date.today - 65.years, :description => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus a lectus et lacus ultrices auctor. Morbi aliquet convallis tincidunt. Praesent enim libero, iaculis at commodo nec, fermentum a dolor. Quisque eget eros id felis lacinia faucibus feugiat et ante. Aenean justo nisi, aliquam vel egestas vel, porta in ligula. Etiam molestie, lacus eget tincidunt accumsan, elit justo rhoncus urna, nec pretium neque mi et lorem. Aliquam posuere, dolor quis pulvinar luctus, felis dolor tincidunt leo, eget pretium orci purus ac nibh. Ut enim sem, suscipit ac elementum vitae, sodales vel sem.")
15
- User.create!(:name => "Dominic", :last_name => "Lepoin", :email => "dominiclepoin@gmail.com", :address => "Rue Tour Eiffel 4993", :zip => "11192", :country => "4", :receive_email => true, :birth_date => Date.today - 40.years, :description => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus a lectus et lacus ultrices auctor. Morbi aliquet convallis tincidunt. Praesent enim libero, iaculis at commodo nec, fermentum a dolor. Quisque eget eros id felis lacinia faucibus feugiat et ante. Aenean justo nisi, aliquam vel egestas vel, porta in ligula. Etiam molestie, lacus eget tincidunt accumsan, elit justo rhoncus urna, nec pretium neque mi et lorem. Aliquam posuere, dolor quis pulvinar luctus, felis dolor tincidunt leo, eget pretium orci purus ac nibh. Ut enim sem, suscipit ac elementum vitae, sodales vel sem.")
16
-
17
-
18
- Cuca::Car.delete_all
19
- Cuca::Car.create! :model => "Ford"
@@ -1,2 +0,0 @@
1
- Use this README file to introduce your application and point to useful places in the API for learning more.
2
- Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
File without changes
@@ -1,7 +0,0 @@
1
- desc "This task is called by the Heroku cron add-on"
2
- task :cron => :environment do
3
- if Time.now.hour == 0 # run at midnight
4
- Rake::Task["db:setup"].execute
5
- puts "db:setup performed"
6
- end
7
- end
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/404.html -->
21
- <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/422.html -->
21
- <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/500.html -->
21
- <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
23
- <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,5 +0,0 @@
1
- # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
- #
3
- # To ban all spiders from the entire site uncomment the next two lines:
4
- # User-Agent: *
5
- # Disallow: /
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
@@ -1,17 +0,0 @@
1
- # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
-
3
- one:
4
- name: testy
5
- last_name: tester
6
- address: 123 main st
7
- email: testytester@example.com
8
- zip: 12345
9
- country: 1
10
-
11
- two:
12
- name: mystery
13
- last_name: man
14
- address: PO Box 0, Nowhere
15
- email: misterioso@example.com
16
- zip: 99999
17
- country:
@@ -1,49 +0,0 @@
1
- require 'test_helper'
2
-
3
- class UsersControllerTest < ActionController::TestCase
4
- setup do
5
- @user = users(:one)
6
- end
7
-
8
- test "should get index" do
9
- get :index
10
- assert_response :success
11
- assert_not_nil assigns(:users)
12
- end
13
-
14
- test "should get new" do
15
- get :new
16
- assert_response :success
17
- end
18
-
19
- test "should create user" do
20
- assert_difference('User.count') do
21
- post :create, :user => @user.attributes
22
- end
23
-
24
- assert_redirected_to user_path(assigns(:user))
25
- end
26
-
27
- test "should show user" do
28
- get :show, :id => @user.to_param
29
- assert_response :success
30
- end
31
-
32
- test "should get edit" do
33
- get :edit, :id => @user.to_param
34
- assert_response :success
35
- end
36
-
37
- test "should update user" do
38
- put :update, :id => @user.to_param, :user => @user.attributes
39
- assert_redirected_to user_path(assigns(:user))
40
- end
41
-
42
- test "should destroy user" do
43
- assert_difference('User.count', -1) do
44
- delete :destroy, :id => @user.to_param
45
- end
46
-
47
- assert_redirected_to users_path
48
- end
49
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
- require 'rails/performance_test_help'
3
-
4
- # Profiling results for each test method are written to tmp/performance.
5
- class BrowsingTest < ActionDispatch::PerformanceTest
6
- def test_homepage
7
- get '/'
8
- end
9
- end
@@ -1,13 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path('../../config/environment', __FILE__)
3
- require 'rails/test_help'
4
-
5
- class ActiveSupport::TestCase
6
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
- #
8
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
- # -- they do not yet inherit this setting
10
- fixtures :all
11
-
12
- # Add more helper methods to be used by all tests here...
13
- end
@@ -1,4 +0,0 @@
1
- require 'test_helper'
2
-
3
- class UsersHelperTest < ActionView::TestCase
4
- end
@@ -1,8 +0,0 @@
1
- require 'test_helper'
2
-
3
- class UserTest < ActiveSupport::TestCase
4
- # Replace this with your real tests.
5
- test "the truth" do
6
- assert true
7
- end
8
- end
File without changes