on_the_spot 0.0.18 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +4 -3
- data/VERSION +1 -1
- data/lib/on_the_spot/controller_extension.rb +2 -1
- data/lib/on_the_spot/on_the_spot_helpers.rb +2 -0
- data/on_the_spot.gemspec +8 -8
- data/spec/on_the_spot_spec.rb +11 -0
- metadata +12 -14
data/README.markdown
CHANGED
@@ -37,9 +37,9 @@ Or, inside your `application.html.haml` you could still include the needed javas
|
|
37
37
|
|
38
38
|
= javascript_include_tag :on_the_spot
|
39
39
|
|
40
|
-
To use the default styling, add the following to application.css so it compiles to the asset_pipeline
|
40
|
+
To use the default styling, add the following to `application.css` so it compiles to the asset_pipeline
|
41
41
|
|
42
|
-
|
42
|
+
*= require on_the_spot
|
43
43
|
|
44
44
|
Or, inside your `application.html.haml` you could still include the needed css, using
|
45
45
|
|
@@ -122,6 +122,7 @@ The `on_the_spot_edit` also accepts options:
|
|
122
122
|
* `:display_method`: the name of a method that is used to get the value to display of a field. When you use this, we will automatically
|
123
123
|
attempt to look up the raw value of the field to edit. This differs from the `:display_text` option, as this will also be called after update.
|
124
124
|
This supersedes the `:display_text` option.
|
125
|
+
* `:raw`: if set to true, evaluate the field value as raw HTML.
|
125
126
|
|
126
127
|
|
127
128
|
For the texts: if a text is not specified, the default is taken from the `on_the_spot.en.yml` (or your current language).
|
@@ -165,7 +166,7 @@ You can use these classes to style the elements.
|
|
165
166
|
When using `on_the_spot` together with `cancan`, you will have to explicitly exclude the on_the_spot method,
|
166
167
|
like so:
|
167
168
|
|
168
|
-
|
169
|
+
load_and_authorize_resource :except => [:update_attribute_on_the_spot, :get_attribute_on_the_spot]
|
169
170
|
|
170
171
|
The `load_and_authorize_resource` will try to find the object, based on the id in the parameters, but `on_the_spot` uses a different
|
171
172
|
encoding to store the object, field and id in one attribute. So if you exclude that, there will not be a problem.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
1.0.0
|
@@ -24,7 +24,8 @@ module OnTheSpot
|
|
24
24
|
field_or_method = if display_method.present?
|
25
25
|
object.send(display_method)
|
26
26
|
else
|
27
|
-
|
27
|
+
value = object.send(field).to_s
|
28
|
+
params[:raw] ? value : CGI::escapeHTML(value)
|
28
29
|
end
|
29
30
|
render :text => field_or_method
|
30
31
|
else
|
@@ -28,9 +28,11 @@ module OnTheSpot
|
|
28
28
|
:url => {:action => 'update_attribute_on_the_spot'}
|
29
29
|
)
|
30
30
|
|
31
|
+
options[:url].merge!(:raw => true) if options[:raw]
|
31
32
|
update_url = url_for(options[:url])
|
32
33
|
|
33
34
|
field_value = object.send(field.to_sym).to_s
|
35
|
+
field_value = field_value.html_safe if options[:raw]
|
34
36
|
|
35
37
|
html_options = { :id => "#{object.class.name.underscore}__#{field}__#{object.id}",
|
36
38
|
:class => 'on_the_spot_editing',
|
data/on_the_spot.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.0
|
7
|
+
s.name = "on_the_spot"
|
8
|
+
s.version = "1.0.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nathan Van der Auwera"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2012-01-25"
|
13
|
+
s.description = "Unobtrusive in place editing, using jEditable; only works in Rails 3"
|
14
|
+
s.email = "nathan@dixis.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
17
|
"README.markdown"
|
@@ -78,10 +78,10 @@ Gem::Specification.new do |s|
|
|
78
78
|
"spec/on_the_spot_spec.rb",
|
79
79
|
"spec/spec_helper.rb"
|
80
80
|
]
|
81
|
-
s.homepage =
|
81
|
+
s.homepage = "http://github.com/nathanvda/on_the_spot"
|
82
82
|
s.require_paths = ["lib"]
|
83
|
-
s.rubygems_version =
|
84
|
-
s.summary =
|
83
|
+
s.rubygems_version = "1.8.15"
|
84
|
+
s.summary = "unobtrusive in place editing"
|
85
85
|
|
86
86
|
if s.respond_to? :specification_version then
|
87
87
|
s.specification_version = 3
|
data/spec/on_the_spot_spec.rb
CHANGED
@@ -142,7 +142,18 @@ describe "OnTheSpot" do
|
|
142
142
|
@result = @tester.on_the_spot_edit @dummy, :content, :url => {:action => 'update_it_otherwise' }
|
143
143
|
@result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla\" id=\"r_spec/mocks/mock__content__123\">test</span>"
|
144
144
|
end
|
145
|
+
end
|
145
146
|
|
147
|
+
context "with raw parameter" do
|
148
|
+
before(:each) do
|
149
|
+
@tester.should_receive(:url_for).with({:action => 'update_attribute_on_the_spot', :raw => true}).and_return('/bla?raw=true')
|
150
|
+
end
|
151
|
+
|
152
|
+
it "supports raw html" do
|
153
|
+
@dummy.stub!(:content).and_return('<b>test</b>')
|
154
|
+
@result = @tester.on_the_spot_edit @dummy, :content, :raw => true
|
155
|
+
@result.should == "<span class=\"on_the_spot_editing\" data-cancel=\"cancel\" data-ok=\"ok\" data-tooltip=\"tooltip\" data-url=\"/bla?raw=true\" id=\"r_spec/mocks/mock__content__123\"><b>test</b></span>"
|
156
|
+
end
|
146
157
|
end
|
147
158
|
end
|
148
159
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: on_the_spot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.18
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nathan Van der Auwera
|
@@ -15,28 +15,26 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
18
|
+
date: 2012-01-25 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
type: :development
|
23
21
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
22
|
none: false
|
25
23
|
requirements:
|
26
24
|
- - ">="
|
27
25
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
26
|
+
hash: 1401735994
|
29
27
|
segments:
|
30
28
|
- 2
|
31
29
|
- 0
|
32
30
|
- 0
|
33
31
|
- rc
|
34
32
|
version: 2.0.0rc
|
35
|
-
name: rspec
|
36
33
|
version_requirements: *id001
|
34
|
+
name: rspec
|
37
35
|
prerelease: false
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
36
|
type: :development
|
37
|
+
- !ruby/object:Gem::Dependency
|
40
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
40
|
requirements:
|
@@ -48,11 +46,11 @@ dependencies:
|
|
48
46
|
- 0
|
49
47
|
- 0
|
50
48
|
version: 3.0.0
|
51
|
-
name: actionpack
|
52
49
|
version_requirements: *id002
|
50
|
+
name: actionpack
|
53
51
|
prerelease: false
|
52
|
+
type: :development
|
54
53
|
- !ruby/object:Gem::Dependency
|
55
|
-
type: :runtime
|
56
54
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
55
|
none: false
|
58
56
|
requirements:
|
@@ -64,9 +62,10 @@ dependencies:
|
|
64
62
|
- 4
|
65
63
|
- 6
|
66
64
|
version: 1.4.6
|
67
|
-
name: json_pure
|
68
65
|
version_requirements: *id003
|
66
|
+
name: json_pure
|
69
67
|
prerelease: false
|
68
|
+
type: :runtime
|
70
69
|
description: Unobtrusive in place editing, using jEditable; only works in Rails 3
|
71
70
|
email: nathan@dixis.com
|
72
71
|
executables: []
|
@@ -137,7 +136,6 @@ files:
|
|
137
136
|
- spec/generators/install_generator_spec.rb
|
138
137
|
- spec/on_the_spot_spec.rb
|
139
138
|
- spec/spec_helper.rb
|
140
|
-
has_rdoc: true
|
141
139
|
homepage: http://github.com/nathanvda/on_the_spot
|
142
140
|
licenses: []
|
143
141
|
|
@@ -167,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
165
|
requirements: []
|
168
166
|
|
169
167
|
rubyforge_project:
|
170
|
-
rubygems_version: 1.
|
168
|
+
rubygems_version: 1.8.15
|
171
169
|
signing_key:
|
172
170
|
specification_version: 3
|
173
171
|
summary: unobtrusive in place editing
|