summaryrefslogtreecommitdiff
path: root/app/helpers/core_helper.rb
blob: f34d2f2ca3885ac3c99316b047b27b3f84d9b0ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#
# Misc. helpers needed throughout.
#
module CoreHelper

  #
  # insert common buttons (download, login, etc)
  #
  def home_page_buttons
    render 'common/home_page_buttons'
  end

  #
  # returns true if the configured service levels contain a level with a price attached
  #
  def paid_service_level?
    APP_CONFIG[:service_levels].present? && APP_CONFIG[:service_levels].detect{|k,v| v['rate'].present?}
  end

  #
  # a bunch of links to the different languages that are available.
  #
  def locales_links
    CommonLanguages.available.collect { |lang|
      link_to(lang.name,
        {:action => params[:action], :controller => params[:controller], :locale => lang.code},
        {:class => (lang.code == I18n.locale ? 'locale active' : 'locale')}
      )
    }.join(" ").html_safe
  end

end