summaryrefslogtreecommitdiff
path: root/core/app/helpers/download_helper.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-10-18 09:50:37 +0200
committerAzul <azul@leap.se>2013-10-18 09:53:41 +0200
commit1384f6c43dde6a19f270416e34e39130a3d0a53d (patch)
tree424526c0fdebe43209fdf65adcde549bb5cd3e0d /core/app/helpers/download_helper.rb
parent221532448ba4c435427ad2b5b3eca729b352c354 (diff)
Make download links configurable
This way we won't have to redeploy once the new links to the windows and the android version are there. Also this obviously offers more flexibility for providers.
Diffstat (limited to 'core/app/helpers/download_helper.rb')
-rw-r--r--core/app/helpers/download_helper.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/core/app/helpers/download_helper.rb b/core/app/helpers/download_helper.rb
new file mode 100644
index 0000000..f9c6c40
--- /dev/null
+++ b/core/app/helpers/download_helper.rb
@@ -0,0 +1,33 @@
+module DownloadHelper
+
+ def alternative_client_links(os = nil)
+ alternative_clients(os).map do |client|
+ link_to(client.capitalize, 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