summaryrefslogtreecommitdiff
path: root/app/helpers/download_helper.rb
blob: ee0fe732d247ad08a8b12291f6132ce148d1998b (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
33
module DownloadHelper

  def alternative_client_links(os = nil)
    alternative_clients(os).map do |client|
      link_to(I18n.t("os."+client), client_download_url(client))
    end
  end

  def alternative_clients(os = nil)
    available_clients - [os]
  end

  def client_download_url(os = nil)
    client_download_domain + client_download_path(os)
  end

  def client_download_path(os)
    download_paths[os.to_s] || download_paths['other'] || ''
  end

  def available_clients
    APP_CONFIG[:available_clients] || []
  end

  def client_download_domain
    APP_CONFIG[:client_download_domain] || ''
  end

  def download_paths
    APP_CONFIG[:download_paths] || {}
  end

end