mack-javascript 0.6.1.1 → 0.6.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/classes/JavascriptGenerator.html +162 -0
- data/doc/classes/Mack.html +141 -0
- data/doc/classes/Mack/JavaScript/Framework/Jquery.html +491 -0
- data/doc/classes/Mack/JavaScript/Framework/Prototype.html +438 -0
- data/doc/classes/Mack/JavaScript/ScriptGenerator.html +367 -0
- data/doc/classes/Mack/Rendering/Engine/Rjs.html +185 -0
- data/doc/classes/Mack/Rendering/Engine/Rjs/ViewTemplateHelpers.html +140 -0
- data/doc/classes/Mack/Rendering/Type/Js.html +180 -0
- data/doc/classes/Mack/Testing/Helpers.html +144 -0
- data/doc/classes/Mack/ViewHelpers/HtmlHelpers.html +240 -0
- data/doc/classes/Mack/ViewHelpers/StringHelpers.html +143 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +111 -0
- data/doc/files/lib/mack-javascript/generators/javascript_generator_rb.html +113 -0
- data/doc/files/lib/mack-javascript/helpers/jquery_helper_rb.html +101 -0
- data/doc/files/lib/mack-javascript/helpers/prototype_helper_rb.html +101 -0
- data/doc/files/lib/mack-javascript/helpers/script_generator_rb.html +101 -0
- data/doc/files/lib/mack-javascript/helpers/testing_helpers_rb.html +101 -0
- data/doc/files/lib/mack-javascript/rendering/engine/rjs_rb.html +101 -0
- data/doc/files/lib/mack-javascript/rendering/type/js_rb.html +101 -0
- data/doc/files/lib/mack-javascript/view_helpers/html_helpers_rb.html +101 -0
- data/doc/files/lib/mack-javascript/view_helpers/string_helpers_rb.html +101 -0
- data/doc/files/lib/mack-javascript_rb.html +107 -0
- data/doc/fr_class_index.html +41 -0
- data/doc/fr_file_index.html +37 -0
- data/doc/fr_method_index.html +69 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- metadata +30 -2
@@ -0,0 +1,144 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Mack::Testing::Helpers</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Mack::Testing::Helpers</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/mack-javascript/helpers/testing_helpers_rb.html">
|
59
|
+
lib/mack-javascript/helpers/testing_helpers.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000043">xhr</a>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if includes -->
|
91
|
+
|
92
|
+
<div id="section">
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if method_list -->
|
102
|
+
<div id="methods">
|
103
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
104
|
+
|
105
|
+
<div id="method-M000043" class="method-detail">
|
106
|
+
<a name="M000043"></a>
|
107
|
+
|
108
|
+
<div class="method-heading">
|
109
|
+
<a href="#M000043" class="method-signature">
|
110
|
+
<span class="method-name">xhr</span><span class="method-args">(method, uri, options = {})</span>
|
111
|
+
</a>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
<div class="method-description">
|
115
|
+
<p>
|
116
|
+
simulates an ajax request
|
117
|
+
</p>
|
118
|
+
<p><a class="source-toggle" href="#"
|
119
|
+
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
|
120
|
+
<div class="method-source-code" id="M000043-source">
|
121
|
+
<pre>
|
122
|
+
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/testing_helpers.rb, line 5</span>
|
123
|
+
5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xhr</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">options</span> = {})
|
124
|
+
6: <span class="ruby-identifier">options</span> = {<span class="ruby-identifier">:input</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">to_params</span>} <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">method</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:post</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">method</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:put</span>
|
125
|
+
7: <span class="ruby-identifier">build_response</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">build_request_options</span>(<span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>({<span class="ruby-value str">"HTTP_X_REQUESTED_WITH"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'XMLHttpRequest'</span>, <span class="ruby-value str">"HTTP_ACCEPT"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'text/javascript, text/html, application/xml, text/xml, */*'</span>}))))
|
126
|
+
8: <span class="ruby-keyword kw">end</span>
|
127
|
+
</pre>
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
|
133
|
+
</div>
|
134
|
+
|
135
|
+
|
136
|
+
</div>
|
137
|
+
|
138
|
+
|
139
|
+
<div id="validator-badges">
|
140
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
</body>
|
144
|
+
</html>
|
@@ -0,0 +1,240 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Mack::ViewHelpers::HtmlHelpers</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Mack::ViewHelpers::HtmlHelpers</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/mack-javascript/view_helpers/html_helpers_rb.html">
|
59
|
+
lib/mack-javascript/view_helpers/html_helpers.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000004">link_to_function</a>
|
84
|
+
<a href="#M000003">link_to_remote</a>
|
85
|
+
<a href="#M000005">remote_function</a>
|
86
|
+
<a href="#M000002">update_page</a>
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
|
93
|
+
<!-- if includes -->
|
94
|
+
|
95
|
+
<div id="section">
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
<!-- if method_list -->
|
105
|
+
<div id="methods">
|
106
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
107
|
+
|
108
|
+
<div id="method-M000004" class="method-detail">
|
109
|
+
<a name="M000004"></a>
|
110
|
+
|
111
|
+
<div class="method-heading">
|
112
|
+
<a href="#M000004" class="method-signature">
|
113
|
+
<span class="method-name">link_to_function</span><span class="method-args">(link_text, *args) {|Mack::JavaScript::ScriptGenerator.new| ...}</span>
|
114
|
+
</a>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
<div class="method-description">
|
118
|
+
<p><a class="source-toggle" href="#"
|
119
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
120
|
+
<div class="method-source-code" id="M000004-source">
|
121
|
+
<pre>
|
122
|
+
<span class="ruby-comment cmt"># File lib/mack-javascript/view_helpers/html_helpers.rb, line 27</span>
|
123
|
+
27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">link_to_function</span>(<span class="ruby-identifier">link_text</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
124
|
+
28: <span class="ruby-identifier">function</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>
|
125
|
+
29: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">||</span> {}
|
126
|
+
30: <span class="ruby-identifier">function</span> = <span class="ruby-keyword kw">yield</span>(<span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">JavaScript</span><span class="ruby-operator">::</span><span class="ruby-constant">ScriptGenerator</span>.<span class="ruby-identifier">new</span>).<span class="ruby-identifier">chop</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
127
|
+
31: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:onclick</span>] = (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:onclick</span>] <span class="ruby-operator">?</span> <span class="ruby-node">"#{options[:onclick]}; "</span> <span class="ruby-operator">:</span> <span class="ruby-value str">""</span>) <span class="ruby-operator">+</span> <span class="ruby-node">"#{function}; return false;"</span>
|
128
|
+
32: <span class="ruby-identifier">link_to</span>(<span class="ruby-identifier">link_text</span>, <span class="ruby-value str">'#'</span>, <span class="ruby-identifier">options</span>)
|
129
|
+
33: <span class="ruby-keyword kw">end</span>
|
130
|
+
</pre>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
|
135
|
+
<div id="method-M000003" class="method-detail">
|
136
|
+
<a name="M000003"></a>
|
137
|
+
|
138
|
+
<div class="method-heading">
|
139
|
+
<a href="#M000003" class="method-signature">
|
140
|
+
<span class="method-name">link_to_remote</span><span class="method-args">(link_text, ajax_options, options = {})</span>
|
141
|
+
</a>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div class="method-description">
|
145
|
+
<p><a class="source-toggle" href="#"
|
146
|
+
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
147
|
+
<div class="method-source-code" id="M000003-source">
|
148
|
+
<pre>
|
149
|
+
<span class="ruby-comment cmt"># File lib/mack-javascript/view_helpers/html_helpers.rb, line 23</span>
|
150
|
+
23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">link_to_remote</span>(<span class="ruby-identifier">link_text</span>, <span class="ruby-identifier">ajax_options</span>, <span class="ruby-identifier">options</span> = {})
|
151
|
+
24: <span class="ruby-identifier">link_to_function</span>(<span class="ruby-identifier">link_text</span>, <span class="ruby-identifier">remote_function</span>(<span class="ruby-identifier">ajax_options</span>), <span class="ruby-identifier">options</span>)
|
152
|
+
25: <span class="ruby-keyword kw">end</span>
|
153
|
+
</pre>
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
<div id="method-M000005" class="method-detail">
|
159
|
+
<a name="M000005"></a>
|
160
|
+
|
161
|
+
<div class="method-heading">
|
162
|
+
<a href="#M000005" class="method-signature">
|
163
|
+
<span class="method-name">remote_function</span><span class="method-args">(options)</span>
|
164
|
+
</a>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
<div class="method-description">
|
168
|
+
<p>
|
169
|
+
Returns javascript that does an Ajax call
|
170
|
+
</p>
|
171
|
+
<p><a class="source-toggle" href="#"
|
172
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
173
|
+
<div class="method-source-code" id="M000005-source">
|
174
|
+
<pre>
|
175
|
+
<span class="ruby-comment cmt"># File lib/mack-javascript/view_helpers/html_helpers.rb, line 36</span>
|
176
|
+
36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remote_function</span>(<span class="ruby-identifier">options</span>)
|
177
|
+
37: <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">JavaScript</span><span class="ruby-operator">::</span><span class="ruby-constant">ScriptGenerator</span>.<span class="ruby-identifier">framework</span>.<span class="ruby-identifier">remote_function</span>(<span class="ruby-identifier">options</span>)
|
178
|
+
38: <span class="ruby-keyword kw">end</span>
|
179
|
+
</pre>
|
180
|
+
</div>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
|
184
|
+
<div id="method-M000002" class="method-detail">
|
185
|
+
<a name="M000002"></a>
|
186
|
+
|
187
|
+
<div class="method-heading">
|
188
|
+
<a href="#M000002" class="method-signature">
|
189
|
+
<span class="method-name">update_page</span><span class="method-args">() {|sg| ...}</span>
|
190
|
+
</a>
|
191
|
+
</div>
|
192
|
+
|
193
|
+
<div class="method-description">
|
194
|
+
<pre>
|
195
|
+
Renders javascript in an html file
|
196
|
+
|
197
|
+
Example:
|
198
|
+
<%= update_page do |page|
|
199
|
+
page.alert('this gets translated to js!')
|
200
|
+
page.show('my_hidden_div')
|
201
|
+
end
|
202
|
+
%>
|
203
|
+
</pre>
|
204
|
+
<p>
|
205
|
+
This returns (assuming Prototype is your Js Framework):
|
206
|
+
</p>
|
207
|
+
<pre>
|
208
|
+
<script type='text/javascript'>
|
209
|
+
alert('this gets translated to js!');
|
210
|
+
$('my_hidden_div').show();
|
211
|
+
</script>
|
212
|
+
</pre>
|
213
|
+
<p><a class="source-toggle" href="#"
|
214
|
+
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
215
|
+
<div class="method-source-code" id="M000002-source">
|
216
|
+
<pre>
|
217
|
+
<span class="ruby-comment cmt"># File lib/mack-javascript/view_helpers/html_helpers.rb, line 17</span>
|
218
|
+
17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_page</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
219
|
+
18: <span class="ruby-identifier">sg</span> = <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">JavaScript</span><span class="ruby-operator">::</span><span class="ruby-constant">ScriptGenerator</span>.<span class="ruby-identifier">new</span>
|
220
|
+
19: <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">sg</span>)
|
221
|
+
20: <span class="ruby-node">"<script type='#{Mack::Utils::MimeTypes[:js]}'>\n"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">sg</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">';'</span>, <span class="ruby-value str">";\n"</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">"</script>"</span>
|
222
|
+
21: <span class="ruby-keyword kw">end</span>
|
223
|
+
</pre>
|
224
|
+
</div>
|
225
|
+
</div>
|
226
|
+
</div>
|
227
|
+
|
228
|
+
|
229
|
+
</div>
|
230
|
+
|
231
|
+
|
232
|
+
</div>
|
233
|
+
|
234
|
+
|
235
|
+
<div id="validator-badges">
|
236
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
237
|
+
</div>
|
238
|
+
|
239
|
+
</body>
|
240
|
+
</html>
|
@@ -0,0 +1,143 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Mack::ViewHelpers::StringHelpers</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Mack::ViewHelpers::StringHelpers</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/mack-javascript/view_helpers/string_helpers_rb.html">
|
59
|
+
lib/mack-javascript/view_helpers/string_helpers.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000006">escape_javascript</a>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if includes -->
|
91
|
+
|
92
|
+
<div id="section">
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if method_list -->
|
102
|
+
<div id="methods">
|
103
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
104
|
+
|
105
|
+
<div id="method-M000006" class="method-detail">
|
106
|
+
<a name="M000006"></a>
|
107
|
+
|
108
|
+
<div class="method-heading">
|
109
|
+
<a href="#M000006" class="method-signature">
|
110
|
+
<span class="method-name">escape_javascript</span><span class="method-args">(javascript)</span>
|
111
|
+
</a>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
<div class="method-description">
|
115
|
+
<p>
|
116
|
+
Escapes Javascript
|
117
|
+
</p>
|
118
|
+
<p><a class="source-toggle" href="#"
|
119
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
120
|
+
<div class="method-source-code" id="M000006-source">
|
121
|
+
<pre>
|
122
|
+
<span class="ruby-comment cmt"># File lib/mack-javascript/view_helpers/string_helpers.rb, line 7</span>
|
123
|
+
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_javascript</span>(<span class="ruby-identifier">javascript</span>)
|
124
|
+
8: (<span class="ruby-identifier">javascript</span> <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'\\'</span>,<span class="ruby-value str">'\0\0'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'</'</span>,<span class="ruby-value str">'<\/'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\r\n|\n|\r/</span>, <span class="ruby-value str">"\\n"</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/["']/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-node">"\\#{m}"</span> }
|
125
|
+
9: <span class="ruby-keyword kw">end</span>
|
126
|
+
</pre>
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
|
131
|
+
|
132
|
+
</div>
|
133
|
+
|
134
|
+
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
<div id="validator-badges">
|
139
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
</body>
|
143
|
+
</html>
|