From 8e5aa5093ab6e67db4f603a44bb7027245b91a21 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 15 Oct 2013 14:31:52 +0200 Subject: detect os in browser and show proper download link We add a class to the html element based on the detected os and use that to pick which download link should be visible. If we detect an os that is not supported we display a deactivated download link instead with all alternatives. --- core/app/views/common/_download_for_os.html.haml | 16 ++++++++++++++++ core/app/views/common/_home_page_buttons.html.haml | 5 ++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 core/app/views/common/_download_for_os.html.haml (limited to 'core/app/views/common') diff --git a/core/app/views/common/_download_for_os.html.haml b/core/app/views/common/_download_for_os.html.haml new file mode 100644 index 0000000..b7c88ba --- /dev/null +++ b/core/app/views/common/_download_for_os.html.haml @@ -0,0 +1,16 @@ +- os = download_for_os +%div{:class => "os-#{os}"} + %span.link + - btn_class = (os == "other") ? "disabled" : "btn-primary" + = link_to client_download_url(os), :class => "btn btn-large #{btn_class}" do + .pull-left= huge_icon('mask') + = t(:download_client) + %br/ + %small= I18n.t("os.#{os}") + %span.info + = t(:client_info, :provider => content_tag(:b,APP_CONFIG[:domain])).html_safe + %br/ + - if os == "other" + = t(:all_downloads_info, :clients => alternative_client_links(os).to_sentence).html_safe + - else + = t(:other_downloads_info, :clients => alternative_client_links(os).to_sentence).html_safe diff --git a/core/app/views/common/_home_page_buttons.html.haml b/core/app/views/common/_home_page_buttons.html.haml index 7eb4c40..b87c867 100644 --- a/core/app/views/common/_home_page_buttons.html.haml +++ b/core/app/views/common/_home_page_buttons.html.haml @@ -1,11 +1,10 @@ - icon_color = :black -.home-buttons +.home-buttons.linux64 .row-fluid.first .span3 .download.span6 - %span.link= link_to(big_icon('arrow-down', icon_color) + t(:download_client), "https://downloads.leap.se/client", :class => 'btn btn-large') - %span.info= t(:download_client_info, :provider => content_tag(:b,APP_CONFIG[:domain])).html_safe + = render partial: 'common/download_for_os', collection: available_clients + ['other'] .span3 .row-fluid.second .login.span4 -- cgit v1.2.3 From 4618bf296e735f47561dc1ddcccaaa701cae9daa Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 16 Oct 2013 11:25:58 +0200 Subject: remove leftover from testing os specific sections --- core/app/views/common/_home_page_buttons.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/app/views/common') diff --git a/core/app/views/common/_home_page_buttons.html.haml b/core/app/views/common/_home_page_buttons.html.haml index b87c867..e10fd38 100644 --- a/core/app/views/common/_home_page_buttons.html.haml +++ b/core/app/views/common/_home_page_buttons.html.haml @@ -1,6 +1,6 @@ - icon_color = :black -.home-buttons.linux64 +.home-buttons .row-fluid.first .span3 .download.span6 -- cgit v1.2.3 From 108938615ff7490080f80ea2d6bd1cd8037cdd84 Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 14 Nov 2013 02:19:57 -0800 Subject: minor improvements to the download button (proper localization, better image, better hooks for customization) --- core/app/views/common/_download_for_os.html.haml | 4 ++-- core/app/views/common/_home_page_buttons.html.haml | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'core/app/views/common') diff --git a/core/app/views/common/_download_for_os.html.haml b/core/app/views/common/_download_for_os.html.haml index b7c88ba..4c096ce 100644 --- a/core/app/views/common/_download_for_os.html.haml +++ b/core/app/views/common/_download_for_os.html.haml @@ -8,8 +8,8 @@ %br/ %small= I18n.t("os.#{os}") %span.info - = t(:client_info, :provider => content_tag(:b,APP_CONFIG[:domain])).html_safe - %br/ + %div= t(:client_info, :provider => content_tag(:b,APP_CONFIG[:domain])).html_safe + %div - if os == "other" = t(:all_downloads_info, :clients => alternative_client_links(os).to_sentence).html_safe - else diff --git a/core/app/views/common/_home_page_buttons.html.haml b/core/app/views/common/_home_page_buttons.html.haml index e10fd38..3be12e2 100644 --- a/core/app/views/common/_home_page_buttons.html.haml +++ b/core/app/views/common/_home_page_buttons.html.haml @@ -2,10 +2,14 @@ .home-buttons .row-fluid.first - .span3 - .download.span6 + .span2 + .download.span8 = render partial: 'common/download_for_os', collection: available_clients + ['other'] - .span3 + .span2 + - if local_assigns[:divider] + .row-fluid + .span12 + = render local_assigns[:divider] .row-fluid.second .login.span4 %span.link= link_to(icon('ok-sign', icon_color) + t(:login), login_path, :class => 'btn') -- cgit v1.2.3