bivouac 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README +9 -0
- data/bin/bivouac +15 -19
- data/doc/rdoc/classes/BivouacHelpers.html +117 -0
- data/doc/rdoc/classes/BivouacHelpers/BaseView.html +140 -0
- data/doc/rdoc/classes/BivouacHelpers/FormView.html +398 -0
- data/doc/rdoc/classes/BivouacHelpers/HtmlView.html +274 -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/JavaScriptGenerator.html +564 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/AUTHORS.html +14 -0
- data/doc/rdoc/files/COPYING.html +14 -0
- data/doc/rdoc/files/README.html +40 -1
- 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/examples/bivouac_sample/app/bivouac_sample.rb +61 -0
- data/examples/bivouac_sample/app/controllers/autocomplete.rb +24 -0
- data/examples/bivouac_sample/app/controllers/drag_and_drop.rb +11 -0
- data/examples/bivouac_sample/app/controllers/index.rb +7 -0
- data/examples/bivouac_sample/app/controllers/observe.rb +14 -0
- data/examples/bivouac_sample/app/controllers/periodically_call.rb +12 -0
- data/examples/bivouac_sample/app/controllers/remote_form.rb +10 -0
- data/examples/bivouac_sample/app/controllers/remote_link.rb +11 -0
- data/examples/bivouac_sample/app/controllers/submit_remote.rb +17 -0
- data/examples/bivouac_sample/app/controllers/toggle.rb +10 -0
- data/examples/bivouac_sample/app/controllers/toggle_sortable.rb +11 -0
- data/examples/bivouac_sample/app/helpers/_helpers.rb +25 -0
- data/examples/bivouac_sample/app/helpers/source.rb +25 -0
- data/examples/bivouac_sample/app/views/_autocomplete_result.rb +9 -0
- data/examples/bivouac_sample/app/views/_drag_and_drop_result.rb +5 -0
- data/examples/bivouac_sample/app/views/_observe_result.rb +17 -0
- data/examples/bivouac_sample/app/views/_periodically_call_result.rb +5 -0
- data/examples/bivouac_sample/app/views/_remote_link_result.rb +5 -0
- data/examples/bivouac_sample/app/views/_sortable_result.rb +5 -0
- data/examples/bivouac_sample/app/views/_submit_remote_result.rb +5 -0
- data/examples/bivouac_sample/app/views/autocomplete.rb +28 -0
- data/examples/bivouac_sample/app/views/drag_and_drop.rb +35 -0
- data/examples/bivouac_sample/app/views/index.rb +19 -0
- data/examples/bivouac_sample/app/views/observe.rb +19 -0
- data/examples/bivouac_sample/app/views/periodically_call.rb +17 -0
- data/examples/bivouac_sample/app/views/remote_form.rb +19 -0
- data/examples/bivouac_sample/app/views/remote_link.rb +20 -0
- data/examples/bivouac_sample/app/views/submit_remote.rb +21 -0
- data/examples/bivouac_sample/app/views/toggle.rb +44 -0
- data/examples/bivouac_sample/app/views/toggle_sortable.rb +52 -0
- data/examples/bivouac_sample/config/environment.rb +37 -0
- data/examples/bivouac_sample/config/postamble.rb +62 -0
- data/examples/bivouac_sample/log/BivouacSample.log +77 -0
- data/examples/bivouac_sample/public/images/camping.png +0 -0
- data/examples/bivouac_sample/public/index.html +242 -0
- data/examples/bivouac_sample/public/javascripts/builder.js +131 -0
- data/examples/bivouac_sample/public/javascripts/controls.js +835 -0
- data/examples/bivouac_sample/public/javascripts/dragdrop.js +944 -0
- data/examples/bivouac_sample/public/javascripts/effects.js +1090 -0
- data/examples/bivouac_sample/public/javascripts/prototype.js +2515 -0
- data/examples/bivouac_sample/public/javascripts/scriptaculous.js +51 -0
- data/examples/bivouac_sample/public/javascripts/slider.js +278 -0
- data/examples/bivouac_sample/public/javascripts/tooltip.js +208 -0
- data/examples/bivouac_sample/public/javascripts/unittest.js +564 -0
- data/examples/bivouac_sample/public/stylesheets/autocomplete.css +22 -0
- data/examples/bivouac_sample/public/stylesheets/coderay.css +104 -0
- data/examples/bivouac_sample/script/generate +3 -0
- data/examples/bivouac_sample/script/server +5 -0
- data/lib/bivouac/helpers/view/goh/base.rb +16 -0
- data/lib/bivouac/helpers/view/goh/form.rb +170 -0
- data/lib/bivouac/helpers/view/goh/html.rb +138 -0
- data/lib/bivouac/helpers/view/goh/javascript.rb +532 -0
- data/lib/bivouac/helpers/view/goh/scriptaculous.rb +133 -0
- data/lib/bivouac/helpers/view/goh/tooltip.rb +33 -0
- data/lib/bivouac/template.rb +3 -3
- data/lib/bivouac/template/application/helpers_erb.rb +11 -0
- data/lib/bivouac/template/application/helpers_goh.rb +25 -0
- data/lib/bivouac/template/application/postamble.rb +62 -0
- data/lib/bivouac/template/application_erb.rb +4 -0
- data/lib/bivouac/template/application_goh.rb +4 -0
- data/lib/bivouac/template/environment.rb +19 -5
- data/lib/bivouac/template/server.rb +1 -1
- data/lib/bivouac/template/static/autocomplete.css +22 -0
- data/lib/bivouac/template/static/builder.js +131 -0
- data/lib/bivouac/template/static/controls.js +835 -0
- data/lib/bivouac/template/static/dragdrop.js +944 -0
- data/lib/bivouac/template/static/effects.js +1090 -0
- data/lib/bivouac/template/static/prototype.js +2515 -0
- data/lib/bivouac/template/static/scriptaculous.js +51 -0
- data/lib/bivouac/template/static/slider.js +278 -0
- data/lib/bivouac/template/static/tooltip.js +208 -0
- data/lib/bivouac/template/static/unittest.js +564 -0
- metadata +124 -7
- data/lib/bivouac/template/application/postamble_cgi.rb +0 -8
- data/lib/bivouac/template/application/postamble_fastcgi.rb +0 -8
- data/lib/bivouac/template/application/postamble_mongrel.rb +0 -19
- data/lib/bivouac/template/application/postamble_none.rb +0 -1
- data/lib/bivouac/template/application/postamble_webrick.rb +0 -19
data/README
CHANGED
@@ -12,6 +12,15 @@ Bivouac is a simple generator for camping[http://code.whytheluckystiff.net/campi
|
|
12
12
|
|
13
13
|
== FEATURES/PROBLEMS:
|
14
14
|
|
15
|
+
=== 0.0.7:
|
16
|
+
* <tt>--postamble</tt>' bivouac option is deprecated! You can use the <tt>-d</tt> option to start your application as a daemon :
|
17
|
+
$ ruby script/server -d start
|
18
|
+
Then stop your server with :
|
19
|
+
$ ruby script/server -d stop
|
20
|
+
If you don't want to demonize you app, just do
|
21
|
+
$ ruby script/server
|
22
|
+
* This version include helpers with a lot of limitations...
|
23
|
+
|
15
24
|
=== 0.0.6:
|
16
25
|
* Scaffold now works with ERB! It's now time to work on a *real* scaffold!
|
17
26
|
|
data/bin/bivouac
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
=begin
|
3
|
-
bivouac
|
3
|
+
bivouac
|
4
4
|
(c)2007 Grégoire Lejeune
|
5
5
|
=end
|
6
6
|
|
7
7
|
require 'rubygems'
|
8
8
|
require 'optparse'
|
9
9
|
require 'ostruct'
|
10
|
-
require 'extra/openstruct'
|
11
10
|
require 'active_support'
|
12
11
|
require 'fileutils'
|
13
12
|
|
14
13
|
require 'bivouac/template'
|
15
14
|
include Bivouac::Template
|
16
15
|
|
17
|
-
@conf = OpenStruct.new( :db => "sqlite3", :orgtype => "GOH", :
|
16
|
+
@conf = OpenStruct.new( :db => "sqlite3", :orgtype => "GOH", :port => 3301, :address => "0.0.0.0" )
|
18
17
|
|
19
18
|
opts = OptionParser.new do |opts|
|
20
19
|
opts.banner = "Usage: bivouac [options] app"
|
@@ -32,12 +31,6 @@ opts = OptionParser.new do |opts|
|
|
32
31
|
exit
|
33
32
|
end
|
34
33
|
}
|
35
|
-
opts.on("-p", "--postamble TYPE", "Add a postamble (options: CGI/FastCGI/Mongrel/WEBrick/none)") { |@conf.postamble|
|
36
|
-
unless %w{cgi fastcgi mongrel webrick none}.include?( @conf.postamble.downcase )
|
37
|
-
puts opts
|
38
|
-
exit
|
39
|
-
end
|
40
|
-
}
|
41
34
|
|
42
35
|
opts.separator ""
|
43
36
|
opts.separator "Common options:"
|
@@ -69,8 +62,6 @@ name = ARGV.dup
|
|
69
62
|
@conf.appdir = @conf.appname.underscore
|
70
63
|
|
71
64
|
@appname = @conf.appname
|
72
|
-
@server_address = @conf.address
|
73
|
-
@server_port = @conf.port
|
74
65
|
|
75
66
|
createDir( @conf.appdir )
|
76
67
|
createDir( "#{@conf.appdir}/config" )
|
@@ -94,15 +85,16 @@ createFile( "#{@conf.appdir}/config/environment.rb" ) { |io|
|
|
94
85
|
io.puts template( "environment" )
|
95
86
|
}
|
96
87
|
|
97
|
-
|
88
|
+
createFile( "#{@conf.appdir}/config/postamble.rb" ) { |io|
|
89
|
+
io.puts template( "application/postamble" )
|
90
|
+
}
|
91
|
+
|
98
92
|
createFile( "#{@conf.appdir}/app/#{@conf.appdir}.rb" ) { |io|
|
99
|
-
io.puts template( "application_#{@conf.orgtype.downcase}" )
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
warn "Postamble `#{@conf.postamble}' ignored !"
|
105
|
-
end
|
93
|
+
io.puts template( "application_#{@conf.orgtype.downcase}" )
|
94
|
+
}
|
95
|
+
|
96
|
+
createFile( "#{@conf.appdir}/app/helpers/_helpers.rb" ) { |io|
|
97
|
+
io.puts template( "application/helpers_#{@conf.orgtype.downcase}" )
|
106
98
|
}
|
107
99
|
|
108
100
|
createFile( "#{@conf.appdir}/script/generate", true ) { |io|
|
@@ -115,6 +107,10 @@ createFile( "#{@conf.appdir}/script/server", true ) { |io|
|
|
115
107
|
|
116
108
|
copyTemplate( "static/index.html", "#{@conf.appdir}/public" )
|
117
109
|
copyTemplate( "static/camping.png", "#{@conf.appdir}/public/images" )
|
110
|
+
%w{builder.js dragdrop.js prototype.js slider.js unittest.js controls.js effects.js scriptaculous.js tooltip.js}.each do |f|
|
111
|
+
copyTemplate( "static/#{f}", "#{@conf.appdir}/public/javascripts" )
|
112
|
+
end
|
113
|
+
copyTemplate( "static/autocomplete.css", "#{@conf.appdir}/public/stylesheets" )
|
118
114
|
createFile( "#{@conf.appdir}/app/controllers/index.rb" ) { |io|
|
119
115
|
io.puts template( "static/index" )
|
120
116
|
}
|
@@ -0,0 +1,117 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>
|
6
|
+
Bivouac, the Documentation » Module: BivouacHelpers
|
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">Module: BivouacHelpers</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># Module: BivouacHelpers<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="BivouacHelpers" class="page_shade">
|
89
|
+
<div class="page">
|
90
|
+
<h3>Module BivouacHelpers < Object</h3>
|
91
|
+
|
92
|
+
(in files
|
93
|
+
<a href="../files/lib/bivouac/helpers/view/goh/base_rb.html">lib/bivouac/helpers/view/goh/base.rb</a>
|
94
|
+
<a href="../files/lib/bivouac/helpers/view/goh/form_rb.html">lib/bivouac/helpers/view/goh/form.rb</a>
|
95
|
+
<a href="../files/lib/bivouac/helpers/view/goh/html_rb.html">lib/bivouac/helpers/view/goh/html.rb</a>
|
96
|
+
<a href="../files/lib/bivouac/helpers/view/goh/tooltip_rb.html">lib/bivouac/helpers/view/goh/tooltip.rb</a>
|
97
|
+
<a href="../files/lib/bivouac/helpers/view/goh/scriptaculous_rb.html">lib/bivouac/helpers/view/goh/scriptaculous.rb</a>
|
98
|
+
<a href="../files/lib/bivouac/helpers/view/goh/javascript_rb.html">lib/bivouac/helpers/view/goh/javascript.rb</a>
|
99
|
+
)
|
100
|
+
|
101
|
+
<p>
|
102
|
+
bivouac/helpers/view/html
|
103
|
+
</p>
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</body>
|
117
|
+
</html>
|
@@ -0,0 +1,140 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>
|
6
|
+
Bivouac, the Documentation » Module: BivouacHelpers::BaseView
|
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">Module: BivouacHelpers::BaseView</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># Module: BivouacHelpers::BaseView<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="BivouacHelpers::BaseView" class="page_shade">
|
89
|
+
<div class="page">
|
90
|
+
<h3>Module BivouacHelpers::BaseView < Object</h3>
|
91
|
+
|
92
|
+
(in files
|
93
|
+
<a href="../../files/lib/bivouac/helpers/view/goh/base_rb.html">lib/bivouac/helpers/view/goh/base.rb</a>
|
94
|
+
)
|
95
|
+
|
96
|
+
<p>
|
97
|
+
bivouac/helpers/view/html
|
98
|
+
</p>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
<h2 class="ruled">Methods</h2>
|
105
|
+
<h4 class="ruled">Public Instance method:
|
106
|
+
<strong><a name="M000026">render( partial, options = {} )</a></strong> <a href="#M000026"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: render" /></a></h4>
|
107
|
+
|
108
|
+
<pre>
|
109
|
+
render( :hello, :object => @my_object )
|
110
|
+
</pre>
|
111
|
+
<p>
|
112
|
+
is equivalent to
|
113
|
+
</p>
|
114
|
+
<pre>
|
115
|
+
@object = @my_object
|
116
|
+
hello( )
|
117
|
+
</pre>
|
118
|
+
|
119
|
+
<div class="sourcecode">
|
120
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000026_source')" id="l_M000026_source">show source</a> ]</p>
|
121
|
+
<div id="M000026_source" class="dyn-source">
|
122
|
+
<pre>
|
123
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/base.rb, line 9</span>
|
124
|
+
9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>( <span class="ruby-identifier">partial</span>, <span class="ruby-identifier">options</span> = {} )
|
125
|
+
10: <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">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
126
|
+
11: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">instance_variable_set</span>( <span class="ruby-node">"@#{k.to_s}"</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-identifier">v</span> )
|
127
|
+
12: <span class="ruby-keyword kw">end</span>
|
128
|
+
13: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>( <span class="ruby-identifier">partial</span>.<span class="ruby-identifier">to_sym</span> )
|
129
|
+
14: <span class="ruby-keyword kw">end</span>
|
130
|
+
</pre>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
</div>
|
139
|
+
</body>
|
140
|
+
</html>
|
@@ -0,0 +1,398 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>
|
6
|
+
Bivouac, the Documentation » Module: BivouacHelpers::FormView
|
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">Module: BivouacHelpers::FormView</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># Module: BivouacHelpers::FormView<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="BivouacHelpers::FormView" class="page_shade">
|
89
|
+
<div class="page">
|
90
|
+
<h3>Module BivouacHelpers::FormView < Object</h3>
|
91
|
+
|
92
|
+
(in files
|
93
|
+
<a href="../../files/lib/bivouac/helpers/view/goh/form_rb.html">lib/bivouac/helpers/view/goh/form.rb</a>
|
94
|
+
)
|
95
|
+
|
96
|
+
<p>
|
97
|
+
bivouac/helpers/view/html
|
98
|
+
</p>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
<h2 class="ruled">Methods</h2>
|
105
|
+
<h4 class="ruled">Public Instance method:
|
106
|
+
<strong><a name="M000040">auto_complete_field( field_id, options = nil )</a></strong> <a href="#M000040"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: auto_complete_field" /></a></h4>
|
107
|
+
|
108
|
+
<p>
|
109
|
+
Adds AJAX autocomplete functionality to the text input field with the DOM
|
110
|
+
ID specified by <tt>field_id</tt>.
|
111
|
+
</p>
|
112
|
+
|
113
|
+
<div class="sourcecode">
|
114
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000040_source')" id="l_M000040_source">show source</a> ]</p>
|
115
|
+
<div id="M000040_source" class="dyn-source">
|
116
|
+
<pre>
|
117
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/form.rb, line 6</span>
|
118
|
+
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">auto_complete_field</span>( <span class="ruby-identifier">field_id</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span> )
|
119
|
+
7: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">has_key?</span>( <span class="ruby-identifier">:indicator</span> )
|
120
|
+
8: <span class="ruby-identifier">data</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:indicator</span>]
|
121
|
+
9: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:indicator</span>] = <span class="ruby-node">"indicator_#{field_id}"</span>
|
122
|
+
10: <span class="ruby-identifier">span</span>( <span class="ruby-identifier">data</span>, <span class="ruby-identifier">:id</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:indicator</span>], <span class="ruby-identifier">:style</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"display: none"</span> )
|
123
|
+
11: <span class="ruby-keyword kw">end</span>
|
124
|
+
12:
|
125
|
+
13: <span class="ruby-identifier">choises_id</span> = <span class="ruby-node">"choises_#{field_id}"</span>
|
126
|
+
14: <span class="ruby-identifier">div</span>( <span class="ruby-identifier">:id</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">choises_id</span>, <span class="ruby-identifier">:class</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"autocomplete"</span> ) <span class="ruby-keyword kw">do</span>; <span class="ruby-keyword kw">end</span>
|
127
|
+
15: <span class="ruby-identifier">url</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>( <span class="ruby-identifier">:url</span> )
|
128
|
+
16: <span class="ruby-identifier">javascript_tag</span> <span class="ruby-node">"new Ajax.Autocompleter( '#{field_id}', '#{choises_id}', '#{url}', #{options_for_javascript(options)} );"</span>
|
129
|
+
17: <span class="ruby-keyword kw">end</span>
|
130
|
+
</pre>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
<h4 class="ruled">Public Instance method:
|
134
|
+
<strong><a name="M000042">button_to_function(name, *args, &block)</a></strong> <a href="#M000042"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: button_to_function" /></a></h4>
|
135
|
+
|
136
|
+
<p>
|
137
|
+
Returns a button that‘ll trigger a JavaScript function using the
|
138
|
+
onclick handler.
|
139
|
+
</p>
|
140
|
+
<p>
|
141
|
+
The function argument can be omitted in favor of an update_page block,
|
142
|
+
which evaluates to a string when the template is rendered (instead of
|
143
|
+
making an Ajax request first).
|
144
|
+
</p>
|
145
|
+
|
146
|
+
<div class="sourcecode">
|
147
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000042_source')" id="l_M000042_source">show source</a> ]</p>
|
148
|
+
<div id="M000042_source" class="dyn-source">
|
149
|
+
<pre>
|
150
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/form.rb, line 63</span>
|
151
|
+
63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">button_to_function</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
152
|
+
64: <span class="ruby-identifier">html_options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">pop</span> <span class="ruby-operator">:</span> {}
|
153
|
+
65: <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>
|
154
|
+
66:
|
155
|
+
67: <span class="ruby-identifier">function</span> = <span class="ruby-identifier">update_page</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
156
|
+
68:
|
157
|
+
69: <span class="ruby-identifier">input</span>( <span class="ruby-identifier">html_options</span>.<span class="ruby-identifier">merge</span>({
|
158
|
+
70: <span class="ruby-identifier">:type</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"button"</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">name</span>,
|
159
|
+
71: <span class="ruby-identifier">:onclick</span> =<span class="ruby-operator">></span> (<span class="ruby-identifier">html_options</span>[<span class="ruby-identifier">:onclick</span>] <span class="ruby-operator">?</span> <span class="ruby-node">"#{html_options[:onclick]}; "</span> <span class="ruby-operator">:</span> <span class="ruby-value str">""</span>) <span class="ruby-operator">+</span> <span class="ruby-node">"#{function};"</span>
|
160
|
+
72: }))
|
161
|
+
73: <span class="ruby-keyword kw">end</span>
|
162
|
+
</pre>
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
<h4 class="ruled">Public Instance method:
|
166
|
+
<strong><a name="M000045">form_remote_tag(options = {}, &block)</a></strong> <a href="#M000045"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: form_remote_tag" /></a></h4>
|
167
|
+
|
168
|
+
<p>
|
169
|
+
Returns a form tag that will submit using XMLHttpRequest in the background
|
170
|
+
instead of the regular reloading POST arrangement. Even though it‘s
|
171
|
+
using JavaScript to serialize the form elements, the form submission will
|
172
|
+
work just like a regular submission as viewed by the receiving side. The
|
173
|
+
options for specifying the target with :url and defining callbacks is the
|
174
|
+
same as link_to_remote.
|
175
|
+
</p>
|
176
|
+
<p>
|
177
|
+
A "fall-through" target for browsers that doesn‘t do
|
178
|
+
JavaScript can be specified with the :action/:method options on :html.
|
179
|
+
</p>
|
180
|
+
<p>
|
181
|
+
Example:
|
182
|
+
</p>
|
183
|
+
<pre>
|
184
|
+
form_remote_tag :html => { :url => R(SomePlace) }
|
185
|
+
</pre>
|
186
|
+
<p>
|
187
|
+
The Hash passed to the :html key is equivalent to the options (2nd)
|
188
|
+
argument in the <a href="FormView.html#M000044">form_tag</a> method.
|
189
|
+
</p>
|
190
|
+
<p>
|
191
|
+
By default the fall-through action is the same as the one specified in the
|
192
|
+
:url (and the default method is :post).
|
193
|
+
</p>
|
194
|
+
<p>
|
195
|
+
<a href="FormView.html#M000045">form_remote_tag</a> takes a block, like <a
|
196
|
+
href="FormView.html#M000044">form_tag</a>:
|
197
|
+
</p>
|
198
|
+
<pre>
|
199
|
+
form_remote_tag :url => '/posts' do
|
200
|
+
div do; input( :type => 'submit', :name => 'submit' :value => 'Save' ); end
|
201
|
+
end
|
202
|
+
</pre>
|
203
|
+
|
204
|
+
<div class="sourcecode">
|
205
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000045_source')" id="l_M000045_source">show source</a> ]</p>
|
206
|
+
<div id="M000045_source" class="dyn-source">
|
207
|
+
<pre>
|
208
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/form.rb, line 159</span>
|
209
|
+
159: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">form_remote_tag</span>(<span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
210
|
+
160: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:form</span>] = <span class="ruby-keyword kw">true</span>
|
211
|
+
161:
|
212
|
+
162: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:html</span>] <span class="ruby-operator">||=</span> {}
|
213
|
+
163: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:html</span>][<span class="ruby-identifier">:onsubmit</span>] =
|
214
|
+
164: (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:html</span>][<span class="ruby-identifier">:onsubmit</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:html</span>][<span class="ruby-identifier">:onsubmit</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">"; "</span> <span class="ruby-operator">:</span> <span class="ruby-value str">""</span>) <span class="ruby-operator">+</span>
|
215
|
+
165: <span class="ruby-node">"#{remote_function(options)}; return false;"</span>
|
216
|
+
166:
|
217
|
+
167: <span class="ruby-identifier">form_tag</span>( <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:html</span>].<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:url</span>), <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:html</span>], <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
218
|
+
168: <span class="ruby-keyword kw">end</span>
|
219
|
+
</pre>
|
220
|
+
</div>
|
221
|
+
</div>
|
222
|
+
<h4 class="ruled">Public Instance method:
|
223
|
+
<strong><a name="M000044">form_tag(url, options = {}) {|| ...}</a></strong> <a href="#M000044"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: form_tag" /></a></h4>
|
224
|
+
|
225
|
+
<p>
|
226
|
+
Starts a form tag that points the action to an url. The method for the form
|
227
|
+
defaults to POST.
|
228
|
+
</p>
|
229
|
+
<p>
|
230
|
+
Examples:
|
231
|
+
</p>
|
232
|
+
<ul>
|
233
|
+
<li><tt><a href="FormView.html#M000044">form_tag</a>(’/posts’)
|
234
|
+
=> <form action="/posts" method="post"></tt>
|
235
|
+
|
236
|
+
</li>
|
237
|
+
<li><tt><a href="FormView.html#M000044">form_tag</a>(’/upload’,
|
238
|
+
:multipart => true) => <form action="/upload"
|
239
|
+
method="post" enctype="multipart/form-data"></tt>
|
240
|
+
|
241
|
+
</li>
|
242
|
+
</ul>
|
243
|
+
<p>
|
244
|
+
Example:
|
245
|
+
</p>
|
246
|
+
<pre>
|
247
|
+
form_tag R(Post) do
|
248
|
+
div do; input( :type => 'submit', :name => 'submit' :value => 'Save' ); end
|
249
|
+
end
|
250
|
+
</pre>
|
251
|
+
<p>
|
252
|
+
Will output:
|
253
|
+
</p>
|
254
|
+
<pre>
|
255
|
+
<form action="/posts" method="post"><input type="submit" name="submit" value="Save" /></div></form>
|
256
|
+
</pre>
|
257
|
+
<p>
|
258
|
+
Options:
|
259
|
+
</p>
|
260
|
+
<ul>
|
261
|
+
<li><tt>:multipart</tt> - If set to true, the enctype is set to
|
262
|
+
"multipart/form-data".
|
263
|
+
|
264
|
+
</li>
|
265
|
+
<li><tt>:method</tt> - The method to use when submitting the form, usually
|
266
|
+
either "get" or "post".
|
267
|
+
|
268
|
+
<pre>
|
269
|
+
If "put", "delete", or another verb is used, a hidden input with name _method
|
270
|
+
is added to simulate the verb over post.
|
271
|
+
</pre>
|
272
|
+
</li>
|
273
|
+
</ul>
|
274
|
+
|
275
|
+
<div class="sourcecode">
|
276
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000044_source')" id="l_M000044_source">show source</a> ]</p>
|
277
|
+
<div id="M000044_source" class="dyn-source">
|
278
|
+
<pre>
|
279
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/form.rb, line 109</span>
|
280
|
+
109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">form_tag</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
281
|
+
110: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:enctype</span>] = <span class="ruby-value str">"multipart/form-data"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:multipart</span>)
|
282
|
+
111: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:action</span>] = <span class="ruby-identifier">url</span>
|
283
|
+
112:
|
284
|
+
113: <span class="ruby-identifier">method_tag</span> = <span class="ruby-keyword kw">false</span>
|
285
|
+
114:
|
286
|
+
115: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">method</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:method</span>).<span class="ruby-identifier">to_s</span>
|
287
|
+
116: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^get$/i</span> <span class="ruby-comment cmt"># must be case-insentive, but can't use downcase as might be nil</span>
|
288
|
+
117: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:method</span>] = <span class="ruby-value str">"get"</span>
|
289
|
+
118: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^post$/i</span>, <span class="ruby-value str">""</span>, <span class="ruby-keyword kw">nil</span>
|
290
|
+
119: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:method</span>] = <span class="ruby-value str">"post"</span>
|
291
|
+
120: <span class="ruby-keyword kw">else</span>
|
292
|
+
121: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:method</span>] = <span class="ruby-value str">"post"</span>
|
293
|
+
122: <span class="ruby-identifier">method_tag</span> = <span class="ruby-keyword kw">true</span>
|
294
|
+
123: <span class="ruby-keyword kw">end</span>
|
295
|
+
124:
|
296
|
+
125: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
297
|
+
126: <span class="ruby-identifier">form</span>( <span class="ruby-identifier">options</span> ) <span class="ruby-keyword kw">do</span>
|
298
|
+
127: <span class="ruby-keyword kw">yield</span>( )
|
299
|
+
128: <span class="ruby-identifier">input</span>( <span class="ruby-identifier">:type</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"hidden"</span>, <span class="ruby-identifier">:name</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"_method"</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">method</span> ) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">method_tag</span>
|
300
|
+
129: <span class="ruby-keyword kw">end</span>
|
301
|
+
130: <span class="ruby-keyword kw">else</span>
|
302
|
+
131: <span class="ruby-identifier">form</span>( <span class="ruby-identifier">options</span> ) <span class="ruby-keyword kw">do</span>; <span class="ruby-keyword kw">end</span>
|
303
|
+
132: <span class="ruby-keyword kw">end</span>
|
304
|
+
133: <span class="ruby-keyword kw">end</span>
|
305
|
+
</pre>
|
306
|
+
</div>
|
307
|
+
</div>
|
308
|
+
<h4 class="ruled">Public Instance method:
|
309
|
+
<strong><a name="M000043">submit_to_remote(name, value, options = {})</a></strong> <a href="#M000043"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: submit_to_remote" /></a></h4>
|
310
|
+
|
311
|
+
<p>
|
312
|
+
Returns a button input tag that will submit form using XMLHttpRequest in
|
313
|
+
the background instead of regular reloading POST arrangement.
|
314
|
+
<tt>options</tt> argument is the same as in <tt><a
|
315
|
+
href="FormView.html#M000045">form_remote_tag</a></tt>.
|
316
|
+
</p>
|
317
|
+
|
318
|
+
<div class="sourcecode">
|
319
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000043_source')" id="l_M000043_source">show source</a> ]</p>
|
320
|
+
<div id="M000043_source" class="dyn-source">
|
321
|
+
<pre>
|
322
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/form.rb, line 78</span>
|
323
|
+
78: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">submit_to_remote</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">options</span> = {})
|
324
|
+
79: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:with</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">'Form.serialize(this.form)'</span>
|
325
|
+
80:
|
326
|
+
81: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:html</span>] <span class="ruby-operator">||=</span> {}
|
327
|
+
82: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:html</span>][<span class="ruby-identifier">:type</span>] = <span class="ruby-value str">'button'</span>
|
328
|
+
83: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:html</span>][<span class="ruby-identifier">:onclick</span>] = <span class="ruby-node">"#{remote_function(options)}; return false;"</span>
|
329
|
+
84: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:html</span>][<span class="ruby-identifier">:name</span>] = <span class="ruby-identifier">name</span>
|
330
|
+
85: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:html</span>][<span class="ruby-identifier">:value</span>] = <span class="ruby-identifier">value</span>
|
331
|
+
86:
|
332
|
+
87: <span class="ruby-identifier">input</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:html</span>]
|
333
|
+
88: <span class="ruby-keyword kw">end</span>
|
334
|
+
</pre>
|
335
|
+
</div>
|
336
|
+
</div>
|
337
|
+
<h4 class="ruled">Public Instance method:
|
338
|
+
<strong><a name="M000041">text_field(field_name, value = "", options = {})</a></strong> <a href="#M000041"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: text_field" /></a></h4>
|
339
|
+
|
340
|
+
<p>
|
341
|
+
Autocomplete options :
|
342
|
+
</p>
|
343
|
+
<p>
|
344
|
+
+:url+: URL to call for autocompletion results +:tokens+: +:frequency+:
|
345
|
+
+:minChars+: +:indicator+: When sending the Ajax request Autocompleter
|
346
|
+
shows this +:updateElement+: Hook for a custom function called after the
|
347
|
+
element has been updated (i.e. when the user has selected an entry).
|
348
|
+
+:afterUpdateElement+: Hook for a custom function called after the element
|
349
|
+
has been updated (i.e. when the user has selected an entry). +:callback+:
|
350
|
+
This function is called just before the Request is actually made, allowing
|
351
|
+
you to modify the querystring that is sent to the server. +:parameters+: If
|
352
|
+
you need to send any additional parameters through your search form, add
|
353
|
+
them here, in the usual {field: ‘value’,another:
|
354
|
+
‘value’} or ‘field=value&another=value’ manner.
|
355
|
+
</p>
|
356
|
+
|
357
|
+
<div class="sourcecode">
|
358
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000041_source')" id="l_M000041_source">show source</a> ]</p>
|
359
|
+
<div id="M000041_source" class="dyn-source">
|
360
|
+
<pre>
|
361
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/form.rb, line 30</span>
|
362
|
+
30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">text_field</span>(<span class="ruby-identifier">field_name</span>, <span class="ruby-identifier">value</span> = <span class="ruby-value str">""</span>, <span class="ruby-identifier">options</span> = {})
|
363
|
+
31: <span class="ruby-identifier">autocomplete_options</span> = <span class="ruby-keyword kw">nil</span>
|
364
|
+
32:
|
365
|
+
33: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">has_key?</span>( <span class="ruby-identifier">:autocomplete</span> )
|
366
|
+
34: <span class="ruby-keyword kw">unless</span> [<span class="ruby-value str">"on"</span>, <span class="ruby-value str">"off"</span>].<span class="ruby-identifier">include?</span>( <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:autocomplete</span>] )
|
367
|
+
35: <span class="ruby-identifier">autocomplete_options</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>( )
|
368
|
+
36: <span class="ruby-identifier">autocomplete_options</span>[<span class="ruby-identifier">:url</span>] = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>( <span class="ruby-identifier">:autocomplete</span> )
|
369
|
+
37: <span class="ruby-comment cmt"># options[:autocomplete] = "off"</span>
|
370
|
+
38: <span class="ruby-keyword kw">end</span>
|
371
|
+
39: <span class="ruby-keyword kw">end</span>
|
372
|
+
40:
|
373
|
+
41:
|
374
|
+
42: [<span class="ruby-identifier">:tokens</span>, <span class="ruby-identifier">:frequency</span>, <span class="ruby-identifier">:minChars</span>, <span class="ruby-identifier">:indicator</span>, <span class="ruby-identifier">:updateElement</span>, <span class="ruby-identifier">:afterUpdateElement</span>, <span class="ruby-identifier">:callback</span>, <span class="ruby-identifier">:parameters</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">op</span><span class="ruby-operator">|</span>
|
375
|
+
43: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">has_key?</span>( <span class="ruby-identifier">op</span> )
|
376
|
+
44: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">autocomplete_options</span>.<span class="ruby-identifier">nil?</span>
|
377
|
+
45: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>( <span class="ruby-identifier">op</span> )
|
378
|
+
46: <span class="ruby-keyword kw">else</span>
|
379
|
+
47: <span class="ruby-identifier">autocomplete_options</span>[<span class="ruby-identifier">op</span>] = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>( <span class="ruby-identifier">op</span> )
|
380
|
+
48: <span class="ruby-keyword kw">end</span>
|
381
|
+
49: <span class="ruby-keyword kw">end</span>
|
382
|
+
50: <span class="ruby-keyword kw">end</span>
|
383
|
+
51:
|
384
|
+
52: <span class="ruby-identifier">options</span> = { <span class="ruby-identifier">:id</span> =<span class="ruby-operator">></span> <span class="ruby-node">"default_#{Time.now.to_i}"</span>, <span class="ruby-identifier">:type</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"text"</span>, <span class="ruby-identifier">:name</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">field_name</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">value</span> }.<span class="ruby-identifier">merge</span>( <span class="ruby-identifier">options</span> )
|
385
|
+
53: <span class="ruby-identifier">input</span>( <span class="ruby-identifier">options</span> )
|
386
|
+
54: <span class="ruby-identifier">auto_complete_field</span>( <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:id</span>], <span class="ruby-identifier">autocomplete_options</span> ) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">autocomplete_options</span>.<span class="ruby-identifier">nil?</span>
|
387
|
+
55: <span class="ruby-keyword kw">end</span>
|
388
|
+
</pre>
|
389
|
+
</div>
|
390
|
+
</div>
|
391
|
+
|
392
|
+
</div>
|
393
|
+
</div>
|
394
|
+
|
395
|
+
|
396
|
+
</div>
|
397
|
+
</body>
|
398
|
+
</html>
|