Module: CartoonistHelper
- Defined in:
- app/helpers/cartoonist_helper.rb
Instance Method Summary collapse
- #checked(a, b = true) ⇒ Object
- #content_license_url ⇒ Object
- #copyright_message ⇒ Object
- #enable_disqus!(options) ⇒ Object
- #format_time(time, fmt) ⇒ Object
- #licensed! ⇒ Object
- #licensed? ⇒ Boolean
- #markdown(text) ⇒ Object
- #partial(name, locals = {}, &block) ⇒ Object
- #preview? ⇒ Boolean
- #rss!(path, title) ⇒ Object
- #rss? ⇒ Boolean
- #rss_path ⇒ Object
- #rss_title ⇒ Object
- #selected(a, b = true) ⇒ Object
Instance Method Details
#checked(a, b = true) ⇒ Object
17 18 19 20 21 |
# File 'app/helpers/cartoonist_helper.rb', line 17 def checked(a, b = true) if a == b 'checked="checked"'.html_safe end end |
#content_license_url ⇒ Object
67 68 69 |
# File 'app/helpers/cartoonist_helper.rb', line 67 def content_license_url "http://creativecommons.org/licenses/by-nc/3.0/" end |
#copyright_message ⇒ Object
71 72 73 74 75 76 |
# File 'app/helpers/cartoonist_helper.rb', line 71 def year = Date.today.strftime "%Y" copyright_years = Setting[:copyright_starting_year].to_s copyright_years = "#{copyright_years}-#{year}" if year != copyright_years "© #{h copyright_years} #{h Setting[:copyright_owners]}".html_safe end |
#enable_disqus!(options) ⇒ Object
58 59 60 61 |
# File 'app/helpers/cartoonist_helper.rb', line 58 def enable_disqus!() @disqus_enabled = true @disqus_options = end |
#format_time(time, fmt) ⇒ Object
23 24 25 26 27 |
# File 'app/helpers/cartoonist_helper.rb', line 23 def format_time(time, fmt) if time time.localtime.strftime fmt end end |
#licensed! ⇒ Object
33 34 35 |
# File 'app/helpers/cartoonist_helper.rb', line 33 def licensed! @licensed = true end |
#licensed? ⇒ Boolean
37 38 39 |
# File 'app/helpers/cartoonist_helper.rb', line 37 def licensed? @licensed end |
#markdown(text) ⇒ Object
29 30 31 |
# File 'app/helpers/cartoonist_helper.rb', line 29 def markdown(text) Markdown.render text end |
#partial(name, locals = {}, &block) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'app/helpers/cartoonist_helper.rb', line 2 def partial(name, locals = {}, &block) if block raise "Cannot have a 'body' local when a block is given!" if locals.include?(:body) locals[:body] = capture &block end render :partial => name, :locals => locals end |
#preview? ⇒ Boolean
63 64 65 |
# File 'app/helpers/cartoonist_helper.rb', line 63 def preview? @for_preview end |
#rss!(path, title) ⇒ Object
41 42 43 44 |
# File 'app/helpers/cartoonist_helper.rb', line 41 def rss!(path, title) @rss_path = path @rss_title = title end |
#rss? ⇒ Boolean
46 47 48 |
# File 'app/helpers/cartoonist_helper.rb', line 46 def rss? @rss_path end |
#rss_path ⇒ Object
50 51 52 |
# File 'app/helpers/cartoonist_helper.rb', line 50 def rss_path @rss_path end |
#rss_title ⇒ Object
54 55 56 |
# File 'app/helpers/cartoonist_helper.rb', line 54 def rss_title @rss_title end |
#selected(a, b = true) ⇒ Object
11 12 13 14 15 |
# File 'app/helpers/cartoonist_helper.rb', line 11 def selected(a, b = true) if a == b 'selected="selected"'.html_safe end end |