bivouac 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -7
- data/bin/bivouac +1 -1
- data/doc/rdoc/classes/BivouacHelpers/BaseView.html +178 -0
- data/doc/rdoc/classes/BivouacHelpers/FormView.html +398 -0
- data/doc/rdoc/classes/BivouacHelpers/HtmlView.html +305 -0
- data/doc/rdoc/classes/BivouacHelpers/JavaScriptView.html +573 -0
- data/doc/rdoc/classes/BivouacHelpers/ScriptAculoUsView.html +258 -0
- data/doc/rdoc/classes/BivouacHelpers/TooltipView.html +158 -0
- data/doc/rdoc/classes/BivouacHelpers.html +117 -0
- data/doc/rdoc/classes/JavaScriptGenerator.html +564 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/AUTHORS.html +109 -0
- data/doc/rdoc/files/COPYING.html +533 -0
- data/doc/rdoc/files/README.html +427 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/base_rb.html +109 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/form_rb.html +109 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/html_rb.html +109 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/javascript_rb.html +113 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/scriptaculous_rb.html +113 -0
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/tooltip_rb.html +109 -0
- data/doc/rdoc/index.html +10 -0
- data/doc/rdoc/permalink.gif +0 -0
- data/doc/rdoc/rdoc-style.css +106 -0
- data/doc/rdoc/rubyfr.png +0 -0
- data/examples/bivouac_sample/Rakefile +48 -0
- data/examples/bivouac_sample/app/bivouac_sample.rb +15 -7
- data/examples/bivouac_sample/app/controllers/index.rb +2 -2
- data/examples/bivouac_sample/app/controllers/sound.rb +10 -0
- data/examples/bivouac_sample/app/helpers/_helpers.rb +6 -3
- data/examples/bivouac_sample/app/views/sound.rb +16 -0
- data/examples/bivouac_sample/config/environment.rb +5 -2
- data/examples/bivouac_sample/config/postamble.rb +89 -18
- data/examples/bivouac_sample/public/javascripts/builder.js +12 -7
- data/examples/bivouac_sample/public/javascripts/controls.js +485 -355
- data/examples/bivouac_sample/public/javascripts/dragdrop.js +82 -52
- data/examples/bivouac_sample/public/javascripts/effects.js +361 -329
- data/examples/bivouac_sample/public/javascripts/prototype.js +2826 -1120
- data/examples/bivouac_sample/public/javascripts/scriptaculous.js +15 -8
- data/examples/bivouac_sample/public/javascripts/slider.js +40 -43
- data/examples/bivouac_sample/public/javascripts/sound.js +55 -0
- data/examples/bivouac_sample/public/javascripts/unittest.js +16 -12
- data/examples/bivouac_sample/public/sound/sword.mp3 +0 -0
- data/examples/bivouac_sample/script/console +6 -0
- data/examples/bivouac_sample/script/plugin +3 -0
- data/examples/bivouac_sample/script/server +2 -1
- data/examples/bivouac_sample/test/test_sound.rb +15 -0
- data/lib/bivouac/helpers/view/goh/sound.rb +38 -0
- data/lib/bivouac/template/application/helpers_goh.rb +2 -0
- data/lib/bivouac/template/static/builder.js +12 -7
- data/lib/bivouac/template/static/controls.js +485 -355
- data/lib/bivouac/template/static/dragdrop.js +82 -52
- data/lib/bivouac/template/static/effects.js +361 -329
- data/lib/bivouac/template/static/prototype.js +2826 -1120
- data/lib/bivouac/template/static/scriptaculous.js +15 -8
- data/lib/bivouac/template/static/slider.js +40 -43
- data/lib/bivouac/template/static/sound.js +55 -0
- data/lib/bivouac/template/static/unittest.js +16 -12
- metadata +45 -2
@@ -0,0 +1,305 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>
|
6
|
+
Bivouac, the Documentation » Module: BivouacHelpers::HtmlView
|
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::HtmlView</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::HtmlView<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::HtmlView" class="page_shade">
|
89
|
+
<div class="page">
|
90
|
+
<h3>Module BivouacHelpers::HtmlView < Object</h3>
|
91
|
+
|
92
|
+
(in files
|
93
|
+
<a href="../../files/lib/bivouac/helpers/view/goh/html_rb.html">lib/bivouac/helpers/view/goh/html.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="M000041">image_path( source )</a></strong> <a href="#M000041"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: image_path" /></a></h4>
|
107
|
+
|
108
|
+
<p>
|
109
|
+
Computes the path to an image asset in the public images directory. Full
|
110
|
+
paths from the document root will be passed through. Used internally by <a
|
111
|
+
href="HtmlView.html#M000040">image_tag</a> to build the image path.
|
112
|
+
</p>
|
113
|
+
<pre>
|
114
|
+
image_path("edit") # => /public/images/edit
|
115
|
+
image_path("edit.png") # => /public/images/edit.png
|
116
|
+
image_path("icons/edit.png") # => /public/images/icons/edit.png
|
117
|
+
image_path("/icons/edit.png") # => /icons/edit.png
|
118
|
+
image_path("http://www.railsapplication.com/img/edit.png") # => http://www.railsapplication.com/img/edit.png
|
119
|
+
</pre>
|
120
|
+
|
121
|
+
<div class="sourcecode">
|
122
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000041_source')" id="l_M000041_source">show source</a> ]</p>
|
123
|
+
<div id="M000041_source" class="dyn-source">
|
124
|
+
<pre>
|
125
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/html.rb, line 89</span>
|
126
|
+
89: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">image_path</span>( <span class="ruby-identifier">source</span> )
|
127
|
+
90: <span class="ruby-keyword kw">if</span> <span class="ruby-regexp re">/^http:\/\//</span>.<span class="ruby-identifier">match</span>( <span class="ruby-identifier">source</span> ) <span class="ruby-operator">||</span> <span class="ruby-regexp re">/^\//</span>.<span class="ruby-identifier">match</span>( <span class="ruby-identifier">source</span> )
|
128
|
+
91: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">source</span>
|
129
|
+
92: <span class="ruby-keyword kw">else</span>
|
130
|
+
93: <span class="ruby-keyword kw">return</span> <span class="ruby-node">"/public/images/#{source}"</span>
|
131
|
+
94: <span class="ruby-keyword kw">end</span>
|
132
|
+
95: <span class="ruby-keyword kw">end</span>
|
133
|
+
</pre>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
<h4 class="ruled">Public Instance method:
|
137
|
+
<strong><a name="M000040">image_tag( source, options = {} )</a></strong> <a href="#M000040"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: image_tag" /></a></h4>
|
138
|
+
|
139
|
+
<p>
|
140
|
+
Returns an html image tag for the <tt>source</tt>. The <tt>source</tt> must
|
141
|
+
be a file that exists in your public images directory (public/images). You
|
142
|
+
can add html attributes using the <tt>options</tt>. If no alt text is
|
143
|
+
given, the file name part of the <tt>source</tt> is used (capitalized and
|
144
|
+
without the extension)
|
145
|
+
</p>
|
146
|
+
<pre>
|
147
|
+
image_tag("icon.png") # =>
|
148
|
+
<img src="/public/images/icon.png" alt="Icon" />
|
149
|
+
|
150
|
+
image_tag("icon.png", :alt => "Edit Entry") # =>
|
151
|
+
<img src="/public/images/icon.png" alt="Edit Entry" />
|
152
|
+
</pre>
|
153
|
+
|
154
|
+
<div class="sourcecode">
|
155
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000040_source')" id="l_M000040_source">show source</a> ]</p>
|
156
|
+
<div id="M000040_source" class="dyn-source">
|
157
|
+
<pre>
|
158
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/html.rb, line 73</span>
|
159
|
+
73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">image_tag</span>( <span class="ruby-identifier">source</span>, <span class="ruby-identifier">options</span> = {} )
|
160
|
+
74: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:src</span>] = <span class="ruby-node">"/public/images/#{source}"</span>
|
161
|
+
75: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:alt</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:src</span>], <span class="ruby-value str">'.*'</span>).<span class="ruby-identifier">split</span>(<span class="ruby-value str">'.'</span>).<span class="ruby-identifier">first</span>.<span class="ruby-identifier">capitalize</span>
|
162
|
+
76:
|
163
|
+
77: <span class="ruby-identifier">img</span>( <span class="ruby-identifier">options</span> )
|
164
|
+
78: <span class="ruby-keyword kw">end</span>
|
165
|
+
</pre>
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
<h4 class="ruled">Public Instance method:
|
169
|
+
<strong><a name="M000039">javascript_include_tag( *sources )</a></strong> <a href="#M000039"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: javascript_include_tag" /></a></h4>
|
170
|
+
|
171
|
+
<p>
|
172
|
+
Returns an html script tag for each of the <tt>sources</tt> provided. You
|
173
|
+
can pass in the filename (.js extension is optional) of javascript files
|
174
|
+
that exist in your public/javascripts directory for inclusion into the
|
175
|
+
current page. To include the Prototype and Scriptaculous javascript
|
176
|
+
libraries in your application, pass :defaults as the source.
|
177
|
+
</p>
|
178
|
+
<pre>
|
179
|
+
javascript_include_tag "xmlhr" # =>
|
180
|
+
<script type="text/javascript" src="/public/javascripts/xmlhr.js"></script>
|
181
|
+
|
182
|
+
javascript_include_tag "common.javascript", "elsewhere/cools" # =>
|
183
|
+
<script type="text/javascript" src="/public/javascripts/common.javascript"></script>
|
184
|
+
<script type="text/javascript" src="/public/javascripts/elsewhere/cools.js"></script>
|
185
|
+
</pre>
|
186
|
+
|
187
|
+
<div class="sourcecode">
|
188
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000039_source')" id="l_M000039_source">show source</a> ]</p>
|
189
|
+
<div id="M000039_source" class="dyn-source">
|
190
|
+
<pre>
|
191
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/html.rb, line 43</span>
|
192
|
+
43: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">javascript_include_tag</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">sources</span> )
|
193
|
+
44: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">sources</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">sources</span>.<span class="ruby-identifier">pop</span> <span class="ruby-operator">:</span> { }
|
194
|
+
45: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:type</span>] = <span class="ruby-value str">"text/javascript"</span>
|
195
|
+
46:
|
196
|
+
47: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sources</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:defaults</span>)
|
197
|
+
48: <span class="ruby-identifier">sources</span> = <span class="ruby-identifier">sources</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">sources</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">:defaults</span>))] <span class="ruby-operator">+</span>
|
198
|
+
49: <span class="ruby-ivar">@@javascript_default_sources</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">+</span>
|
199
|
+
50: <span class="ruby-identifier">sources</span>[(<span class="ruby-identifier">sources</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">:defaults</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)<span class="ruby-operator">..</span><span class="ruby-identifier">sources</span>.<span class="ruby-identifier">length</span>]
|
200
|
+
51:
|
201
|
+
52: <span class="ruby-identifier">sources</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:defaults</span>)
|
202
|
+
53: <span class="ruby-keyword kw">end</span>
|
203
|
+
54: <span class="ruby-identifier">sources</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
204
|
+
55: <span class="ruby-identifier">file</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">to_s</span>
|
205
|
+
56: <span class="ruby-identifier">file</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">".js"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">file</span>).<span class="ruby-identifier">blank?</span>
|
206
|
+
57: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:src</span>] = <span class="ruby-node">"/public/javascripts/#{file}"</span>
|
207
|
+
58: <span class="ruby-identifier">script</span>( <span class="ruby-identifier">options</span> ) {}
|
208
|
+
59: <span class="ruby-keyword kw">end</span>
|
209
|
+
60: <span class="ruby-keyword kw">end</span>
|
210
|
+
</pre>
|
211
|
+
</div>
|
212
|
+
</div>
|
213
|
+
<h4 class="ruled">Public Instance method:
|
214
|
+
<strong><a name="M000042">link_to(name, address, options = {})</a></strong> <a href="#M000042"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: link_to" /></a></h4>
|
215
|
+
|
216
|
+
<p>
|
217
|
+
Creates a link tag of the given <tt>name</tt> using <tt>address</tt> has
|
218
|
+
the href for the link
|
219
|
+
</p>
|
220
|
+
<p>
|
221
|
+
The <tt>options</tt> will accept a hash of html attributes for the link
|
222
|
+
tag. It also accepts 2 modifiers that specialize the link behavior.
|
223
|
+
</p>
|
224
|
+
<ul>
|
225
|
+
<li><tt>:confirm => ‘question?‘</tt>: This will add a JavaScript
|
226
|
+
confirm prompt with the question specified. If the user accepts, the link
|
227
|
+
is processed normally, otherwise no action is taken.
|
228
|
+
|
229
|
+
</li>
|
230
|
+
<li><tt>:popup => true || array of window options</tt>: This will force the
|
231
|
+
link to open in a popup window. By passing true, a default browser window
|
232
|
+
will be opened with the URL. You can also specify an array of options that
|
233
|
+
are passed-thru to JavaScripts window.open method.
|
234
|
+
|
235
|
+
</li>
|
236
|
+
</ul>
|
237
|
+
<p>
|
238
|
+
You can mix and match the <tt>options</tt>.
|
239
|
+
</p>
|
240
|
+
<pre>
|
241
|
+
link_to "Documentation", "http://camping.rubyforge.org/", :confirm => "Are you sure?"
|
242
|
+
link_to "Help", R( Help ), :popup => true
|
243
|
+
link_to image_tag( "thumb.png" ), "/public/images/fullsize.png", :popup => ['My house', 'height=300,width=600']
|
244
|
+
</pre>
|
245
|
+
|
246
|
+
<div class="sourcecode">
|
247
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000042_source')" id="l_M000042_source">show source</a> ]</p>
|
248
|
+
<div id="M000042_source" class="dyn-source">
|
249
|
+
<pre>
|
250
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/html.rb, line 116</span>
|
251
|
+
116: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">link_to</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">address</span>, <span class="ruby-identifier">options</span> = {})
|
252
|
+
117: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">javascript_options</span>( <span class="ruby-identifier">options</span> )
|
253
|
+
118: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:href</span>] = <span class="ruby-identifier">address</span>
|
254
|
+
119:
|
255
|
+
120: <span class="ruby-identifier">a</span>( <span class="ruby-identifier">options</span> ) <span class="ruby-keyword kw">do</span>; <span class="ruby-identifier">name</span>; <span class="ruby-keyword kw">end</span>
|
256
|
+
121: <span class="ruby-keyword kw">end</span>
|
257
|
+
</pre>
|
258
|
+
</div>
|
259
|
+
</div>
|
260
|
+
<h4 class="ruled">Public Instance method:
|
261
|
+
<strong><a name="M000038">stylesheet_link_tag( *data )</a></strong> <a href="#M000038"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: stylesheet_link_tag" /></a></h4>
|
262
|
+
|
263
|
+
<p>
|
264
|
+
Returns a stylesheet link tag for the sources specified as arguments. If
|
265
|
+
you don‘t specify an extension, .css will be appended automatically.
|
266
|
+
You can modify the link attributes by passing a hash as the last argument.
|
267
|
+
</p>
|
268
|
+
<pre>
|
269
|
+
stylesheet_link_tag "style" # =>
|
270
|
+
<link href="/public/stylesheets/style.css" media="screen" rel="Stylesheet" type="text/css" />
|
271
|
+
|
272
|
+
stylesheet_link_tag "style", :media => "all" # =>
|
273
|
+
<link href="/public/stylesheets/style.css" media="all" rel="Stylesheet" type="text/css" />
|
274
|
+
|
275
|
+
stylesheet_link_tag "random.styles", "/css/stylish" # =>
|
276
|
+
<link href="/public/stylesheets/random.styles" media="screen" rel="Stylesheet" type="text/css" />
|
277
|
+
<link href="/public/stylesheets/css/stylish.css" media="screen" rel="Stylesheet" type="text/css" />
|
278
|
+
</pre>
|
279
|
+
|
280
|
+
<div class="sourcecode">
|
281
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000038_source')" id="l_M000038_source">show source</a> ]</p>
|
282
|
+
<div id="M000038_source" class="dyn-source">
|
283
|
+
<pre>
|
284
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/html.rb, line 20</span>
|
285
|
+
20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stylesheet_link_tag</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">data</span> )
|
286
|
+
21: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">data</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">data</span>.<span class="ruby-identifier">pop</span> <span class="ruby-operator">:</span> { }
|
287
|
+
22: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:rel</span>] = <span class="ruby-value str">"Stylesheet"</span>
|
288
|
+
23: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:type</span>] = <span class="ruby-value str">"text/css"</span>
|
289
|
+
24: <span class="ruby-identifier">data</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
290
|
+
25: <span class="ruby-identifier">file</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">".css"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">file</span>).<span class="ruby-identifier">blank?</span>
|
291
|
+
26: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:href</span>] = <span class="ruby-node">"/public/stylesheets/#{file}"</span>
|
292
|
+
27: <span class="ruby-identifier">link</span>( <span class="ruby-identifier">options</span> )
|
293
|
+
28: <span class="ruby-keyword kw">end</span>
|
294
|
+
29: <span class="ruby-keyword kw">end</span>
|
295
|
+
</pre>
|
296
|
+
</div>
|
297
|
+
</div>
|
298
|
+
|
299
|
+
</div>
|
300
|
+
</div>
|
301
|
+
|
302
|
+
|
303
|
+
</div>
|
304
|
+
</body>
|
305
|
+
</html>
|