Blob of app/helpers/application_helper.rb (raw blob data)

1 # Methods added to this helper will be available to all templates in the application.
2 module ApplicationHelper
3 include TagsHelper
4
5 def default_css_tag_sizes
6 %w(tag_size_1 tag_size_2 tag_size_3 tag_size_4)
7 end
8
9 def linked_tag_list_as_sentence(tags)
10 tags.map do |tag|
11 link_to(h(tag.name), { :action => :category, :id => tag.name })
12 end.to_sentence
13 end
14
15 def build_notice_for(object)
16 out = %Q{<div class="being_constructed">}
17 out << %Q{ <p>This #{object.class.name.humanize.downcase} is being created,<br />}
18 out << %Q{ it will be ready pretty soon&hellip;</p>}
19 out << %Q{</div>}
20 out
21 end
22
23 def render_if_ready(object, &blk)
24 if object.respond_to?(:ready?) && object.ready?
25 yield
26 else
27 concat(build_notice_for(object), blk.binding)
28 end
29 end
30 end