stay 0.1.4.1 → 0.1.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -161,6 +161,9 @@ Example of complete use:
161
161
  end
162
162
  ```
163
163
 
164
+ ### Sanitize
165
+ Since version 0.1.4.1, **Stay** only accept this tags %w(p strong em span ul li ol)
166
+
164
167
  ## Changelog
165
168
  Just some good releases changelog:
166
169
 
@@ -176,4 +179,4 @@ Just some good releases changelog:
176
179
  - Add error callback to the JSON
177
180
 
178
181
  **v0.1.0.0**
179
- - Initial release, February 4th 2012
182
+ - Initial release, February 4th 2012
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('stay', '0.1.4.1') do |p|
5
+ Echoe.new('stay', '0.1.4.2') do |p|
6
6
  p.description = "Form ajax helper with tinymce support"
7
7
  p.summary = "Helper for building ajax form, inspired by best_in_place, with some modifications, support tinymce as editor"
8
8
  p.url = "http://github.com/tejanium/stay"
@@ -7,13 +7,13 @@ module Stay
7
7
  private
8
8
  def response_ok(obj)
9
9
  field = params[obj.class.to_s.underscore].keys.first
10
- value = obj.send(field.to_sym)
10
+ value = ActionController::Base.helpers.sanitize(obj.send(field.to_sym), tags: %w(p strong em span ul li ol))
11
11
  render json: { :display => (value.nil? ? "-" : value.to_html), :input => value }, status: :ok
12
12
  end
13
13
 
14
14
  def response_error(obj)
15
15
  field = params[obj.class.to_s.underscore].keys.first
16
- value = obj.send("#{field}_was".to_sym)
16
+ value = ActionController::Base.helpers.sanitize(obj.send("#{field}_was".to_sym), tags: %w(p strong em span ul li ol))
17
17
  render json: { :display => (value.nil? ? "-" : value.to_html), :input => value, :errors => obj.errors }, status: :unprocessable_entity
18
18
  end
19
19
  end
data/lib/stay/helper.rb CHANGED
@@ -20,7 +20,7 @@ module Stay
20
20
  end
21
21
 
22
22
  ActionView::Helpers::FormHelper.send(:include, FormHelper)
23
-
23
+
24
24
  module StayHelpers
25
25
  def stay(record, field, opts = {})
26
26
  raise ArgumentError, "Can't have Canceller without Submitter" if opts[:canceller] && opts[:submitter].nil?
@@ -37,7 +37,7 @@ module Stay
37
37
  if val.nil?
38
38
  html << "-"
39
39
  else
40
- html << val.to_html
40
+ html << sanitize(val, tags: %w(p strong em span ul li ol)).to_html
41
41
  end
42
42
  html << "</span>"
43
43
  html << "<span class='stay-form' style='display:none'>"
@@ -48,3 +48,4 @@ module Stay
48
48
  end
49
49
  end
50
50
  end
51
+
data/stay.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "stay"
5
- s.version = "0.1.4.1"
5
+ s.version = "0.1.4.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Teja Sophista"]
9
- s.date = "2012-03-12"
9
+ s.date = "2012-03-15"
10
10
  s.description = "Form ajax helper with tinymce support"
11
11
  s.email = "tejanium@yahoo.com"
12
12
  s.extra_rdoc_files = ["README.md", "README.rdoc", "lib/assets/javascripts/stay.js", "lib/stay.rb", "lib/stay/controller_extensions.rb", "lib/stay/engine.rb", "lib/stay/helper.rb", "lib/stay/string_extensions.rb"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4.1
4
+ version: 0.1.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-12 00:00:00.000000000Z
12
+ date: 2012-03-15 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-rails
16
- requirement: &28151000 !ruby/object:Gem::Requirement
16
+ requirement: &12364280 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *28151000
24
+ version_requirements: *12364280
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tinymce-rails
27
- requirement: &28183420 !ruby/object:Gem::Requirement
27
+ requirement: &12363820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *28183420
35
+ version_requirements: *12363820
36
36
  description: Form ajax helper with tinymce support
37
37
  email: tejanium@yahoo.com
38
38
  executables: []