Last active
August 29, 2015 14:00
-
-
Save workmad3/11402534 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LayoutLookup | |
attr_reader :override_css, :ie_ver | |
def initialize | |
@override_css = '' | |
@ie_ver = nil | |
end | |
def [](landing) | |
case landing | |
when "index", "index_b", "index_a" | |
'signup' | |
when /index_fs_grid/ | |
@ie_ver = 9 | |
'signup_fs' | |
when /^whitney_\w+$/, /^bb\w+$/ | |
'signup2' | |
when /^af_alt_\w+$/ | |
'signup_alt' | |
when /sugardaddy/ | |
'sugardaddy' | |
when /established_meet/ | |
@override_css = 'signup/meet' | |
'meet' | |
when /^index_\w+$/, /^index_fs_\w+$/, /big_men/ | |
'signup_fs' | |
else # no match, set default, match again | |
default_layout | |
end | |
end | |
def default_layout | |
false | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_desktop_landing_layout | |
lookup = LayoutLookup.new | |
params[:layout] = lookup[params[:landing]] | |
@ie_ver = lookup.ie_ver | |
override_css(lookup.override_css) unless lookup.override_css.blank? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment