best_in_place 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -4
- data/Gemfile +4 -2
- data/README.md +36 -38
- data/config.ru +1 -1
- data/gemfiles/rails_3.2.gemfile +3 -2
- data/gemfiles/rails_4.0.gemfile +3 -2
- data/gemfiles/rails_4.1.gemfile +3 -2
- data/gemfiles/rails_edge.gemfile +3 -3
- data/lib/assets/javascripts/best_in_place.js +2 -0
- data/lib/best_in_place/helper.rb +16 -8
- data/lib/best_in_place/test_helpers.rb +38 -18
- data/lib/best_in_place/version.rb +1 -1
- data/spec/helper_spec.rb +103 -23
- data/spec/integration/js_spec.rb +190 -355
- data/spec/integration/live_spec.rb +4 -10
- data/spec/integration/text_area_spec.rb +5 -10
- data/spec/internal/app/assets/stylesheets/{style.css.erb → style.css} +2 -2
- data/spec/internal/app/controllers/users_controller.rb +3 -3
- data/spec/internal/app/models/user.rb +3 -0
- data/spec/internal/app/views/users/_form.html.erb +1 -1
- data/spec/internal/app/views/users/index.html.erb +1 -1
- data/spec/internal/app/views/users/show.html.erb +3 -3
- data/spec/internal/config/initializers/countries.rb +5 -1
- data/spec/rails_helper.rb +8 -0
- data/spec/support/screenshot.rb +7 -0
- metadata +5 -4
@@ -18,22 +18,16 @@ describe "Monitor new fields", :js => true do
|
|
18
18
|
@user.save!
|
19
19
|
visit show_ajax_user_path(@user)
|
20
20
|
|
21
|
-
|
21
|
+
wait_for_ajax
|
22
22
|
|
23
|
-
|
24
|
-
expect(page).to have_content("lucianapoli@gmail")
|
25
|
-
end
|
23
|
+
expect(find('#email')).to have_content('lucianapoli@gmail')
|
26
24
|
|
27
25
|
bip_text @user, :email, "new@email.com"
|
28
26
|
|
29
|
-
|
30
|
-
expect(page).to have_content("new@email.com")
|
31
|
-
end
|
27
|
+
expect(find('#email')).to have_content('new@email.com')
|
32
28
|
|
33
29
|
bip_text @user, :email, "new_two@email.com"
|
34
30
|
|
35
|
-
|
36
|
-
expect(page).to have_content("new_two@email.com")
|
37
|
-
end
|
31
|
+
expect(find('#email')).to have_content('new_two@email.com')
|
38
32
|
end
|
39
33
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require 'rails_helper'
|
3
2
|
|
4
3
|
describe "JS behaviour", :js => true do
|
5
4
|
before do
|
@@ -17,24 +16,20 @@ describe "JS behaviour", :js => true do
|
|
17
16
|
it "should be able to use bip_text to update a text area" do
|
18
17
|
@user.save!
|
19
18
|
visit user_path(@user)
|
20
|
-
|
21
|
-
expect(page).to have_content("User description")
|
22
|
-
end
|
19
|
+
expect(find('#description')).to have_content('User description')
|
23
20
|
|
24
21
|
bip_area @user, :description, "A new description"
|
25
22
|
|
26
23
|
visit user_path(@user)
|
27
|
-
|
28
|
-
|
29
|
-
end
|
24
|
+
|
25
|
+
expect(find('#description')).to have_content('A new description')
|
30
26
|
end
|
31
27
|
|
32
28
|
it "should be able to use a bip_text with :display_with option" do
|
33
29
|
@user.description = "I'm so awesome"
|
34
30
|
@user.save!
|
35
31
|
visit user_path(@user)
|
36
|
-
|
37
|
-
|
38
|
-
end
|
32
|
+
|
33
|
+
expect(find('#dw_description')).to have_content("I'm so awesome")
|
39
34
|
end
|
40
35
|
end
|
@@ -47,7 +47,7 @@ textarea {
|
|
47
47
|
}
|
48
48
|
.best_in_place:hover, #user_account .do_hover {
|
49
49
|
padding-right: 1.5em;
|
50
|
-
background: url(
|
50
|
+
background: url("/assets/red_pen.png") no-repeat right;
|
51
51
|
background-color: #CCC;
|
52
52
|
}
|
53
53
|
.info_edit {
|
@@ -81,5 +81,5 @@ textarea {
|
|
81
81
|
width: 25px;
|
82
82
|
height: 25px;
|
83
83
|
text-indent: -9999px;
|
84
|
-
background: url(
|
84
|
+
background: url("assets/purrClose.png") no-repeat;
|
85
85
|
}
|
@@ -14,7 +14,7 @@ class UsersController < ApplicationController
|
|
14
14
|
# GET /users/1.xml
|
15
15
|
def show
|
16
16
|
@user = User.find(params[:id])
|
17
|
-
@countries =
|
17
|
+
@countries = COUNTRIES_HASH
|
18
18
|
|
19
19
|
respond_to do |format|
|
20
20
|
format.html # show.html.erb
|
@@ -29,12 +29,12 @@ class UsersController < ApplicationController
|
|
29
29
|
|
30
30
|
def show_ajax
|
31
31
|
@user = User.find(params[:id])
|
32
|
-
@countries =
|
32
|
+
@countries = COUNTRIES_HASH
|
33
33
|
end
|
34
34
|
|
35
35
|
def double_init
|
36
36
|
@user = User.find(params[:id])
|
37
|
-
@countries =
|
37
|
+
@countries = COUNTRIES_HASH
|
38
38
|
end
|
39
39
|
|
40
40
|
# GET /users/1/edit
|
@@ -16,6 +16,9 @@ class User < ActiveRecord::Base
|
|
16
16
|
validates_numericality_of :money_proc, :allow_blank => true
|
17
17
|
|
18
18
|
alias_attribute :money_custom, :money
|
19
|
+
alias_attribute :money_value, :money
|
20
|
+
alias_attribute :receive_email_image, :receive_email
|
21
|
+
alias_attribute :description_simple, :description
|
19
22
|
|
20
23
|
def address_format
|
21
24
|
"<b>addr => [#{address}]</b>".html_safe
|
@@ -61,7 +61,7 @@
|
|
61
61
|
<tr>
|
62
62
|
<td>Receive newsletter (image)?</td>
|
63
63
|
<td id="receive_email_image">
|
64
|
-
<%= best_in_place @user, :
|
64
|
+
<%= best_in_place @user, :receive_email_image, as: :checkbox, :collection => {'false' => image_tag('no.png'), 'true' => image_tag('yes.png')} %>
|
65
65
|
</td>
|
66
66
|
</tr>
|
67
67
|
<tr>
|
@@ -96,7 +96,7 @@
|
|
96
96
|
<tr>
|
97
97
|
<td>Simple-formatted user description</td>
|
98
98
|
<td id="dw_description">
|
99
|
-
<%= best_in_place @user, :
|
99
|
+
<%= best_in_place @user, :description_simple, :display_with => :simple_format, as: :textarea %>
|
100
100
|
</td>
|
101
101
|
</tr>
|
102
102
|
<tr>
|
@@ -120,7 +120,7 @@
|
|
120
120
|
<tr>
|
121
121
|
<td>Money with value</td>
|
122
122
|
<td id="money_value">
|
123
|
-
<%= best_in_place @user, :
|
123
|
+
<%= best_in_place @user, :money_value, :display_with => :number_to_currency, value: 'Custom Value' %>
|
124
124
|
</td>
|
125
125
|
</tr>
|
126
126
|
<tr>
|
@@ -1 +1,5 @@
|
|
1
|
-
|
1
|
+
COUNTRIES_HASH = { 1 => 'Spain', 2 => 'Italy', 3 => 'Germany', 4 => 'France' }
|
2
|
+
COUNTRIES_HASH_STRING_KEYS = { es: 'Spain', it: 'Italy', de: 'Germany', fr: 'France' }
|
3
|
+
COUNTRIES_ARRAY = %w(Spain Italy Germany France)
|
4
|
+
COUNTRIES_APOSTROPHE_HASH = {1 => "Joe's Country", 2 => "Bob's Country"}
|
5
|
+
COUNTRIES_APOSTROPHE_ARRAY = ["Joe's Country", "Bob's Country"]
|
data/spec/rails_helper.rb
CHANGED
@@ -2,6 +2,14 @@ ENV['RAILS_ENV'] ||= 'test'
|
|
2
2
|
|
3
3
|
require 'combustion'
|
4
4
|
require 'capybara/rspec'
|
5
|
+
|
6
|
+
require 'capybara/poltergeist'
|
7
|
+
require_relative 'support/screenshot'
|
8
|
+
Capybara.register_driver :poltergeist do |app|
|
9
|
+
Capybara::Poltergeist::Driver.new(app, {js_errors: false, inspector: true})
|
10
|
+
end
|
11
|
+
Capybara.javascript_driver = :poltergeist
|
12
|
+
|
5
13
|
require 'best_in_place'
|
6
14
|
|
7
15
|
Combustion.initialize! :active_record, :action_controller,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: best_in_place
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernat Farrero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -104,7 +104,7 @@ files:
|
|
104
104
|
- spec/internal/app/assets/stylesheets/.gitkeep
|
105
105
|
- spec/internal/app/assets/stylesheets/jquery-ui-1.8.16.custom.css.erb
|
106
106
|
- spec/internal/app/assets/stylesheets/scaffold.css
|
107
|
-
- spec/internal/app/assets/stylesheets/style.css
|
107
|
+
- spec/internal/app/assets/stylesheets/style.css
|
108
108
|
- spec/internal/app/controllers/admin/users_controller.rb
|
109
109
|
- spec/internal/app/controllers/application_controller.rb
|
110
110
|
- spec/internal/app/controllers/cuca/cars_controller.rb
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- spec/internal/public/favicon.ico
|
134
134
|
- spec/rails_helper.rb
|
135
135
|
- spec/support/retry_on_timeout.rb
|
136
|
+
- spec/support/screenshot.rb
|
136
137
|
- spec/utils_spec.rb
|
137
138
|
- vendor/assets/javascripts/jquery.autosize.js
|
138
139
|
- vendor/assets/javascripts/jquery.purr.js
|
@@ -155,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
156
|
version: '0'
|
156
157
|
requirements: []
|
157
158
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.
|
159
|
+
rubygems_version: 2.2.2
|
159
160
|
signing_key:
|
160
161
|
specification_version: 4
|
161
162
|
summary: It makes any field in place editable by clicking on it, it works for inputs,
|