1 <?xml version=
"1.0" encoding=
"iso-8859-1"?>
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">
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">
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 );
27 elemStyle = elem.style;
29 if ( elemStyle.display !=
"block" ) {
30 elemStyle.display =
"block"
32 elemStyle.display =
"none"
38 // Make codeblocks hidden by default
39 document.writeln(
"<style type=\"text/css\
">div.method-source-code { display: none }</style>" )
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>
55 <tr class=
"top-aligned-row">
56 <td><strong>In:
</strong></td>
58 <a href=
"../files/app/helpers/application_helper_rb.html">
59 app/helpers/application_helper.rb
67 <!-- banner header -->
69 <div id=
"bodyContent">
73 <div id=
"contextContent">
75 <div id=
"description">
77 Methods added to this helper will be available to all templates in the
86 <div id=
"method-list">
87 <h3 class=
"section-bar">Methods
</h3>
89 <div class=
"name-list">
90 <a href=
"#M000057">all_shows
</a>
91 <a href=
"#M000056">all_songs
</a>
92 <a href=
"#M000055">class_for_show
</a>
93 <a href=
"#M000054">class_for_song
</a>
94 <a href=
"#M000058">in_place_options
</a>
95 <a href=
"#M000059">notice_options
</a>
113 <!-- if method_list -->
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>
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">
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">></span> <span class=
"ruby-value str">'created_at DESC'
</span>)
<span class=
"ruby-operator">:
</span> []
134 17:
<span class=
"ruby-keyword kw">end
</span>
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>
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">
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">></span> <span class=
"ruby-value str">'title'
</span>)
<span class=
"ruby-operator">:
</span> []
157 13:
<span class=
"ruby-keyword kw">end
</span>
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>
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">
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>
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>
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">
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>
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>
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">
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">></span> <span class=
"ruby-value str">"in_place_editor_field
"</span>,
<span class=
"ruby-identifier">:id
</span> =
<span class=
"ruby-operator">></span> <span class=
"ruby-node">"#{object_type}_#{method}_#{object.id}_in_place_editor
"</span>}
227 22:
<span class=
"ruby-keyword kw">end
</span>
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>
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">
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">></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">></span> <span class=
"ruby-value str">'display: none'
</span>})
251 27:
<span class=
"ruby-keyword kw">end
</span>
264 <div id=
"validator-badges">
265 <p><small><a href=
"http://validator.w3.org/check/referer">[Validate]
</a></small></p>