mack-javascript 0.7.1 → 0.7.1.1
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.
- data/lib/mack-javascript.rb +4 -0
- data/lib/mack-javascript/helpers/jquery_helper.rb +6 -6
- data/lib/mack-javascript/helpers/script_generator.rb +4 -1
- data/lib/mack-javascript/view_helpers/html_helpers.rb +8 -4
- metadata +2 -30
- data/doc/classes/JavascriptGenerator.html +0 -162
- data/doc/classes/Mack.html +0 -133
- data/doc/classes/Mack/JavaScript/Framework/Jquery.html +0 -491
- data/doc/classes/Mack/JavaScript/Framework/Prototype.html +0 -438
- data/doc/classes/Mack/JavaScript/ScriptGenerator.html +0 -367
- data/doc/classes/Mack/Rendering/Engine/Rjs.html +0 -185
- data/doc/classes/Mack/Rendering/Engine/Rjs/ViewTemplateHelpers.html +0 -140
- data/doc/classes/Mack/Rendering/Type/Js.html +0 -180
- data/doc/classes/Mack/Testing/Helpers.html +0 -144
- data/doc/classes/Mack/ViewHelpers/HtmlHelpers.html +0 -240
- data/doc/classes/Mack/ViewHelpers/StringHelpers.html +0 -143
- data/doc/created.rid +0 -1
- data/doc/files/README.html +0 -111
- data/doc/files/lib/mack-javascript/generators/javascript_generator_rb.html +0 -113
- data/doc/files/lib/mack-javascript/helpers/jquery_helper_rb.html +0 -101
- data/doc/files/lib/mack-javascript/helpers/prototype_helper_rb.html +0 -101
- data/doc/files/lib/mack-javascript/helpers/script_generator_rb.html +0 -101
- data/doc/files/lib/mack-javascript/helpers/testing_helpers_rb.html +0 -101
- data/doc/files/lib/mack-javascript/rendering/engine/rjs_rb.html +0 -101
- data/doc/files/lib/mack-javascript/rendering/type/js_rb.html +0 -101
- data/doc/files/lib/mack-javascript/view_helpers/html_helpers_rb.html +0 -101
- data/doc/files/lib/mack-javascript/view_helpers/string_helpers_rb.html +0 -101
- data/doc/files/lib/mack-javascript_rb.html +0 -107
- data/doc/fr_class_index.html +0 -37
- data/doc/fr_file_index.html +0 -37
- data/doc/fr_method_index.html +0 -69
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
data/lib/mack-javascript.rb
CHANGED
@@ -7,7 +7,7 @@ module Mack
|
|
7
7
|
insertion = position.to_s.downcase
|
8
8
|
insertion = 'append' if insertion == 'bottom'
|
9
9
|
insertion = 'prepend' if insertion == 'top'
|
10
|
-
"$(\
|
10
|
+
"$(\'##{id}\').#{insertion}('#{html}')"
|
11
11
|
end
|
12
12
|
|
13
13
|
def replace_html(id, html)
|
@@ -15,23 +15,23 @@ module Mack
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def replace(id, html)
|
18
|
-
"$(\
|
18
|
+
"$(\'##{id}\').replaceWith('#{html}')"
|
19
19
|
end
|
20
20
|
|
21
21
|
def remove(*ids)
|
22
|
-
"$(\
|
22
|
+
"$(\'##{ids.join(',#')}\').remove()"
|
23
23
|
end
|
24
24
|
|
25
25
|
def show(*ids)
|
26
|
-
"$(\
|
26
|
+
"$(\'##{ids.join(',#')}\').show()"
|
27
27
|
end
|
28
28
|
|
29
29
|
def hide(*ids)
|
30
|
-
"$(\
|
30
|
+
"$(\'##{ids.join(',#')}\').hide()"
|
31
31
|
end
|
32
32
|
|
33
33
|
def toggle(*ids)
|
34
|
-
"$(\
|
34
|
+
"$(\'##{ids.join(',#')}\').toggle()"
|
35
35
|
end
|
36
36
|
|
37
37
|
|
@@ -39,10 +39,13 @@ module Mack
|
|
39
39
|
class << self
|
40
40
|
|
41
41
|
def framework
|
42
|
-
|
42
|
+
ivar_cache('framework_constant') do
|
43
|
+
"Mack::JavaScript::Framework::#{framework_name}".constantize
|
44
|
+
end
|
43
45
|
end
|
44
46
|
|
45
47
|
def framework=(args)
|
48
|
+
@framework_constant = nil
|
46
49
|
@@framework_name = args.camelcase
|
47
50
|
end
|
48
51
|
|
@@ -15,9 +15,9 @@ module Mack
|
|
15
15
|
# $('my_hidden_div').show();
|
16
16
|
# </script>
|
17
17
|
def update_page(&block)
|
18
|
-
|
19
|
-
yield(
|
20
|
-
"<script type='#{Mack::Utils::MimeTypes[:js]}'>\n" +
|
18
|
+
gs = js
|
19
|
+
yield(gs)
|
20
|
+
"<script type='#{Mack::Utils::MimeTypes[:js]}'>\n" + gs.to_s.gsub(';', ";\n") + "</script>"
|
21
21
|
end
|
22
22
|
|
23
23
|
def link_to_remote(link_text, ajax_options, options = {})
|
@@ -27,7 +27,7 @@ module Mack
|
|
27
27
|
def link_to_function(link_text, *args, &block)
|
28
28
|
function = args[0] || ''
|
29
29
|
options = args[1] || {}
|
30
|
-
function = yield(
|
30
|
+
function = yield(js).chop if block_given?
|
31
31
|
options[:onclick] = (options[:onclick] ? "#{options[:onclick]}; " : "") + "#{function}; return false;"
|
32
32
|
link_to(link_text, '#', options)
|
33
33
|
end
|
@@ -37,6 +37,10 @@ module Mack
|
|
37
37
|
Mack::JavaScript::ScriptGenerator.framework.remote_function(options)
|
38
38
|
end
|
39
39
|
|
40
|
+
def js
|
41
|
+
Mack::JavaScript::ScriptGenerator.new
|
42
|
+
end
|
43
|
+
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mack-javascript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.1
|
4
|
+
version: 0.7.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerardo Pis-Lopez
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-14 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -50,34 +50,6 @@ files:
|
|
50
50
|
- lib/mack-javascript/view_helpers/string_helpers.rb
|
51
51
|
- lib/mack-javascript.rb
|
52
52
|
- README
|
53
|
-
- doc/classes/JavascriptGenerator.html
|
54
|
-
- doc/classes/Mack/JavaScript/Framework/Jquery.html
|
55
|
-
- doc/classes/Mack/JavaScript/Framework/Prototype.html
|
56
|
-
- doc/classes/Mack/JavaScript/ScriptGenerator.html
|
57
|
-
- doc/classes/Mack/Rendering/Engine/Rjs/ViewTemplateHelpers.html
|
58
|
-
- doc/classes/Mack/Rendering/Engine/Rjs.html
|
59
|
-
- doc/classes/Mack/Rendering/Type/Js.html
|
60
|
-
- doc/classes/Mack/Testing/Helpers.html
|
61
|
-
- doc/classes/Mack/ViewHelpers/HtmlHelpers.html
|
62
|
-
- doc/classes/Mack/ViewHelpers/StringHelpers.html
|
63
|
-
- doc/classes/Mack.html
|
64
|
-
- doc/created.rid
|
65
|
-
- doc/files/lib/mack-javascript/generators/javascript_generator_rb.html
|
66
|
-
- doc/files/lib/mack-javascript/helpers/jquery_helper_rb.html
|
67
|
-
- doc/files/lib/mack-javascript/helpers/prototype_helper_rb.html
|
68
|
-
- doc/files/lib/mack-javascript/helpers/script_generator_rb.html
|
69
|
-
- doc/files/lib/mack-javascript/helpers/testing_helpers_rb.html
|
70
|
-
- doc/files/lib/mack-javascript/rendering/engine/rjs_rb.html
|
71
|
-
- doc/files/lib/mack-javascript/rendering/type/js_rb.html
|
72
|
-
- doc/files/lib/mack-javascript/view_helpers/html_helpers_rb.html
|
73
|
-
- doc/files/lib/mack-javascript/view_helpers/string_helpers_rb.html
|
74
|
-
- doc/files/lib/mack-javascript_rb.html
|
75
|
-
- doc/files/README.html
|
76
|
-
- doc/fr_class_index.html
|
77
|
-
- doc/fr_file_index.html
|
78
|
-
- doc/fr_method_index.html
|
79
|
-
- doc/index.html
|
80
|
-
- doc/rdoc-style.css
|
81
53
|
has_rdoc: true
|
82
54
|
homepage: http://www.mackframework.com
|
83
55
|
post_install_message:
|
@@ -1,162 +0,0 @@
|
|
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>Class: JavascriptGenerator</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>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">JavascriptGenerator</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/mack-javascript/generators/javascript_generator_rb.html">
|
59
|
-
lib/mack-javascript/generators/javascript_generator.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Genosaurus
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
<div id="description">
|
82
|
-
<p>
|
83
|
-
This will generate required RJS support in your application.
|
84
|
-
</p>
|
85
|
-
<p>
|
86
|
-
example:
|
87
|
-
</p>
|
88
|
-
<pre>
|
89
|
-
rake generate:javascript
|
90
|
-
</pre>
|
91
|
-
|
92
|
-
</div>
|
93
|
-
|
94
|
-
|
95
|
-
</div>
|
96
|
-
|
97
|
-
<div id="method-list">
|
98
|
-
<h3 class="section-bar">Methods</h3>
|
99
|
-
|
100
|
-
<div class="name-list">
|
101
|
-
<a href="#M000001">setup</a>
|
102
|
-
</div>
|
103
|
-
</div>
|
104
|
-
|
105
|
-
</div>
|
106
|
-
|
107
|
-
|
108
|
-
<!-- if includes -->
|
109
|
-
|
110
|
-
<div id="section">
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
<!-- if method_list -->
|
120
|
-
<div id="methods">
|
121
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
122
|
-
|
123
|
-
<div id="method-M000001" class="method-detail">
|
124
|
-
<a name="M000001"></a>
|
125
|
-
|
126
|
-
<div class="method-heading">
|
127
|
-
<a href="#M000001" class="method-signature">
|
128
|
-
<span class="method-name">setup</span><span class="method-args">()</span>
|
129
|
-
</a>
|
130
|
-
</div>
|
131
|
-
|
132
|
-
<div class="method-description">
|
133
|
-
<p><a class="source-toggle" href="#"
|
134
|
-
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
135
|
-
<div class="method-source-code" id="M000001-source">
|
136
|
-
<pre>
|
137
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/generators/javascript_generator.rb, line 8</span>
|
138
|
-
8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
|
139
|
-
9: <span class="ruby-identifier">error</span> = <span class="ruby-value str">%{ 'js_framework' is not specified in your app_config/default.yml file.
|
140
|
-
10: To fix this error, please open your {PROJ}/config/app_config/default.yml file, then uncomment
|
141
|
-
11: the line that says "# js_framework: jquery" (or prototype, if you specified prototype as the js framework).
|
142
|
-
12: Once you have uncomment that line, please re-run 'rake generate:javascript' again. Thanks!}</span>
|
143
|
-
13: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">error</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">app_config</span>.<span class="ruby-identifier">mack</span>.<span class="ruby-identifier">js_framework</span>
|
144
|
-
14: <span class="ruby-keyword kw">end</span>
|
145
|
-
</pre>
|
146
|
-
</div>
|
147
|
-
</div>
|
148
|
-
</div>
|
149
|
-
|
150
|
-
|
151
|
-
</div>
|
152
|
-
|
153
|
-
|
154
|
-
</div>
|
155
|
-
|
156
|
-
|
157
|
-
<div id="validator-badges">
|
158
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
159
|
-
</div>
|
160
|
-
|
161
|
-
</body>
|
162
|
-
</html>
|
data/doc/classes/Mack.html
DELETED
@@ -1,133 +0,0 @@
|
|
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</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</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/jquery_helper_rb.html">
|
59
|
-
lib/mack-javascript/helpers/jquery_helper.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
<a href="../files/lib/mack-javascript/helpers/prototype_helper_rb.html">
|
63
|
-
lib/mack-javascript/helpers/prototype_helper.rb
|
64
|
-
</a>
|
65
|
-
<br />
|
66
|
-
<a href="../files/lib/mack-javascript/helpers/script_generator_rb.html">
|
67
|
-
lib/mack-javascript/helpers/script_generator.rb
|
68
|
-
</a>
|
69
|
-
<br />
|
70
|
-
<a href="../files/lib/mack-javascript/helpers/testing_helpers_rb.html">
|
71
|
-
lib/mack-javascript/helpers/testing_helpers.rb
|
72
|
-
</a>
|
73
|
-
<br />
|
74
|
-
<a href="../files/lib/mack-javascript/rendering/engine/rjs_rb.html">
|
75
|
-
lib/mack-javascript/rendering/engine/rjs.rb
|
76
|
-
</a>
|
77
|
-
<br />
|
78
|
-
<a href="../files/lib/mack-javascript/rendering/type/js_rb.html">
|
79
|
-
lib/mack-javascript/rendering/type/js.rb
|
80
|
-
</a>
|
81
|
-
<br />
|
82
|
-
<a href="../files/lib/mack-javascript/view_helpers/html_helpers_rb.html">
|
83
|
-
lib/mack-javascript/view_helpers/html_helpers.rb
|
84
|
-
</a>
|
85
|
-
<br />
|
86
|
-
<a href="../files/lib/mack-javascript/view_helpers/string_helpers_rb.html">
|
87
|
-
lib/mack-javascript/view_helpers/string_helpers.rb
|
88
|
-
</a>
|
89
|
-
<br />
|
90
|
-
</td>
|
91
|
-
</tr>
|
92
|
-
|
93
|
-
</table>
|
94
|
-
</div>
|
95
|
-
<!-- banner header -->
|
96
|
-
|
97
|
-
<div id="bodyContent">
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
<div id="contextContent">
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
</div>
|
106
|
-
|
107
|
-
|
108
|
-
</div>
|
109
|
-
|
110
|
-
|
111
|
-
<!-- if includes -->
|
112
|
-
|
113
|
-
<div id="section">
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
<!-- if method_list -->
|
123
|
-
|
124
|
-
|
125
|
-
</div>
|
126
|
-
|
127
|
-
|
128
|
-
<div id="validator-badges">
|
129
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
130
|
-
</div>
|
131
|
-
|
132
|
-
</body>
|
133
|
-
</html>
|
@@ -1,491 +0,0 @@
|
|
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>Class: Mack::JavaScript::Framework::Jquery</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>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Mack::JavaScript::Framework::Jquery</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/jquery_helper_rb.html">
|
59
|
-
lib/mack-javascript/helpers/jquery_helper.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Object
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
</div>
|
84
|
-
|
85
|
-
<div id="method-list">
|
86
|
-
<h3 class="section-bar">Methods</h3>
|
87
|
-
|
88
|
-
<div class="name-list">
|
89
|
-
<a href="#M000021">build_callbacks</a>
|
90
|
-
<a href="#M000022">build_update</a>
|
91
|
-
<a href="#M000016">hide</a>
|
92
|
-
<a href="#M000011">insert_html</a>
|
93
|
-
<a href="#M000019">options_for_ajax</a>
|
94
|
-
<a href="#M000020">options_for_javascript</a>
|
95
|
-
<a href="#M000018">remote_function</a>
|
96
|
-
<a href="#M000014">remove</a>
|
97
|
-
<a href="#M000013">replace</a>
|
98
|
-
<a href="#M000012">replace_html</a>
|
99
|
-
<a href="#M000015">show</a>
|
100
|
-
<a href="#M000017">toggle</a>
|
101
|
-
</div>
|
102
|
-
</div>
|
103
|
-
|
104
|
-
</div>
|
105
|
-
|
106
|
-
|
107
|
-
<!-- if includes -->
|
108
|
-
|
109
|
-
<div id="section">
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
<!-- if method_list -->
|
119
|
-
<div id="methods">
|
120
|
-
<h3 class="section-bar">Public Class methods</h3>
|
121
|
-
|
122
|
-
<div id="method-M000016" class="method-detail">
|
123
|
-
<a name="M000016"></a>
|
124
|
-
|
125
|
-
<div class="method-heading">
|
126
|
-
<a href="#M000016" class="method-signature">
|
127
|
-
<span class="method-name">hide</span><span class="method-args">(*ids)</span>
|
128
|
-
</a>
|
129
|
-
</div>
|
130
|
-
|
131
|
-
<div class="method-description">
|
132
|
-
<p><a class="source-toggle" href="#"
|
133
|
-
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
134
|
-
<div class="method-source-code" id="M000016-source">
|
135
|
-
<pre>
|
136
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/jquery_helper.rb, line 29</span>
|
137
|
-
29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hide</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">ids</span>)
|
138
|
-
30: <span class="ruby-node">"$(\"##{ids.join(',#')}\").hide()"</span>
|
139
|
-
31: <span class="ruby-keyword kw">end</span>
|
140
|
-
</pre>
|
141
|
-
</div>
|
142
|
-
</div>
|
143
|
-
</div>
|
144
|
-
|
145
|
-
<div id="method-M000011" class="method-detail">
|
146
|
-
<a name="M000011"></a>
|
147
|
-
|
148
|
-
<div class="method-heading">
|
149
|
-
<a href="#M000011" class="method-signature">
|
150
|
-
<span class="method-name">insert_html</span><span class="method-args">(position, id, html)</span>
|
151
|
-
</a>
|
152
|
-
</div>
|
153
|
-
|
154
|
-
<div class="method-description">
|
155
|
-
<p><a class="source-toggle" href="#"
|
156
|
-
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
157
|
-
<div class="method-source-code" id="M000011-source">
|
158
|
-
<pre>
|
159
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/jquery_helper.rb, line 6</span>
|
160
|
-
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">insert_html</span>(<span class="ruby-identifier">position</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">html</span>)
|
161
|
-
7: <span class="ruby-identifier">insertion</span> = <span class="ruby-identifier">position</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>
|
162
|
-
8: <span class="ruby-identifier">insertion</span> = <span class="ruby-value str">'append'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">insertion</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'bottom'</span>
|
163
|
-
9: <span class="ruby-identifier">insertion</span> = <span class="ruby-value str">'prepend'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">insertion</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'top'</span>
|
164
|
-
10: <span class="ruby-node">"$(\"##{id}\").#{insertion}('#{html}')"</span>
|
165
|
-
11: <span class="ruby-keyword kw">end</span>
|
166
|
-
</pre>
|
167
|
-
</div>
|
168
|
-
</div>
|
169
|
-
</div>
|
170
|
-
|
171
|
-
<div id="method-M000018" class="method-detail">
|
172
|
-
<a name="M000018"></a>
|
173
|
-
|
174
|
-
<div class="method-heading">
|
175
|
-
<a href="#M000018" class="method-signature">
|
176
|
-
<span class="method-name">remote_function</span><span class="method-args">(options)</span>
|
177
|
-
</a>
|
178
|
-
</div>
|
179
|
-
|
180
|
-
<div class="method-description">
|
181
|
-
<p>
|
182
|
-
def draggable(id, options = {})
|
183
|
-
</p>
|
184
|
-
<pre>
|
185
|
-
record @context.send(:draggable_element_js, id, options)
|
186
|
-
</pre>
|
187
|
-
<p>
|
188
|
-
end
|
189
|
-
</p>
|
190
|
-
<p>
|
191
|
-
def visual_effect(name, id = nil, options = {})
|
192
|
-
</p>
|
193
|
-
<pre>
|
194
|
-
record @context.send(:visual_effect, name, id, options)
|
195
|
-
</pre>
|
196
|
-
<p>
|
197
|
-
end
|
198
|
-
</p>
|
199
|
-
<p>
|
200
|
-
def drop_receiving(id, options = {})
|
201
|
-
</p>
|
202
|
-
<pre>
|
203
|
-
record @context.send(:drop_receiving_element_js, id, options)
|
204
|
-
</pre>
|
205
|
-
<p>
|
206
|
-
end
|
207
|
-
</p>
|
208
|
-
<p><a class="source-toggle" href="#"
|
209
|
-
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
210
|
-
<div class="method-source-code" id="M000018-source">
|
211
|
-
<pre>
|
212
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/jquery_helper.rb, line 50</span>
|
213
|
-
50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remote_function</span>(<span class="ruby-identifier">options</span>)
|
214
|
-
51: <span class="ruby-identifier">javascript_options</span> = <span class="ruby-identifier">options_for_ajax</span>(<span class="ruby-identifier">options</span>)
|
215
|
-
52: <span class="ruby-identifier">update</span> = <span class="ruby-value str">''</span>
|
216
|
-
53: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:update</span>] <span class="ruby-operator">&&</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:update</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
|
217
|
-
54: <span class="ruby-identifier">update</span> = []
|
218
|
-
55: <span class="ruby-identifier">update</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"success:'#{options[:update][:success]}'"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:update</span>][<span class="ruby-identifier">:success</span>]
|
219
|
-
56: <span class="ruby-identifier">update</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"failure:'#{options[:update][:failure]}'"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:update</span>][<span class="ruby-identifier">:failure</span>]
|
220
|
-
57: <span class="ruby-identifier">update</span> = <span class="ruby-value str">'{'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">update</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">','</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'}'</span>
|
221
|
-
58: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:update</span>]
|
222
|
-
59: <span class="ruby-identifier">update</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"'#{options[:update]}'"</span>
|
223
|
-
60: <span class="ruby-keyword kw">end</span>
|
224
|
-
61:
|
225
|
-
62: <span class="ruby-identifier">function</span> = <span class="ruby-node">"$.ajax(#{javascript_options})"</span>
|
226
|
-
63:
|
227
|
-
64: <span class="ruby-identifier">function</span> = <span class="ruby-node">"#{options[:before]}; #{function}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:before</span>]
|
228
|
-
65: <span class="ruby-identifier">function</span> = <span class="ruby-node">"#{function}; #{options[:after]}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:after</span>]
|
229
|
-
66: <span class="ruby-identifier">function</span> = <span class="ruby-node">"if (#{options[:condition]}) { #{function}; }"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:condition</span>]
|
230
|
-
67: <span class="ruby-identifier">function</span> = <span class="ruby-node">"if (confirm('#{escape_javascript(options[:confirm])}')) { #{function}; }"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:confirm</span>]
|
231
|
-
68: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">function</span>
|
232
|
-
69: <span class="ruby-keyword kw">end</span>
|
233
|
-
</pre>
|
234
|
-
</div>
|
235
|
-
</div>
|
236
|
-
</div>
|
237
|
-
|
238
|
-
<div id="method-M000014" class="method-detail">
|
239
|
-
<a name="M000014"></a>
|
240
|
-
|
241
|
-
<div class="method-heading">
|
242
|
-
<a href="#M000014" class="method-signature">
|
243
|
-
<span class="method-name">remove</span><span class="method-args">(*ids)</span>
|
244
|
-
</a>
|
245
|
-
</div>
|
246
|
-
|
247
|
-
<div class="method-description">
|
248
|
-
<p><a class="source-toggle" href="#"
|
249
|
-
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
250
|
-
<div class="method-source-code" id="M000014-source">
|
251
|
-
<pre>
|
252
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/jquery_helper.rb, line 21</span>
|
253
|
-
21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">ids</span>)
|
254
|
-
22: <span class="ruby-node">"$(\"##{ids.join(',#')}\").remove()"</span>
|
255
|
-
23: <span class="ruby-keyword kw">end</span>
|
256
|
-
</pre>
|
257
|
-
</div>
|
258
|
-
</div>
|
259
|
-
</div>
|
260
|
-
|
261
|
-
<div id="method-M000013" class="method-detail">
|
262
|
-
<a name="M000013"></a>
|
263
|
-
|
264
|
-
<div class="method-heading">
|
265
|
-
<a href="#M000013" class="method-signature">
|
266
|
-
<span class="method-name">replace</span><span class="method-args">(id, html)</span>
|
267
|
-
</a>
|
268
|
-
</div>
|
269
|
-
|
270
|
-
<div class="method-description">
|
271
|
-
<p><a class="source-toggle" href="#"
|
272
|
-
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
273
|
-
<div class="method-source-code" id="M000013-source">
|
274
|
-
<pre>
|
275
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/jquery_helper.rb, line 17</span>
|
276
|
-
17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">replace</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">html</span>)
|
277
|
-
18: <span class="ruby-node">"$(\"##{id}\").replaceWith('#{html}')"</span>
|
278
|
-
19: <span class="ruby-keyword kw">end</span>
|
279
|
-
</pre>
|
280
|
-
</div>
|
281
|
-
</div>
|
282
|
-
</div>
|
283
|
-
|
284
|
-
<div id="method-M000012" class="method-detail">
|
285
|
-
<a name="M000012"></a>
|
286
|
-
|
287
|
-
<div class="method-heading">
|
288
|
-
<a href="#M000012" class="method-signature">
|
289
|
-
<span class="method-name">replace_html</span><span class="method-args">(id, html)</span>
|
290
|
-
</a>
|
291
|
-
</div>
|
292
|
-
|
293
|
-
<div class="method-description">
|
294
|
-
<p><a class="source-toggle" href="#"
|
295
|
-
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
296
|
-
<div class="method-source-code" id="M000012-source">
|
297
|
-
<pre>
|
298
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/jquery_helper.rb, line 13</span>
|
299
|
-
13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">replace_html</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">html</span>)
|
300
|
-
14: <span class="ruby-identifier">insert_html</span>(<span class="ruby-identifier">:html</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">html</span>)
|
301
|
-
15: <span class="ruby-keyword kw">end</span>
|
302
|
-
</pre>
|
303
|
-
</div>
|
304
|
-
</div>
|
305
|
-
</div>
|
306
|
-
|
307
|
-
<div id="method-M000015" class="method-detail">
|
308
|
-
<a name="M000015"></a>
|
309
|
-
|
310
|
-
<div class="method-heading">
|
311
|
-
<a href="#M000015" class="method-signature">
|
312
|
-
<span class="method-name">show</span><span class="method-args">(*ids)</span>
|
313
|
-
</a>
|
314
|
-
</div>
|
315
|
-
|
316
|
-
<div class="method-description">
|
317
|
-
<p><a class="source-toggle" href="#"
|
318
|
-
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
319
|
-
<div class="method-source-code" id="M000015-source">
|
320
|
-
<pre>
|
321
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/jquery_helper.rb, line 25</span>
|
322
|
-
25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">ids</span>)
|
323
|
-
26: <span class="ruby-node">"$(\"##{ids.join(',#')}\").show()"</span>
|
324
|
-
27: <span class="ruby-keyword kw">end</span>
|
325
|
-
</pre>
|
326
|
-
</div>
|
327
|
-
</div>
|
328
|
-
</div>
|
329
|
-
|
330
|
-
<div id="method-M000017" class="method-detail">
|
331
|
-
<a name="M000017"></a>
|
332
|
-
|
333
|
-
<div class="method-heading">
|
334
|
-
<a href="#M000017" class="method-signature">
|
335
|
-
<span class="method-name">toggle</span><span class="method-args">(*ids)</span>
|
336
|
-
</a>
|
337
|
-
</div>
|
338
|
-
|
339
|
-
<div class="method-description">
|
340
|
-
<p><a class="source-toggle" href="#"
|
341
|
-
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
342
|
-
<div class="method-source-code" id="M000017-source">
|
343
|
-
<pre>
|
344
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/jquery_helper.rb, line 33</span>
|
345
|
-
33: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">toggle</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">ids</span>)
|
346
|
-
34: <span class="ruby-node">"$(\"##{ids.join(',#')}\").toggle()"</span>
|
347
|
-
35: <span class="ruby-keyword kw">end</span>
|
348
|
-
</pre>
|
349
|
-
</div>
|
350
|
-
</div>
|
351
|
-
</div>
|
352
|
-
|
353
|
-
<h3 class="section-bar">Protected Class methods</h3>
|
354
|
-
|
355
|
-
<div id="method-M000021" class="method-detail">
|
356
|
-
<a name="M000021"></a>
|
357
|
-
|
358
|
-
<div class="method-heading">
|
359
|
-
<a href="#M000021" class="method-signature">
|
360
|
-
<span class="method-name">build_callbacks</span><span class="method-args">(options)</span>
|
361
|
-
</a>
|
362
|
-
</div>
|
363
|
-
|
364
|
-
<div class="method-description">
|
365
|
-
<p><a class="source-toggle" href="#"
|
366
|
-
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
367
|
-
<div class="method-source-code" id="M000021-source">
|
368
|
-
<pre>
|
369
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/jquery_helper.rb, line 93</span>
|
370
|
-
93: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_callbacks</span>(<span class="ruby-identifier">options</span>)
|
371
|
-
94: <span class="ruby-identifier">callbacks</span> = {}
|
372
|
-
95: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:beforeSend</span>] = <span class="ruby-value str">''</span>;
|
373
|
-
96: [<span class="ruby-identifier">:uninitialized</span>,<span class="ruby-identifier">:loading</span>,<span class="ruby-identifier">:loaded</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
374
|
-
97: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:beforeSend</span>] <span class="ruby-operator"><<</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">key</span>].<span class="ruby-identifier">last</span> <span class="ruby-operator">==</span> <span class="ruby-value str">';'</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>) <span class="ruby-operator"><<</span> <span class="ruby-value str">';'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">key</span>]
|
375
|
-
98: <span class="ruby-keyword kw">end</span>
|
376
|
-
99: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:beforeSend</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:beforeSend</span>].<span class="ruby-identifier">blank?</span>
|
377
|
-
100: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:error</span>] = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:failure</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:failure</span>]
|
378
|
-
101: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:update</span>]
|
379
|
-
102: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:success</span>] = <span class="ruby-identifier">build_update</span>(<span class="ruby-identifier">options</span>) <span class="ruby-operator"><<</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:success</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:success</span>] <span class="ruby-operator">:</span> <span class="ruby-value str">''</span>)
|
380
|
-
103: <span class="ruby-keyword kw">end</span>
|
381
|
-
104: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">callback</span>, <span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
|
382
|
-
105: <span class="ruby-keyword kw">if</span> [<span class="ruby-identifier">:beforeSend</span>, <span class="ruby-identifier">:complete</span>, <span class="ruby-identifier">:error</span>, <span class="ruby-identifier">:success</span> ].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">callback</span>)
|
383
|
-
106: <span class="ruby-identifier">callbacks</span>[<span class="ruby-identifier">callback</span>] = <span class="ruby-node">"function(request){#{code}}"</span>
|
384
|
-
107: <span class="ruby-keyword kw">end</span>
|
385
|
-
108: <span class="ruby-keyword kw">end</span>
|
386
|
-
109: <span class="ruby-identifier">callbacks</span>
|
387
|
-
110: <span class="ruby-keyword kw">end</span>
|
388
|
-
</pre>
|
389
|
-
</div>
|
390
|
-
</div>
|
391
|
-
</div>
|
392
|
-
|
393
|
-
<div id="method-M000022" class="method-detail">
|
394
|
-
<a name="M000022"></a>
|
395
|
-
|
396
|
-
<div class="method-heading">
|
397
|
-
<a href="#M000022" class="method-signature">
|
398
|
-
<span class="method-name">build_update</span><span class="method-args">(options)</span>
|
399
|
-
</a>
|
400
|
-
</div>
|
401
|
-
|
402
|
-
<div class="method-description">
|
403
|
-
<p><a class="source-toggle" href="#"
|
404
|
-
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
405
|
-
<div class="method-source-code" id="M000022-source">
|
406
|
-
<pre>
|
407
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/jquery_helper.rb, line 112</span>
|
408
|
-
112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_update</span>(<span class="ruby-identifier">options</span>)
|
409
|
-
113: <span class="ruby-identifier">insertion</span> = <span class="ruby-value str">'html'</span>
|
410
|
-
114: <span class="ruby-identifier">insertion</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:position</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:position</span>]
|
411
|
-
115: <span class="ruby-identifier">insertion</span> = <span class="ruby-value str">'append'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">insertion</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'bottom'</span>
|
412
|
-
116: <span class="ruby-identifier">insertion</span> = <span class="ruby-value str">'prepend'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">insertion</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'top'</span>
|
413
|
-
117: <span class="ruby-node">"$('##{options[:update]}').#{insertion}(request);"</span>
|
414
|
-
118: <span class="ruby-keyword kw">end</span>
|
415
|
-
</pre>
|
416
|
-
</div>
|
417
|
-
</div>
|
418
|
-
</div>
|
419
|
-
|
420
|
-
<div id="method-M000019" class="method-detail">
|
421
|
-
<a name="M000019"></a>
|
422
|
-
|
423
|
-
<div class="method-heading">
|
424
|
-
<a href="#M000019" class="method-signature">
|
425
|
-
<span class="method-name">options_for_ajax</span><span class="method-args">(options)</span>
|
426
|
-
</a>
|
427
|
-
</div>
|
428
|
-
|
429
|
-
<div class="method-description">
|
430
|
-
<p><a class="source-toggle" href="#"
|
431
|
-
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
432
|
-
<div class="method-source-code" id="M000019-source">
|
433
|
-
<pre>
|
434
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/jquery_helper.rb, line 72</span>
|
435
|
-
72: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">options_for_ajax</span>(<span class="ruby-identifier">options</span>)
|
436
|
-
73: <span class="ruby-identifier">js_options</span> = <span class="ruby-identifier">build_callbacks</span>(<span class="ruby-identifier">options</span>)
|
437
|
-
74: <span class="ruby-identifier">js_options</span>[<span class="ruby-value str">'url'</span>] = <span class="ruby-node">"'#{options[:url]}'"</span>
|
438
|
-
75: <span class="ruby-identifier">js_options</span>[<span class="ruby-value str">'async'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:type</span>] <span class="ruby-operator">!=</span> <span class="ruby-identifier">:synchronous</span>
|
439
|
-
76: <span class="ruby-identifier">js_options</span>[<span class="ruby-value str">'type'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:method</span>] <span class="ruby-operator">?</span> <span class="ruby-node">"'#{options[:method]}'"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">"'post'"</span>
|
440
|
-
77: <span class="ruby-identifier">js_options</span>[<span class="ruby-value str">'dataType'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:datatype</span>] <span class="ruby-operator">?</span> <span class="ruby-node">"'#{options[:datatype]}'"</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:update</span>] <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-value str">"'script'"</span>)
|
441
|
-
78:
|
442
|
-
79: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:form</span>]
|
443
|
-
80: <span class="ruby-identifier">js_options</span>[<span class="ruby-value str">'data'</span>] = <span class="ruby-value str">"$.param($(this).serializeArray())"</span>
|
444
|
-
81: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:submit</span>]
|
445
|
-
82: <span class="ruby-identifier">js_options</span>[<span class="ruby-value str">'data'</span>] = <span class="ruby-node">"$(\"##{options[:submit]}\").serializeArray()"</span>
|
446
|
-
83: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:with</span>]
|
447
|
-
84: <span class="ruby-identifier">js_options</span>[<span class="ruby-value str">'data'</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:with</span>].<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'Form.serialize(this.form)'</span>,<span class="ruby-value str">'$.param($(this.form).serializeArray())'</span>)
|
448
|
-
85: <span class="ruby-keyword kw">end</span>
|
449
|
-
86: <span class="ruby-identifier">options_for_javascript</span>(<span class="ruby-identifier">js_options</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>})
|
450
|
-
87: <span class="ruby-keyword kw">end</span>
|
451
|
-
</pre>
|
452
|
-
</div>
|
453
|
-
</div>
|
454
|
-
</div>
|
455
|
-
|
456
|
-
<div id="method-M000020" class="method-detail">
|
457
|
-
<a name="M000020"></a>
|
458
|
-
|
459
|
-
<div class="method-heading">
|
460
|
-
<a href="#M000020" class="method-signature">
|
461
|
-
<span class="method-name">options_for_javascript</span><span class="method-args">(options)</span>
|
462
|
-
</a>
|
463
|
-
</div>
|
464
|
-
|
465
|
-
<div class="method-description">
|
466
|
-
<p><a class="source-toggle" href="#"
|
467
|
-
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
468
|
-
<div class="method-source-code" id="M000020-source">
|
469
|
-
<pre>
|
470
|
-
<span class="ruby-comment cmt"># File lib/mack-javascript/helpers/jquery_helper.rb, line 89</span>
|
471
|
-
89: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">options_for_javascript</span>(<span class="ruby-identifier">options</span>)
|
472
|
-
90: <span class="ruby-value str">'{'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-node">"#{k}:#{v}"</span>}.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">', '</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'}'</span>
|
473
|
-
91: <span class="ruby-keyword kw">end</span>
|
474
|
-
</pre>
|
475
|
-
</div>
|
476
|
-
</div>
|
477
|
-
</div>
|
478
|
-
|
479
|
-
|
480
|
-
</div>
|
481
|
-
|
482
|
-
|
483
|
-
</div>
|
484
|
-
|
485
|
-
|
486
|
-
<div id="validator-badges">
|
487
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
488
|
-
</div>
|
489
|
-
|
490
|
-
</body>
|
491
|
-
</html>
|