rjs_helpers 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/helpers/rjs_helper.rb +11 -2
- data/lib/rjs_helpers/version.rb +1 -1
- data/test/rjs_helpers_test.rb +1 -1
- metadata +5 -5
data/app/helpers/rjs_helper.rb
CHANGED
@@ -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 : "'
|
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
|
-
|
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
|
data/lib/rjs_helpers/version.rb
CHANGED
data/test/rjs_helpers_test.rb
CHANGED
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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-
|
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.
|
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
|