suck it! one down, lots to go.
[kwestie.git] / app / helpers / application_helper.rb
blobfe85287635c2f6d05ccffe699fbb10a504a479ff
1 # Methods added to this helper will be available to all templates in the application.
2 module ApplicationHelper
3   def form_label(obj, meth, str)
4     '<label for="%s_%s">%s</label>' % [ obj, meth, str ]
5   end
7   def focus(field_name)
8     %{
9     <script type="text/javascript">
10     // <![CDATA[
11           Field.activate('#{field_name}');
12     // ]]>
13     </script>
14     }
15   end
17   def hCard(user)
18     %{
19     <span class="vcard">
20       #{link_to user.display_name, user_url(user), :class => "author url fn nickname"}
21     </span>
22     }
23   end
25   def nice_permalink_url(issue)
26     nice_permalink_route_url( :year => issue.year, :month => issue.month, :day => issue.day, :permalink => issue.permalink.link_name )
27   end
29   def nice_permalink_path(issue)
30     nice_permalink_route_path( :year => issue.year, :month => issue.month, :day => issue.day, :permalink => issue.permalink.link_name )
31   end
33   # FIXME: we'll probably need to do a bit more sanitizing than this later
34   def format_description(desc)
35     auto_link(simple_format(desc), :all, :target => '_blank')
36   end
37 end