bivouac 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/README +18 -1
  2. data/bin/bivouac +10 -6
  3. data/lib/bivouac/commands/generate.rb +2 -0
  4. data/lib/bivouac/commands/plugin.rb +47 -0
  5. data/lib/bivouac/helpers/view/goh/html.rb +17 -0
  6. data/lib/bivouac/template/application/postamble.rb +26 -4
  7. data/lib/bivouac/template/application_goh.rb +2 -1
  8. data/{examples/blog_erb/script/generate → lib/bivouac/template/plugin.rb} +1 -1
  9. data/lib/bivouac/template/static/index.html +3 -2
  10. metadata +95 -172
  11. data/doc/rdoc/classes/BivouacHelpers/BaseView.html +0 -178
  12. data/doc/rdoc/classes/BivouacHelpers/FormView.html +0 -398
  13. data/doc/rdoc/classes/BivouacHelpers/HtmlView.html +0 -274
  14. data/doc/rdoc/classes/BivouacHelpers/JavaScriptView.html +0 -573
  15. data/doc/rdoc/classes/BivouacHelpers/ScriptAculoUsView.html +0 -258
  16. data/doc/rdoc/classes/BivouacHelpers/TooltipView.html +0 -158
  17. data/doc/rdoc/classes/BivouacHelpers.html +0 -117
  18. data/doc/rdoc/classes/JavaScriptGenerator.html +0 -564
  19. data/doc/rdoc/created.rid +0 -1
  20. data/doc/rdoc/files/AUTHORS.html +0 -109
  21. data/doc/rdoc/files/COPYING.html +0 -533
  22. data/doc/rdoc/files/README.html +0 -379
  23. data/doc/rdoc/files/lib/bivouac/helpers/view/goh/base_rb.html +0 -109
  24. data/doc/rdoc/files/lib/bivouac/helpers/view/goh/form_rb.html +0 -109
  25. data/doc/rdoc/files/lib/bivouac/helpers/view/goh/html_rb.html +0 -109
  26. data/doc/rdoc/files/lib/bivouac/helpers/view/goh/javascript_rb.html +0 -113
  27. data/doc/rdoc/files/lib/bivouac/helpers/view/goh/scriptaculous_rb.html +0 -113
  28. data/doc/rdoc/files/lib/bivouac/helpers/view/goh/tooltip_rb.html +0 -109
  29. data/doc/rdoc/index.html +0 -10
  30. data/doc/rdoc/permalink.gif +0 -0
  31. data/doc/rdoc/rdoc-style.css +0 -106
  32. data/doc/rdoc/rubyfr.png +0 -0
  33. data/examples/blog_erb/app/blog.rb +0 -84
  34. data/examples/blog_erb/app/controllers/add.rb +0 -19
  35. data/examples/blog_erb/app/controllers/comment.rb +0 -9
  36. data/examples/blog_erb/app/controllers/edit.rb +0 -18
  37. data/examples/blog_erb/app/controllers/index.rb +0 -8
  38. data/examples/blog_erb/app/controllers/info.rb +0 -11
  39. data/examples/blog_erb/app/controllers/login.rb +0 -15
  40. data/examples/blog_erb/app/controllers/logout.rb +0 -8
  41. data/examples/blog_erb/app/controllers/view.rb +0 -9
  42. data/examples/blog_erb/app/models/comment.rb +0 -5
  43. data/examples/blog_erb/app/models/post.rb +0 -5
  44. data/examples/blog_erb/app/models/user.rb +0 -4
  45. data/examples/blog_erb/app/views/add.html +0 -18
  46. data/examples/blog_erb/app/views/edit.html +0 -18
  47. data/examples/blog_erb/app/views/index.html +0 -12
  48. data/examples/blog_erb/app/views/layout.html +0 -12
  49. data/examples/blog_erb/app/views/login.html +0 -2
  50. data/examples/blog_erb/app/views/logout.html +0 -2
  51. data/examples/blog_erb/app/views/view.html +0 -20
  52. data/examples/blog_erb/config/environment.rb +0 -27
  53. data/examples/blog_erb/db/Blog.db +0 -0
  54. data/examples/blog_erb/db/create.rb +0 -8
  55. data/examples/blog_erb/db/migrate/comment.rb +0 -15
  56. data/examples/blog_erb/db/migrate/post.rb +0 -15
  57. data/examples/blog_erb/db/migrate/user.rb +0 -15
  58. data/examples/blog_erb/log/Blog.log +0 -57
  59. data/examples/blog_erb/public/images/camping.png +0 -0
  60. data/examples/blog_erb/public/index.html +0 -242
  61. data/examples/blog_erb/public/stylesheets/style.css +0 -10
  62. data/examples/blog_erb/script/server +0 -5
  63. data/lib/bivouac/commands/server.rb +0 -9
  64. data/lib/bivouac/template/application/helpers_erb.rb +0 -11
  65. data/lib/bivouac/template/application_erb.rb +0 -77
  66. data/lib/bivouac/template/application_jof.rb +0 -42
  67. data/lib/bivouac/template/generate/scaffold_view_create_erb.rb +0 -7
  68. data/lib/bivouac/template/generate/scaffold_view_list_erb.rb +0 -7
  69. data/lib/bivouac/template/generate/scaffold_view_view_erb.rb +0 -10
  70. data/lib/bivouac/template/generate/view_erb.rb +0 -2
@@ -1,178 +0,0 @@
1
-
2
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3
- <html>
4
- <head>
5
- <title>
6
- Bivouac, the Documentation &raquo; 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 &lt; 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="M000027">partial( partial, options = {} )</a></strong> <a href="#M000027"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: partial" /></a></h4>
107
-
108
- <p>
109
- Alias for <a href="BaseView.html#M000026">render</a>
110
- </p>
111
-
112
- <h4 class="ruled">Public Instance method:
113
- <strong><a name="M000028">public_to_str( file )</a></strong> <a href="#M000028"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: public_to_str" /></a></h4>
114
-
115
- <p>
116
- Return the content of a public file as string
117
- </p>
118
- <pre>
119
- public_to_str( &quot;/stylesheets/autocomplete.css&quot; )
120
- #=&gt; &quot;div.autocomplete {\n position:absolute;\n...&quot;
121
- </pre>
122
-
123
- <div class="sourcecode">
124
- <p class="source-link">[ <a href="javascript:toggleSource('M000028_source')" id="l_M000028_source">show source</a> ]</p>
125
- <div id="M000028_source" class="dyn-source">
126
- <pre>
127
- <span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/base.rb, line 22</span>
128
- 22: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">public_to_str</span>( <span class="ruby-identifier">file</span> )
129
- 23: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">include?</span> <span class="ruby-value str">&quot;..&quot;</span>
130
- 24: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
131
- 25: <span class="ruby-keyword kw">end</span>
132
- 26:
133
- 27: <span class="ruby-identifier">file</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'BIVOUAC_ROOT'</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;/public/&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">file</span>
134
- 28: <span class="ruby-identifier">open</span>( <span class="ruby-identifier">file</span> ) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
135
- 29: <span class="ruby-identifier">data</span> = <span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span>
136
- 30: <span class="ruby-keyword kw">end</span>
137
- 31:
138
- 32: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">data</span>
139
- 33: <span class="ruby-keyword kw">end</span>
140
- </pre>
141
- </div>
142
- </div>
143
- <h4 class="ruled">Public Instance method:
144
- <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>
145
-
146
- <pre>
147
- render( :hello, :object =&gt; @my_object )
148
- </pre>
149
- <p>
150
- is equivalent to
151
- </p>
152
- <pre>
153
- @object = @my_object
154
- hello( )
155
- </pre>
156
-
157
- <div class="sourcecode">
158
- <p class="source-link">[ <a href="javascript:toggleSource('M000026_source')" id="l_M000026_source">show source</a> ]</p>
159
- <div id="M000026_source" class="dyn-source">
160
- <pre>
161
- <span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/base.rb, line 9</span>
162
- 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> = {} )
163
- 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>
164
- 11: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">instance_variable_set</span>( <span class="ruby-node">&quot;@#{k.to_s}&quot;</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-identifier">v</span> )
165
- 12: <span class="ruby-keyword kw">end</span>
166
- 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> )
167
- 14: <span class="ruby-keyword kw">end</span>
168
- </pre>
169
- </div>
170
- </div>
171
-
172
- </div>
173
- </div>
174
-
175
-
176
- </div>
177
- </body>
178
- </html>
@@ -1,398 +0,0 @@
1
-
2
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3
- <html>
4
- <head>
5
- <title>
6
- Bivouac, the Documentation &raquo; 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 &lt; 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="M000042">auto_complete_field( field_id, options = nil )</a></strong> <a href="#M000042"><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('M000042_source')" id="l_M000042_source">show source</a> ]</p>
115
- <div id="M000042_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">&quot;indicator_#{field_id}&quot;</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">&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:indicator</span>], <span class="ruby-identifier">:style</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;display: none&quot;</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">&quot;choises_#{field_id}&quot;</span>
126
- 14: <span class="ruby-identifier">div</span>( <span class="ruby-identifier">:id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">choises_id</span>, <span class="ruby-identifier">:class</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;autocomplete&quot;</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">&quot;new Ajax.Autocompleter( '#{field_id}', '#{choises_id}', '#{url}', #{options_for_javascript(options)} );&quot;</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="M000044">button_to_function(name, *args, &amp;block)</a></strong> <a href="#M000044"><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&#8216;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('M000044_source')" id="l_M000044_source">show source</a> ]</p>
148
- <div id="M000044_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">&amp;</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">&amp;</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">&gt;</span> <span class="ruby-value str">&quot;button&quot;</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">name</span>,
159
- 71: <span class="ruby-identifier">:onclick</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-identifier">html_options</span>[<span class="ruby-identifier">:onclick</span>] <span class="ruby-operator">?</span> <span class="ruby-node">&quot;#{html_options[:onclick]}; &quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;&quot;</span>) <span class="ruby-operator">+</span> <span class="ruby-node">&quot;#{function};&quot;</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="M000047">form_remote_tag(options = {}, &amp;block)</a></strong> <a href="#M000047"><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&#8216;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 &quot;fall-through&quot; target for browsers that doesn&#8216;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 =&gt; { :url =&gt; 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#M000046">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#M000047">form_remote_tag</a> takes a block, like <a
196
- href="FormView.html#M000046">form_tag</a>:
197
- </p>
198
- <pre>
199
- form_remote_tag :url =&gt; '/posts' do
200
- div do; input( :type =&gt; 'submit', :name =&gt; 'submit' :value =&gt; 'Save' ); end
201
- end
202
- </pre>
203
-
204
- <div class="sourcecode">
205
- <p class="source-link">[ <a href="javascript:toggleSource('M000047_source')" id="l_M000047_source">show source</a> ]</p>
206
- <div id="M000047_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">&amp;</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">&quot;; &quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;&quot;</span>) <span class="ruby-operator">+</span>
215
- 165: <span class="ruby-node">&quot;#{remote_function(options)}; return false;&quot;</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">&amp;</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="M000046">form_tag(url, options = {}) {|| ...}</a></strong> <a href="#M000046"><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#M000046">form_tag</a>(&#8217;/posts&#8217;)
234
- =&gt; &lt;form action=&quot;/posts&quot; method=&quot;post&quot;&gt;</tt>
235
-
236
- </li>
237
- <li><tt><a href="FormView.html#M000046">form_tag</a>(&#8217;/upload&#8217;,
238
- :multipart =&gt; true) =&gt; &lt;form action=&quot;/upload&quot;
239
- method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;</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 =&gt; 'submit', :name =&gt; 'submit' :value =&gt; 'Save' ); end
249
- end
250
- </pre>
251
- <p>
252
- Will output:
253
- </p>
254
- <pre>
255
- &lt;form action=&quot;/posts&quot; method=&quot;post&quot;&gt;&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Save&quot; /&gt;&lt;/div&gt;&lt;/form&gt;
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
- &quot;multipart/form-data&quot;.
263
-
264
- </li>
265
- <li><tt>:method</tt> - The method to use when submitting the form, usually
266
- either &quot;get&quot; or &quot;post&quot;.
267
-
268
- <pre>
269
- If &quot;put&quot;, &quot;delete&quot;, 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('M000046_source')" id="l_M000046_source">show source</a> ]</p>
277
- <div id="M000046_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">&amp;</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">&quot;multipart/form-data&quot;</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">&quot;get&quot;</span>
289
- 118: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^post$/i</span>, <span class="ruby-value str">&quot;&quot;</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">&quot;post&quot;</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">&quot;post&quot;</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">&gt;</span> <span class="ruby-value str">&quot;hidden&quot;</span>, <span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;_method&quot;</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</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="M000045">submit_to_remote(name, value, options = {})</a></strong> <a href="#M000045"><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#M000047">form_remote_tag</a></tt>.
316
- </p>
317
-
318
- <div class="sourcecode">
319
- <p class="source-link">[ <a href="javascript:toggleSource('M000045_source')" id="l_M000045_source">show source</a> ]</p>
320
- <div id="M000045_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">&quot;#{remote_function(options)}; return false;&quot;</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="M000043">text_field(field_name, value = &quot;&quot;, options = {})</a></strong> <a href="#M000043"><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: &#8216;value&#8217;,another:
354
- &#8216;value&#8217;} or &#8216;field=value&amp;another=value&#8217; manner.
355
- </p>
356
-
357
- <div class="sourcecode">
358
- <p class="source-link">[ <a href="javascript:toggleSource('M000043_source')" id="l_M000043_source">show source</a> ]</p>
359
- <div id="M000043_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">&quot;&quot;</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">&quot;on&quot;</span>, <span class="ruby-value str">&quot;off&quot;</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] = &quot;off&quot;</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">&gt;</span> <span class="ruby-node">&quot;default_#{Time.now.to_i}&quot;</span>, <span class="ruby-identifier">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;text&quot;</span>, <span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">field_name</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</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>