best_in_place 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -90,6 +90,8 @@ BestInPlaceEditor.prototype = {
|
|
90
90
|
});
|
91
91
|
if (this.formType == "select") {
|
92
92
|
var value = this.getValue();
|
93
|
+
this.previousCollectionValue = value;
|
94
|
+
|
93
95
|
jQuery.each(this.values, function(i, v) {
|
94
96
|
if (value == v[0]) {
|
95
97
|
editor.element.html(v[1]);
|
@@ -230,6 +232,11 @@ BestInPlaceEditor.prototype = {
|
|
230
232
|
// Binding back after being clicked
|
231
233
|
jQuery(this.activator).bind('click', {editor: this}, this.clickHandler);
|
232
234
|
this.element.trigger(jQuery.Event("best_in_place:deactivate"));
|
235
|
+
|
236
|
+
if (this.collectionValue !== null) {
|
237
|
+
this.collectionValue = this.previousCollectionValue;
|
238
|
+
this.previousCollectionValue = null;
|
239
|
+
}
|
233
240
|
},
|
234
241
|
|
235
242
|
loadErrorCallback : function(request, error) {
|
data/spec/integration/js_spec.rb
CHANGED
@@ -863,4 +863,21 @@ describe "JS behaviour", :js => true do
|
|
863
863
|
|
864
864
|
page.should have_css("##{id} select option[value='2'][selected='selected']")
|
865
865
|
end
|
866
|
+
|
867
|
+
it "should generate the select with the proper current option without reloading the page" do
|
868
|
+
@user.save!
|
869
|
+
visit user_path(@user)
|
870
|
+
within("#country") do
|
871
|
+
page.should have_content("Italy")
|
872
|
+
end
|
873
|
+
|
874
|
+
bip_select @user, :country, "France"
|
875
|
+
|
876
|
+
id = BestInPlace::Utils.build_best_in_place_id @user, :country
|
877
|
+
page.execute_script <<-JS
|
878
|
+
$("##{id}").click();
|
879
|
+
JS
|
880
|
+
|
881
|
+
page.should have_css("##{id} select option[value='4'][selected='selected']")
|
882
|
+
end
|
866
883
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: best_in_place
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -228,18 +228,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
228
228
|
- - ! '>='
|
229
229
|
- !ruby/object:Gem::Version
|
230
230
|
version: '0'
|
231
|
-
segments:
|
232
|
-
- 0
|
233
|
-
hash: -891902797
|
234
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
235
232
|
none: false
|
236
233
|
requirements:
|
237
234
|
- - ! '>='
|
238
235
|
- !ruby/object:Gem::Version
|
239
236
|
version: '0'
|
240
|
-
segments:
|
241
|
-
- 0
|
242
|
-
hash: -891902797
|
243
237
|
requirements: []
|
244
238
|
rubyforge_project: best_in_place
|
245
239
|
rubygems_version: 1.8.24
|