rjs_helpers 0.0.3 → 0.0.4

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.
@@ -134,7 +134,7 @@ module RjsHelper
134
134
  end
135
135
 
136
136
  def string_args(args)
137
- args.map {|a| a.is_a?(Numeric) ? a : "'#{a}'"}.join(', ')
137
+ args.map {|a| a.is_a?(Numeric) ? a : ('"' + fixed_escape_javascript(a.to_s) + '"')}.join(', ')
138
138
  end
139
139
 
140
140
 
@@ -144,6 +144,15 @@ module RjsHelper
144
144
  # Also, it automatically escapes javascript in the given content
145
145
  #--------------------------------------------------------------
146
146
  def rendered_content(content)
147
- escape_javascript(content.is_a?(Hash) ? render(content) : content)
147
+ content.is_a?(Hash) ? render(content) : content
148
+ end
149
+
150
+ #
151
+ # The Rails +escape_javascript+ helper does not seem to automatically
152
+ # escape unicode newline elements which causes javascript strings
153
+ # to break. This method escapes these sequences.
154
+ #
155
+ def fixed_escape_javascript(text)
156
+ escape_javascript(text).gsub("\342\200\250", "
")
148
157
  end
149
158
  end
@@ -1,3 +1,3 @@
1
1
  module RjsHelpers
2
- VERSION = "0.0.3"
2
+ VERSION = '0.0.4'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class JrsHelperTest < ActiveSupport::TestCase
3
+ class RjsHelperTest < ActiveSupport::TestCase
4
4
  # Replace this with your real tests.
5
5
  test "the truth" do
6
6
  assert true
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rjs_helpers
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Stefan Exner
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-02-19 00:00:00 Z
18
+ date: 2014-06-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bundler
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  requirements: []
123
123
 
124
124
  rubyforge_project:
125
- rubygems_version: 1.8.22
125
+ rubygems_version: 1.7.2
126
126
  signing_key:
127
127
  specification_version: 3
128
128
  summary: Some helper methods to perform standard JS library tasks from js.erb without having to write actual javascript