bivouac 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -7
- data/bin/bivouac +1 -1
- data/doc/rdoc/classes/BivouacHelpers/BaseView.html +178 -0
- data/doc/rdoc/classes/BivouacHelpers/FormView.html +398 -0
- data/doc/rdoc/classes/BivouacHelpers/HtmlView.html +305 -0
- data/doc/rdoc/classes/BivouacHelpers/JavaScriptView.html +573 -0
- data/doc/rdoc/classes/BivouacHelpers/ScriptAculoUsView.html +258 -0
- data/doc/rdoc/classes/BivouacHelpers/TooltipView.html +158 -0
- data/doc/rdoc/classes/BivouacHelpers.html +117 -0
- data/doc/rdoc/classes/JavaScriptGenerator.html +564 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/AUTHORS.html +109 -0
- data/doc/rdoc/files/COPYING.html +533 -0
- data/doc/rdoc/files/README.html +427 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/base_rb.html +109 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/form_rb.html +109 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/html_rb.html +109 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/javascript_rb.html +113 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/scriptaculous_rb.html +113 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/tooltip_rb.html +109 -0
- data/doc/rdoc/index.html +10 -0
- data/doc/rdoc/permalink.gif +0 -0
- data/doc/rdoc/rdoc-style.css +106 -0
- data/doc/rdoc/rubyfr.png +0 -0
- data/examples/bivouac_sample/Rakefile +48 -0
- data/examples/bivouac_sample/app/bivouac_sample.rb +15 -7
- data/examples/bivouac_sample/app/controllers/index.rb +2 -2
- data/examples/bivouac_sample/app/controllers/sound.rb +10 -0
- data/examples/bivouac_sample/app/helpers/_helpers.rb +6 -3
- data/examples/bivouac_sample/app/views/sound.rb +16 -0
- data/examples/bivouac_sample/config/environment.rb +5 -2
- data/examples/bivouac_sample/config/postamble.rb +89 -18
- data/examples/bivouac_sample/public/javascripts/builder.js +12 -7
- data/examples/bivouac_sample/public/javascripts/controls.js +485 -355
- data/examples/bivouac_sample/public/javascripts/dragdrop.js +82 -52
- data/examples/bivouac_sample/public/javascripts/effects.js +361 -329
- data/examples/bivouac_sample/public/javascripts/prototype.js +2826 -1120
- data/examples/bivouac_sample/public/javascripts/scriptaculous.js +15 -8
- data/examples/bivouac_sample/public/javascripts/slider.js +40 -43
- data/examples/bivouac_sample/public/javascripts/sound.js +55 -0
- data/examples/bivouac_sample/public/javascripts/unittest.js +16 -12
- data/examples/bivouac_sample/public/sound/sword.mp3 +0 -0
- data/examples/bivouac_sample/script/console +6 -0
- data/examples/bivouac_sample/script/plugin +3 -0
- data/examples/bivouac_sample/script/server +2 -1
- data/examples/bivouac_sample/test/test_sound.rb +15 -0
- data/lib/bivouac/helpers/view/goh/sound.rb +38 -0
- data/lib/bivouac/template/application/helpers_goh.rb +2 -0
- data/lib/bivouac/template/static/builder.js +12 -7
- data/lib/bivouac/template/static/controls.js +485 -355
- data/lib/bivouac/template/static/dragdrop.js +82 -52
- data/lib/bivouac/template/static/effects.js +361 -329
- data/lib/bivouac/template/static/prototype.js +2826 -1120
- data/lib/bivouac/template/static/scriptaculous.js +15 -8
- data/lib/bivouac/template/static/slider.js +40 -43
- data/lib/bivouac/template/static/sound.js +55 -0
- data/lib/bivouac/template/static/unittest.js +16 -12
- metadata +45 -2
@@ -0,0 +1,564 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>
|
6
|
+
Bivouac, the Documentation » Class: JavaScriptGenerator
|
7
|
+
</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
10
|
+
<script language="JavaScript" type="text/javascript">
|
11
|
+
// <![CDATA[
|
12
|
+
|
13
|
+
function toggleSource( id )
|
14
|
+
{
|
15
|
+
var elem
|
16
|
+
var link
|
17
|
+
|
18
|
+
if( document.getElementById )
|
19
|
+
{
|
20
|
+
elem = document.getElementById( id )
|
21
|
+
link = document.getElementById( "l_" + id )
|
22
|
+
}
|
23
|
+
else if ( document.all )
|
24
|
+
{
|
25
|
+
elem = eval( "document.all." + id )
|
26
|
+
link = eval( "document.all.l_" + id )
|
27
|
+
}
|
28
|
+
else
|
29
|
+
return false;
|
30
|
+
|
31
|
+
if( elem.style.display == "block" )
|
32
|
+
{
|
33
|
+
elem.style.display = "none"
|
34
|
+
link.innerHTML = "show source"
|
35
|
+
}
|
36
|
+
else
|
37
|
+
{
|
38
|
+
elem.style.display = "block"
|
39
|
+
link.innerHTML = "hide source"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
function openCode( url )
|
44
|
+
{
|
45
|
+
window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
|
46
|
+
}
|
47
|
+
// ]]>
|
48
|
+
</script>
|
49
|
+
</head>
|
50
|
+
<body>
|
51
|
+
<!--
|
52
|
+
<div id="menu">
|
53
|
+
<h3 class="title">Class: JavaScriptGenerator</h3>
|
54
|
+
</div>
|
55
|
+
-->
|
56
|
+
<div id="fullpage">
|
57
|
+
<div id="pager">
|
58
|
+
<table>
|
59
|
+
<tr><td><img src="../rubyfr.png" /></td>
|
60
|
+
<td id="pagertd">
|
61
|
+
<strong># Class: JavaScriptGenerator<br />
|
62
|
+
[
|
63
|
+
"<a href="../files/README.html" value="File: README">README</a>",
|
64
|
+
"<a href="../files/AUTHORS.html" value="File: AUTHORS">AUTHORS</a>",
|
65
|
+
"<a href="../files/COPYING.html" value="File: COPYING">COPYING</a>",
|
66
|
+
"<a href="../files/lib/bivouac/helpers/view/goh/base_rb.html" value="File: base.rb">lib/bivouac/helpers/view/goh/base.rb</a>",
|
67
|
+
"<a href="../files/lib/bivouac/helpers/view/goh/form_rb.html" value="File: form.rb">lib/bivouac/helpers/view/goh/form.rb</a>",
|
68
|
+
"<a href="../files/lib/bivouac/helpers/view/goh/html_rb.html" value="File: html.rb">lib/bivouac/helpers/view/goh/html.rb</a>",
|
69
|
+
"<a href="../files/lib/bivouac/helpers/view/goh/tooltip_rb.html" value="File: tooltip.rb">lib/bivouac/helpers/view/goh/tooltip.rb</a>",
|
70
|
+
"<a href="../files/lib/bivouac/helpers/view/goh/scriptaculous_rb.html" value="File: scriptaculous.rb">lib/bivouac/helpers/view/goh/scriptaculous.rb</a>",
|
71
|
+
"<a href="../files/lib/bivouac/helpers/view/goh/javascript_rb.html" value="File: javascript.rb">lib/bivouac/helpers/view/goh/javascript.rb</a>",
|
72
|
+
<a href="http://greg.rubyfr.net">nil</a>].each do<br />
|
73
|
+
<a href="../classes/JavaScriptGenerator.html" title="Class: JavaScriptGenerator">JavaScriptGenerator</a>.view_html<br />
|
74
|
+
<a href="../classes/BivouacHelpers.html" title="Module: BivouacHelpers">BivouacHelpers</a>.view_html<br />
|
75
|
+
<a href="../classes/BivouacHelpers/TooltipView.html" title="Module: BivouacHelpers::TooltipView">BivouacHelpers::TooltipView</a>.view_html<br />
|
76
|
+
<a href="../classes/BivouacHelpers/ScriptAculoUsView.html" title="Module: BivouacHelpers::ScriptAculoUsView">BivouacHelpers::ScriptAculoUsView</a>.view_html<br />
|
77
|
+
<a href="../classes/BivouacHelpers/BaseView.html" title="Module: BivouacHelpers::BaseView">BivouacHelpers::BaseView</a>.view_html<br />
|
78
|
+
<a href="../classes/BivouacHelpers/JavaScriptView.html" title="Module: BivouacHelpers::JavaScriptView">BivouacHelpers::JavaScriptView</a>.view_html<br />
|
79
|
+
<a href="../classes/BivouacHelpers/HtmlView.html" title="Module: BivouacHelpers::HtmlView">BivouacHelpers::HtmlView</a>.view_html<br />
|
80
|
+
<a href="../classes/BivouacHelpers/FormView.html" title="Module: BivouacHelpers::FormView">BivouacHelpers::FormView</a>.view_html<br />
|
81
|
+
end</strong>
|
82
|
+
</td></tr>
|
83
|
+
</table>
|
84
|
+
</ul>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
|
88
|
+
<div id="JavaScriptGenerator" class="page_shade">
|
89
|
+
<div class="page">
|
90
|
+
<h3>Class JavaScriptGenerator < Object</h3>
|
91
|
+
|
92
|
+
(in files
|
93
|
+
<a href="../files/lib/bivouac/helpers/view/goh/javascript_rb.html">lib/bivouac/helpers/view/goh/javascript.rb</a>
|
94
|
+
)
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<h2 class="ruled">Methods</h2>
|
101
|
+
<h4 class="ruled">Public Instance method:
|
102
|
+
<strong><a name="M000003"><<(javascript)</a></strong> <a href="#M000003"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: <<" /></a></h4>
|
103
|
+
|
104
|
+
<p>
|
105
|
+
Writes raw JavaScript to the page.
|
106
|
+
</p>
|
107
|
+
|
108
|
+
<div class="sourcecode">
|
109
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000003_source')" id="l_M000003_source">show source</a> ]</p>
|
110
|
+
<div id="M000003_source" class="dyn-source">
|
111
|
+
<pre>
|
112
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 54</span>
|
113
|
+
54: <span class="ruby-keyword kw">def</span> <span class="ruby-operator"><<</span>(<span class="ruby-identifier">javascript</span>)
|
114
|
+
55: <span class="ruby-ivar">@source</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">javascript</span>
|
115
|
+
56: <span class="ruby-keyword kw">end</span>
|
116
|
+
</pre>
|
117
|
+
</div>
|
118
|
+
</div>
|
119
|
+
<h4 class="ruled">Public Instance method:
|
120
|
+
<strong><a name="M000001">[]( id )</a></strong> <a href="#M000001"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: []" /></a></h4>
|
121
|
+
|
122
|
+
<p>
|
123
|
+
Returns a element reference by finding it through <tt>id</tt> in the DOM.
|
124
|
+
This element can then be used for further method calls. Examples:
|
125
|
+
</p>
|
126
|
+
<pre>
|
127
|
+
page['blank_slate'] # => $('blank_slate');
|
128
|
+
page['blank_slate'].show # => $('blank_slate').show();
|
129
|
+
page['blank_slate'].show('first').up # => $('blank_slate').show('first').up();
|
130
|
+
</pre>
|
131
|
+
|
132
|
+
<div class="sourcecode">
|
133
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000001_source')" id="l_M000001_source">show source</a> ]</p>
|
134
|
+
<div id="M000001_source" class="dyn-source">
|
135
|
+
<pre>
|
136
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 24</span>
|
137
|
+
24: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>( <span class="ruby-identifier">id</span> )
|
138
|
+
25: <span class="ruby-comment cmt"># JavaScriptElementProxy.new(self, id)</span>
|
139
|
+
26: <span class="ruby-keyword kw">end</span>
|
140
|
+
</pre>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
<h4 class="ruled">Public Instance method:
|
144
|
+
<strong><a name="M000004">alert(message)</a></strong> <a href="#M000004"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: alert" /></a></h4>
|
145
|
+
|
146
|
+
<p>
|
147
|
+
Displays an <a href="JavaScriptGenerator.html#M000004">alert</a> dialog
|
148
|
+
with the given <tt>message</tt>.
|
149
|
+
</p>
|
150
|
+
|
151
|
+
<div class="sourcecode">
|
152
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000004_source')" id="l_M000004_source">show source</a> ]</p>
|
153
|
+
<div id="M000004_source" class="dyn-source">
|
154
|
+
<pre>
|
155
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 59</span>
|
156
|
+
59: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alert</span>(<span class="ruby-identifier">message</span>)
|
157
|
+
60: <span class="ruby-identifier">call</span>( <span class="ruby-value str">"alert"</span>, <span class="ruby-identifier">message</span> )
|
158
|
+
61: <span class="ruby-keyword kw">end</span>
|
159
|
+
</pre>
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
<h4 class="ruled">Public Instance method:
|
163
|
+
<strong><a name="M000005">assign( variable, value )</a></strong> <a href="#M000005"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: assign" /></a></h4>
|
164
|
+
|
165
|
+
<p>
|
166
|
+
Assigns the JavaScript <tt>variable</tt> the given <tt>value</tt>.
|
167
|
+
</p>
|
168
|
+
|
169
|
+
<div class="sourcecode">
|
170
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000005_source')" id="l_M000005_source">show source</a> ]</p>
|
171
|
+
<div id="M000005_source" class="dyn-source">
|
172
|
+
<pre>
|
173
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 64</span>
|
174
|
+
64: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assign</span>( <span class="ruby-identifier">variable</span>, <span class="ruby-identifier">value</span> )
|
175
|
+
65: <span class="ruby-identifier">record</span> <span class="ruby-node">"#{variable} = #{value.inspect}"</span>
|
176
|
+
66: <span class="ruby-keyword kw">end</span>
|
177
|
+
</pre>
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
<h4 class="ruled">Public Instance method:
|
181
|
+
<strong><a name="M000010">call(function, *arguments)</a></strong> <a href="#M000010"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: call" /></a></h4>
|
182
|
+
|
183
|
+
<p>
|
184
|
+
Calls the JavaScript <tt>function</tt>, optionally with the given
|
185
|
+
<tt>arguments</tt>.
|
186
|
+
</p>
|
187
|
+
|
188
|
+
<div class="sourcecode">
|
189
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000010_source')" id="l_M000010_source">show source</a> ]</p>
|
190
|
+
<div id="M000010_source" class="dyn-source">
|
191
|
+
<pre>
|
192
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 104</span>
|
193
|
+
104: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">function</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">arguments</span>)
|
194
|
+
105: <span class="ruby-identifier">record</span> <span class="ruby-node">"#{function}(#{arguments_for_call(arguments)});\n"</span>
|
195
|
+
106: <span class="ruby-keyword kw">end</span>
|
196
|
+
</pre>
|
197
|
+
</div>
|
198
|
+
</div>
|
199
|
+
<h4 class="ruled">Public Instance method:
|
200
|
+
<strong><a name="M000020">delay(seconds = 1) {|| ...}</a></strong> <a href="#M000020"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: delay" /></a></h4>
|
201
|
+
|
202
|
+
<p>
|
203
|
+
Executes the content of the block after a <a
|
204
|
+
href="JavaScriptGenerator.html#M000020">delay</a> of <tt>seconds</tt>.
|
205
|
+
Example:
|
206
|
+
</p>
|
207
|
+
<pre>
|
208
|
+
page.delay(20) do
|
209
|
+
page.visual_effect :fade, 'notice'
|
210
|
+
end
|
211
|
+
</pre>
|
212
|
+
|
213
|
+
<div class="sourcecode">
|
214
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000020_source')" id="l_M000020_source">show source</a> ]</p>
|
215
|
+
<div id="M000020_source" class="dyn-source">
|
216
|
+
<pre>
|
217
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 175</span>
|
218
|
+
175: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delay</span>(<span class="ruby-identifier">seconds</span> = <span class="ruby-value">1</span>)
|
219
|
+
176: <span class="ruby-identifier">record</span> <span class="ruby-value str">"setTimeout(function() {\n\n"</span>
|
220
|
+
177: <span class="ruby-keyword kw">yield</span>
|
221
|
+
178: <span class="ruby-identifier">record</span> <span class="ruby-node">"}, #{(seconds * 1000).to_i})"</span>
|
222
|
+
179: <span class="ruby-keyword kw">end</span>
|
223
|
+
</pre>
|
224
|
+
</div>
|
225
|
+
</div>
|
226
|
+
<h4 class="ruled">Public Instance method:
|
227
|
+
<strong><a name="M000006">draggable( id, options = {} )</a></strong> <a href="#M000006"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: draggable" /></a></h4>
|
228
|
+
|
229
|
+
<p>
|
230
|
+
Creates a script.aculo.us <a
|
231
|
+
href="JavaScriptGenerator.html#M000006">draggable</a> element. See
|
232
|
+
ActionView::Helpers::ScriptaculousHelper for more information.
|
233
|
+
</p>
|
234
|
+
|
235
|
+
<div class="sourcecode">
|
236
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000006_source')" id="l_M000006_source">show source</a> ]</p>
|
237
|
+
<div id="M000006_source" class="dyn-source">
|
238
|
+
<pre>
|
239
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 70</span>
|
240
|
+
70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draggable</span>( <span class="ruby-identifier">id</span>, <span class="ruby-identifier">options</span> = {} )
|
241
|
+
71: <span class="ruby-identifier">record</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">draggable_element_js</span>( <span class="ruby-identifier">id</span>, <span class="ruby-identifier">options</span> ) <span class="ruby-operator">+</span> <span class="ruby-value str">";\n"</span>
|
242
|
+
72: <span class="ruby-keyword kw">end</span>
|
243
|
+
</pre>
|
244
|
+
</div>
|
245
|
+
</div>
|
246
|
+
<h4 class="ruled">Public Instance method:
|
247
|
+
<strong><a name="M000007">drop_receiving( id, options = {} )</a></strong> <a href="#M000007"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: drop_receiving" /></a></h4>
|
248
|
+
|
249
|
+
<p>
|
250
|
+
Creates a script.aculo.us drop receiving element. See
|
251
|
+
ActionView::Helpers::ScriptaculousHelper for more information.
|
252
|
+
</p>
|
253
|
+
|
254
|
+
<div class="sourcecode">
|
255
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000007_source')" id="l_M000007_source">show source</a> ]</p>
|
256
|
+
<div id="M000007_source" class="dyn-source">
|
257
|
+
<pre>
|
258
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 76</span>
|
259
|
+
76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">drop_receiving</span>( <span class="ruby-identifier">id</span>, <span class="ruby-identifier">options</span> = {} )
|
260
|
+
77: <span class="ruby-identifier">record</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">drop_receiving_element_js</span>( <span class="ruby-identifier">id</span>, <span class="ruby-identifier">options</span> ) <span class="ruby-operator">+</span> <span class="ruby-value str">";\n"</span>
|
261
|
+
78: <span class="ruby-keyword kw">end</span>
|
262
|
+
</pre>
|
263
|
+
</div>
|
264
|
+
</div>
|
265
|
+
<h4 class="ruled">Public Instance method:
|
266
|
+
<strong><a name="M000008">hide( *ids )</a></strong> <a href="#M000008"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: hide" /></a></h4>
|
267
|
+
|
268
|
+
<p>
|
269
|
+
Hides the visible DOM elements with the given <tt>ids</tt>.
|
270
|
+
</p>
|
271
|
+
|
272
|
+
<div class="sourcecode">
|
273
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000008_source')" id="l_M000008_source">show source</a> ]</p>
|
274
|
+
<div id="M000008_source" class="dyn-source">
|
275
|
+
<pre>
|
276
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 81</span>
|
277
|
+
81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hide</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">ids</span> )
|
278
|
+
82: <span class="ruby-identifier">loop_on_multiple_args</span> <span class="ruby-value str">'Element.hide'</span>, <span class="ruby-identifier">ids</span>
|
279
|
+
83: <span class="ruby-keyword kw">end</span>
|
280
|
+
</pre>
|
281
|
+
</div>
|
282
|
+
</div>
|
283
|
+
<h4 class="ruled">Public Instance method:
|
284
|
+
<strong><a name="M000009">insert_html(position, id, data)</a></strong> <a href="#M000009"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: insert_html" /></a></h4>
|
285
|
+
|
286
|
+
<p>
|
287
|
+
Inserts HTML at the specified <tt>position</tt> relative to the DOM element
|
288
|
+
identified by the given <tt>id</tt>.
|
289
|
+
</p>
|
290
|
+
<p>
|
291
|
+
<tt>position</tt> may be one of:
|
292
|
+
</p>
|
293
|
+
<table>
|
294
|
+
<tr><td valign="top"><tt>:top</tt>:</td><td>HTML is inserted inside the element, before the element‘s existing
|
295
|
+
content.
|
296
|
+
|
297
|
+
</td></tr>
|
298
|
+
<tr><td valign="top"><tt>:bottom</tt>:</td><td>HTML is inserted inside the element, after the element‘s existing
|
299
|
+
content.
|
300
|
+
|
301
|
+
</td></tr>
|
302
|
+
<tr><td valign="top"><tt>:before</tt>:</td><td>HTML is inserted immediately preceeding the element.
|
303
|
+
|
304
|
+
</td></tr>
|
305
|
+
<tr><td valign="top"><tt>:after</tt>:</td><td>HTML is inserted immediately following the element.
|
306
|
+
|
307
|
+
</td></tr>
|
308
|
+
</table>
|
309
|
+
<p>
|
310
|
+
<tt>data</tt> may be a string of HTML to insert.
|
311
|
+
</p>
|
312
|
+
|
313
|
+
<div class="sourcecode">
|
314
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000009_source')" id="l_M000009_source">show source</a> ]</p>
|
315
|
+
<div id="M000009_source" class="dyn-source">
|
316
|
+
<pre>
|
317
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 98</span>
|
318
|
+
98: <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">data</span>)
|
319
|
+
99: <span class="ruby-identifier">insertion</span> = <span class="ruby-identifier">position</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">camelize</span>
|
320
|
+
100: <span class="ruby-identifier">call</span> <span class="ruby-node">"new Insertion.#{insertion}"</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">data</span>
|
321
|
+
101: <span class="ruby-keyword kw">end</span>
|
322
|
+
</pre>
|
323
|
+
</div>
|
324
|
+
</div>
|
325
|
+
<h4 class="ruled">Public Instance method:
|
326
|
+
<strong><a name="M000011">redirect_to(location)</a></strong> <a href="#M000011"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: redirect_to" /></a></h4>
|
327
|
+
|
328
|
+
<p>
|
329
|
+
Redirects the browser to the given <tt>location</tt>.
|
330
|
+
</p>
|
331
|
+
|
332
|
+
<div class="sourcecode">
|
333
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000011_source')" id="l_M000011_source">show source</a> ]</p>
|
334
|
+
<div id="M000011_source" class="dyn-source">
|
335
|
+
<pre>
|
336
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 109</span>
|
337
|
+
109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirect_to</span>(<span class="ruby-identifier">location</span>)
|
338
|
+
110: <span class="ruby-identifier">assign</span> <span class="ruby-value str">'window.location.href'</span>, <span class="ruby-identifier">location</span>
|
339
|
+
111: <span class="ruby-keyword kw">end</span>
|
340
|
+
</pre>
|
341
|
+
</div>
|
342
|
+
</div>
|
343
|
+
<h4 class="ruled">Public Instance method:
|
344
|
+
<strong><a name="M000012">remove(*ids)</a></strong> <a href="#M000012"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: remove" /></a></h4>
|
345
|
+
|
346
|
+
<p>
|
347
|
+
Removes the DOM elements with the given ids from the page.
|
348
|
+
</p>
|
349
|
+
|
350
|
+
<div class="sourcecode">
|
351
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000012_source')" id="l_M000012_source">show source</a> ]</p>
|
352
|
+
<div id="M000012_source" class="dyn-source">
|
353
|
+
<pre>
|
354
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 114</span>
|
355
|
+
114: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">ids</span>)
|
356
|
+
115: <span class="ruby-identifier">loop_on_multiple_args</span> <span class="ruby-value str">'Element.remove'</span>, <span class="ruby-identifier">ids</span>
|
357
|
+
116: <span class="ruby-keyword kw">end</span>
|
358
|
+
</pre>
|
359
|
+
</div>
|
360
|
+
</div>
|
361
|
+
<h4 class="ruled">Public Instance method:
|
362
|
+
<strong><a name="M000014">replace(id, data)</a></strong> <a href="#M000014"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: replace" /></a></h4>
|
363
|
+
|
364
|
+
<p>
|
365
|
+
Replaces the "outer HTML" (i.e., the entire element, not just its
|
366
|
+
contents) of the DOM element with the given <tt>id</tt>.
|
367
|
+
</p>
|
368
|
+
<p>
|
369
|
+
<tt>data</tt> may be a string of HTML to insert. For example:
|
370
|
+
</p>
|
371
|
+
<pre>
|
372
|
+
# Replace the DOM element having ID 'person-45' with the
|
373
|
+
# 'person' partial for the appropriate object.
|
374
|
+
replace 'person-45', render( 'person', :object => @person )
|
375
|
+
</pre>
|
376
|
+
|
377
|
+
<div class="sourcecode">
|
378
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000014_source')" id="l_M000014_source">show source</a> ]</p>
|
379
|
+
<div id="M000014_source" class="dyn-source">
|
380
|
+
<pre>
|
381
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 139</span>
|
382
|
+
139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">replace</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">data</span>)
|
383
|
+
140: <span class="ruby-identifier">call</span> <span class="ruby-value str">'Element.replace'</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">data</span>
|
384
|
+
141: <span class="ruby-keyword kw">end</span>
|
385
|
+
</pre>
|
386
|
+
</div>
|
387
|
+
</div>
|
388
|
+
<h4 class="ruled">Public Instance method:
|
389
|
+
<strong><a name="M000013">replace_html(id, data)</a></strong> <a href="#M000013"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: replace_html" /></a></h4>
|
390
|
+
|
391
|
+
<p>
|
392
|
+
Replaces the inner HTML of the DOM element with the given <tt>id</tt>.
|
393
|
+
</p>
|
394
|
+
<p>
|
395
|
+
<tt>data</tt> may be a string of HTML to insert
|
396
|
+
</p>
|
397
|
+
<pre>
|
398
|
+
# Replace the HTML of the DOM element having ID 'person-45' with the
|
399
|
+
# 'person' partial for the appropriate object.
|
400
|
+
replace_html 'person-45', render( 'person', :object => @person )
|
401
|
+
</pre>
|
402
|
+
|
403
|
+
<div class="sourcecode">
|
404
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000013_source')" id="l_M000013_source">show source</a> ]</p>
|
405
|
+
<div id="M000013_source" class="dyn-source">
|
406
|
+
<pre>
|
407
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 126</span>
|
408
|
+
126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">replace_html</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">data</span>)
|
409
|
+
127: <span class="ruby-identifier">call</span> <span class="ruby-value str">'Element.update'</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">data</span>
|
410
|
+
128: <span class="ruby-keyword kw">end</span>
|
411
|
+
</pre>
|
412
|
+
</div>
|
413
|
+
</div>
|
414
|
+
<h4 class="ruled">Public Instance method:
|
415
|
+
<strong><a name="M000002">select(pattern)</a></strong> <a href="#M000002"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: select" /></a></h4>
|
416
|
+
|
417
|
+
<p>
|
418
|
+
Returns a collection reference by finding it through a CSS <tt>pattern</tt>
|
419
|
+
in the DOM. This collection can then be used for further method calls.
|
420
|
+
Examples:
|
421
|
+
</p>
|
422
|
+
<pre>
|
423
|
+
page.select('p') # => $$('p');
|
424
|
+
page.select('p.welcome b').first # => $$('p.welcome b').first();
|
425
|
+
page.select('p.welcome b').first.hide # => $$('p.welcome b').first().hide();
|
426
|
+
</pre>
|
427
|
+
<p>
|
428
|
+
You can also use prototype enumerations with the collection. Observe:
|
429
|
+
</p>
|
430
|
+
<pre>
|
431
|
+
page.select('#items li').each do |value|
|
432
|
+
value.hide
|
433
|
+
end
|
434
|
+
# => $$('#items li').each(function(value) { value.hide(); });
|
435
|
+
</pre>
|
436
|
+
<p>
|
437
|
+
Though you can <a href="JavaScriptGenerator.html#M000010">call</a> the
|
438
|
+
block param anything you want, they are always rendered in the javascript
|
439
|
+
as ‘value, index.’ Other enumerations, like collect() return
|
440
|
+
the last statement:
|
441
|
+
</p>
|
442
|
+
<pre>
|
443
|
+
page.select('#items li').collect('hidden') do |item|
|
444
|
+
item.hide
|
445
|
+
end
|
446
|
+
# => var hidden = $$('#items li').collect(function(value, index) { return value.hide(); });
|
447
|
+
</pre>
|
448
|
+
|
449
|
+
<div class="sourcecode">
|
450
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000002_source')" id="l_M000002_source">show source</a> ]</p>
|
451
|
+
<div id="M000002_source" class="dyn-source">
|
452
|
+
<pre>
|
453
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 49</span>
|
454
|
+
49: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">select</span>(<span class="ruby-identifier">pattern</span>)
|
455
|
+
50: <span class="ruby-comment cmt"># JavaScriptElementCollectionProxy.new(self, pattern)</span>
|
456
|
+
51: <span class="ruby-keyword kw">end</span>
|
457
|
+
</pre>
|
458
|
+
</div>
|
459
|
+
</div>
|
460
|
+
<h4 class="ruled">Public Instance method:
|
461
|
+
<strong><a name="M000015">show(*ids)</a></strong> <a href="#M000015"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: show" /></a></h4>
|
462
|
+
|
463
|
+
<p>
|
464
|
+
Shows hidden DOM elements with the given <tt>ids</tt>.
|
465
|
+
</p>
|
466
|
+
|
467
|
+
<div class="sourcecode">
|
468
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000015_source')" id="l_M000015_source">show source</a> ]</p>
|
469
|
+
<div id="M000015_source" class="dyn-source">
|
470
|
+
<pre>
|
471
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 144</span>
|
472
|
+
144: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">ids</span>)
|
473
|
+
145: <span class="ruby-identifier">loop_on_multiple_args</span> <span class="ruby-value str">'Element.show'</span>, <span class="ruby-identifier">ids</span>
|
474
|
+
146: <span class="ruby-keyword kw">end</span>
|
475
|
+
</pre>
|
476
|
+
</div>
|
477
|
+
</div>
|
478
|
+
<h4 class="ruled">Public Instance method:
|
479
|
+
<strong><a name="M000016">sortable(id, options = {})</a></strong> <a href="#M000016"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: sortable" /></a></h4>
|
480
|
+
|
481
|
+
<p>
|
482
|
+
Creates a script.aculo.us <a
|
483
|
+
href="JavaScriptGenerator.html#M000016">sortable</a> element. Useful to
|
484
|
+
recreate <a href="JavaScriptGenerator.html#M000016">sortable</a> elements
|
485
|
+
after items get added or deleted.
|
486
|
+
</p>
|
487
|
+
|
488
|
+
<div class="sourcecode">
|
489
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000016_source')" id="l_M000016_source">show source</a> ]</p>
|
490
|
+
<div id="M000016_source" class="dyn-source">
|
491
|
+
<pre>
|
492
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 150</span>
|
493
|
+
150: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sortable</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">options</span> = {})
|
494
|
+
151: <span class="ruby-identifier">record</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">sortable_element_js</span>( <span class="ruby-identifier">id</span>, <span class="ruby-identifier">options</span> ) <span class="ruby-operator">+</span> <span class="ruby-value str">";\n"</span>
|
495
|
+
152: <span class="ruby-keyword kw">end</span>
|
496
|
+
</pre>
|
497
|
+
</div>
|
498
|
+
</div>
|
499
|
+
<h4 class="ruled">Public Instance method:
|
500
|
+
<strong><a name="M000018">toggle(*ids)</a></strong> <a href="#M000018"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: toggle" /></a></h4>
|
501
|
+
|
502
|
+
<p>
|
503
|
+
Toggles the visibility of the DOM elements with the given <tt>ids</tt>.
|
504
|
+
</p>
|
505
|
+
|
506
|
+
<div class="sourcecode">
|
507
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000018_source')" id="l_M000018_source">show source</a> ]</p>
|
508
|
+
<div id="M000018_source" class="dyn-source">
|
509
|
+
<pre>
|
510
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 161</span>
|
511
|
+
161: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">toggle</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">ids</span>)
|
512
|
+
162: <span class="ruby-identifier">loop_on_multiple_args</span> <span class="ruby-value str">'Element.toggle'</span>, <span class="ruby-identifier">ids</span>
|
513
|
+
163: <span class="ruby-keyword kw">end</span>
|
514
|
+
</pre>
|
515
|
+
</div>
|
516
|
+
</div>
|
517
|
+
<h4 class="ruled">Public Instance method:
|
518
|
+
<strong><a name="M000017">unsortable( id )</a></strong> <a href="#M000017"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: unsortable" /></a></h4>
|
519
|
+
|
520
|
+
<p>
|
521
|
+
Creates a script.aculo.us <a
|
522
|
+
href="JavaScriptGenerator.html#M000017">unsortable</a> element. Useful to
|
523
|
+
recreate <a href="JavaScriptGenerator.html#M000017">unsortable</a> elements
|
524
|
+
after items get added or deleted.
|
525
|
+
</p>
|
526
|
+
|
527
|
+
<div class="sourcecode">
|
528
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000017_source')" id="l_M000017_source">show source</a> ]</p>
|
529
|
+
<div id="M000017_source" class="dyn-source">
|
530
|
+
<pre>
|
531
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 156</span>
|
532
|
+
156: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unsortable</span>( <span class="ruby-identifier">id</span> )
|
533
|
+
157: <span class="ruby-identifier">record</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">unsortable_element_js</span>( <span class="ruby-identifier">id</span> ) <span class="ruby-operator">+</span> <span class="ruby-value str">";\n"</span>
|
534
|
+
158: <span class="ruby-keyword kw">end</span>
|
535
|
+
</pre>
|
536
|
+
</div>
|
537
|
+
</div>
|
538
|
+
<h4 class="ruled">Public Instance method:
|
539
|
+
<strong><a name="M000019">visual_effect(name, element_id = false, js_options = {})</a></strong> <a href="#M000019"><img src="../permalink.gif" border="0" title="Permalink to Public Instance method: visual_effect" /></a></h4>
|
540
|
+
|
541
|
+
<p>
|
542
|
+
Starts a <a href="http://script.aculo.us">script.aculo.us</a> visual
|
543
|
+
effect.
|
544
|
+
</p>
|
545
|
+
|
546
|
+
<div class="sourcecode">
|
547
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000019_source')" id="l_M000019_source">show source</a> ]</p>
|
548
|
+
<div id="M000019_source" class="dyn-source">
|
549
|
+
<pre>
|
550
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 166</span>
|
551
|
+
166: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">visual_effect</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">element_id</span> = <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">js_options</span> = {})
|
552
|
+
167: <span class="ruby-identifier">record</span>( <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">visual_effect</span>( <span class="ruby-identifier">name</span>, <span class="ruby-identifier">element_id</span>, <span class="ruby-identifier">js_options</span> ) <span class="ruby-operator">+</span> <span class="ruby-value str">";\n"</span> )
|
553
|
+
168: <span class="ruby-keyword kw">end</span>
|
554
|
+
</pre>
|
555
|
+
</div>
|
556
|
+
</div>
|
557
|
+
|
558
|
+
</div>
|
559
|
+
</div>
|
560
|
+
|
561
|
+
|
562
|
+
</div>
|
563
|
+
</body>
|
564
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
Sun, 23 Mar 2008 21:14:54 +0100
|