summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-10-15 14:31:52 +0200
committerAzul <azul@leap.se>2013-10-15 15:11:53 +0200
commit8e5aa5093ab6e67db4f603a44bb7027245b91a21 (patch)
treeba2de17a08c11619a74a0be6cf4c3939a2b9f223 /app/helpers
parent0acbf6a158f149c1f4273bde0cfca47547e080f8 (diff)
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.
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb23
1 files changed, 15 insertions, 8 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 1e79990..90e649a 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -19,18 +19,25 @@ module ApplicationHelper
# http://twitter.github.io/bootstrap/base-css.html#icons
#
def icon(name, color=nil)
+ "<i class=\"icon-#{name} #{color_class(color)}\"></i> ".html_safe
+ end
+
+ def big_icon(name, color=nil)
+ "<i class=\"big-icon-#{name} #{color_class(color)}\"></i> ".html_safe
+ end
+
+ def huge_icon(name, color=nil)
+ "<i class=\"huge-icon-#{name} #{color_class(color)}\"></i> ".html_safe
+ end
+
+ def color_class(color)
if color.nil?
- color_class = nil
+ nil
elsif color == :black
- color_class = 'icon-black'
+ 'icon-black'
elsif color == :white
- color_class = 'icon-white'
+ 'icon-white'
end
- "<i class=\"icon-#{name} #{color_class}\"></i> ".html_safe
- end
-
- def big_icon(name, color=nil)
- "<i class=\"big-icon-#{name}\"></i> ".html_safe
end
def format_flash(msg)