Adding some documentation.
[lyrix.git] / doc / app / classes / ApplicationHelper.html
blobd642e3f5bf902225917601de9d667bdd2c28c760
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE html
3 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7 <head>
8 <title>Module: ApplicationHelper</title>
9 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10 <meta http-equiv="Content-Script-Type" content="text/javascript" />
11 <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12 <script type="text/javascript">
13 // <![CDATA[
15 function popupCode( url ) {
16 window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
19 function toggleCode( id ) {
20 if ( document.getElementById )
21 elem = document.getElementById( id );
22 else if ( document.all )
23 elem = eval( "document.all." + id );
24 else
25 return false;
27 elemStyle = elem.style;
29 if ( elemStyle.display != "block" ) {
30 elemStyle.display = "block"
31 } else {
32 elemStyle.display = "none"
35 return true;
38 // Make codeblocks hidden by default
39 document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
41 // ]]>
42 </script>
44 </head>
45 <body>
49 <div id="classHeader">
50 <table class="header-table">
51 <tr class="top-aligned-row">
52 <td><strong>Module</strong></td>
53 <td class="class-name-in-header">ApplicationHelper</td>
54 </tr>
55 <tr class="top-aligned-row">
56 <td><strong>In:</strong></td>
57 <td>
58 <a href="../files/app/helpers/application_helper_rb.html">
59 app/helpers/application_helper.rb
60 </a>
61 <br />
62 </td>
63 </tr>
65 </table>
66 </div>
67 <!-- banner header -->
69 <div id="bodyContent">
73 <div id="contextContent">
75 <div id="description">
76 <p>
77 Methods added to this helper will be available to all templates in the
78 application.
79 </p>
81 </div>
84 </div>
86 <div id="method-list">
87 <h3 class="section-bar">Methods</h3>
89 <div class="name-list">
90 <a href="#M000057">all_shows</a>&nbsp;&nbsp;
91 <a href="#M000056">all_songs</a>&nbsp;&nbsp;
92 <a href="#M000055">class_for_show</a>&nbsp;&nbsp;
93 <a href="#M000054">class_for_song</a>&nbsp;&nbsp;
94 <a href="#M000058">in_place_options</a>&nbsp;&nbsp;
95 <a href="#M000059">notice_options</a>&nbsp;&nbsp;
96 </div>
97 </div>
99 </div>
102 <!-- if includes -->
104 <div id="section">
113 <!-- if method_list -->
114 <div id="methods">
115 <h3 class="section-bar">Public Instance methods</h3>
117 <div id="method-M000057" class="method-detail">
118 <a name="M000057"></a>
120 <div class="method-heading">
121 <a href="#M000057" class="method-signature">
122 <span class="method-name">all_shows</span><span class="method-args">()</span>
123 </a>
124 </div>
126 <div class="method-description">
127 <p><a class="source-toggle" href="#"
128 onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
129 <div class="method-source-code" id="M000057-source">
130 <pre>
131 <span class="ruby-comment cmt"># File app/helpers/application_helper.rb, line 15</span>
132 15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all_shows</span>
133 16: <span class="ruby-identifier">logged_in?</span> <span class="ruby-value">? </span><span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">shows</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'created_at DESC'</span>) <span class="ruby-operator">:</span> []
134 17: <span class="ruby-keyword kw">end</span>
135 </pre>
136 </div>
137 </div>
138 </div>
140 <div id="method-M000056" class="method-detail">
141 <a name="M000056"></a>
143 <div class="method-heading">
144 <a href="#M000056" class="method-signature">
145 <span class="method-name">all_songs</span><span class="method-args">()</span>
146 </a>
147 </div>
149 <div class="method-description">
150 <p><a class="source-toggle" href="#"
151 onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
152 <div class="method-source-code" id="M000056-source">
153 <pre>
154 <span class="ruby-comment cmt"># File app/helpers/application_helper.rb, line 11</span>
155 11: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all_songs</span>
156 12: <span class="ruby-identifier">logged_in?</span> <span class="ruby-value">? </span><span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">songs</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'title'</span>) <span class="ruby-operator">:</span> []
157 13: <span class="ruby-keyword kw">end</span>
158 </pre>
159 </div>
160 </div>
161 </div>
163 <div id="method-M000055" class="method-detail">
164 <a name="M000055"></a>
166 <div class="method-heading">
167 <a href="#M000055" class="method-signature">
168 <span class="method-name">class_for_show</span><span class="method-args">(show)</span>
169 </a>
170 </div>
172 <div class="method-description">
173 <p><a class="source-toggle" href="#"
174 onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
175 <div class="method-source-code" id="M000055-source">
176 <pre>
177 <span class="ruby-comment cmt"># File app/helpers/application_helper.rb, line 7</span>
178 7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">class_for_show</span>(<span class="ruby-identifier">show</span>)
179 8: (<span class="ruby-operator">!</span><span class="ruby-ivar">@show</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@show</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">show</span>.<span class="ruby-identifier">id</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">'current show'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'show'</span>
180 9: <span class="ruby-keyword kw">end</span>
181 </pre>
182 </div>
183 </div>
184 </div>
186 <div id="method-M000054" class="method-detail">
187 <a name="M000054"></a>
189 <div class="method-heading">
190 <a href="#M000054" class="method-signature">
191 <span class="method-name">class_for_song</span><span class="method-args">(song)</span>
192 </a>
193 </div>
195 <div class="method-description">
196 <p><a class="source-toggle" href="#"
197 onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
198 <div class="method-source-code" id="M000054-source">
199 <pre>
200 <span class="ruby-comment cmt"># File app/helpers/application_helper.rb, line 3</span>
201 3: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">class_for_song</span>(<span class="ruby-identifier">song</span>)
202 4: (<span class="ruby-operator">!</span><span class="ruby-ivar">@song</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@song</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">song</span>.<span class="ruby-identifier">id</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">'current song'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'song'</span>
203 5: <span class="ruby-keyword kw">end</span>
204 </pre>
205 </div>
206 </div>
207 </div>
209 <div id="method-M000058" class="method-detail">
210 <a name="M000058"></a>
212 <div class="method-heading">
213 <a href="#M000058" class="method-signature">
214 <span class="method-name">in_place_options</span><span class="method-args">(object, method)</span>
215 </a>
216 </div>
218 <div class="method-description">
219 <p><a class="source-toggle" href="#"
220 onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
221 <div class="method-source-code" id="M000058-source">
222 <pre>
223 <span class="ruby-comment cmt"># File app/helpers/application_helper.rb, line 19</span>
224 19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">in_place_options</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>)
225 20: <span class="ruby-identifier">object_type</span> = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">underscore</span>
226 21: {<span class="ruby-identifier">:class</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;in_place_editor_field&quot;</span>, <span class="ruby-identifier">:id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{object_type}_#{method}_#{object.id}_in_place_editor&quot;</span>}
227 22: <span class="ruby-keyword kw">end</span>
228 </pre>
229 </div>
230 </div>
231 </div>
233 <div id="method-M000059" class="method-detail">
234 <a name="M000059"></a>
236 <div class="method-heading">
237 <a href="#M000059" class="method-signature">
238 <span class="method-name">notice_options</span><span class="method-args">()</span>
239 </a>
240 </div>
242 <div class="method-description">
243 <p><a class="source-toggle" href="#"
244 onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
245 <div class="method-source-code" id="M000059-source">
246 <pre>
247 <span class="ruby-comment cmt"># File app/helpers/application_helper.rb, line 24</span>
248 24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">notice_options</span>
249 25: <span class="ruby-identifier">default_options</span> = {<span class="ruby-identifier">:id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'notice'</span>}
250 26: <span class="ruby-identifier">flash</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">:notice</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">default_options</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">default_options</span>.<span class="ruby-identifier">merge</span>({<span class="ruby-identifier">:style</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'display: none'</span>})
251 27: <span class="ruby-keyword kw">end</span>
252 </pre>
253 </div>
254 </div>
255 </div>
258 </div>
261 </div>
264 <div id="validator-badges">
265 <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
266 </div>
268 </body>
269 </html>