diff options
author | jessib <jessib@riseup.net> | 2013-10-15 11:10:31 -0700 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2013-10-15 11:10:31 -0700 |
commit | a6f196d0bfe632408db7350829507478b825b1a8 (patch) | |
tree | ba2de17a08c11619a74a0be6cf4c3939a2b9f223 /core/app/helpers | |
parent | 0acbf6a158f149c1f4273bde0cfca47547e080f8 (diff) | |
parent | 8e5aa5093ab6e67db4f603a44bb7027245b91a21 (diff) |
Merge pull request #99 from azul/feature/os-detection
detect os in browser and show proper download link
Diffstat (limited to 'core/app/helpers')
-rw-r--r-- | core/app/helpers/core_helper.rb | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/core/app/helpers/core_helper.rb b/core/app/helpers/core_helper.rb index a496144..29a4700 100644 --- a/core/app/helpers/core_helper.rb +++ b/core/app/helpers/core_helper.rb @@ -10,4 +10,40 @@ module CoreHelper render 'common/home_page_buttons' end -end
\ No newline at end of file + def available_clients + CLIENT_AVAILABILITY + end + + 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) + CLIENT_AVAILABILITY - [os] + end + + def client_download_url(os = nil) + client_download_domain(os) + client_download_path(os) + end + + def client_download_domain(os) + "https://downloads.leap.se" + end + + def client_download_path(os) + CLIENT_DOWNLOAD_PATHS[os] || '/client' + end + + + CLIENT_AVAILABILITY = %w/linux32 linux64 mac windows android/ + CLIENT_DOWNLOAD_PATHS = { + android: '/client/android', + linux: '/client/linux', + linux32: '/client/linux/Bitmask-linux32-latest.tar.bz2', + linux64: '/client/linux/Bitmask-linux64-latest.tar.bz2', + osx: '/client/osx/Bitmask-OSC-latest.dmg', + windows: '/client/windows' + }.with_indifferent_access +end |