From: John Firebaugh Date: Fri, 26 Oct 2012 18:05:26 +0000 (-0700) Subject: Make it easier to test RTL layout X-Git-Tag: live~5239 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/c426e8d160101faaa414330a0ccd641d03bef65a Make it easier to test RTL layout Instead of fiddling with settings so the site appears in Arabic or Hebrew, you can add a dir=rtl param to the URL. --- diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e0c299ca5..000677646 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -87,4 +87,12 @@ module ApplicationHelper end end end + + def dir + if dir = params[:dir] + dir == "rtl" ? "rtl" : "ltr" + else + I18n.t("html.dir") + end + end end diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index c85594189..88ad3eb39 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -2,10 +2,10 @@ <%= javascript_include_tag "application" %> - <%= stylesheet_link_tag "small-#{t 'html.dir'}", :media => "only screen and (max-width:641px)" %> - <%= stylesheet_link_tag "large-#{t 'html.dir'}", :media => "screen and (min-width: 642px)" %> - <%= stylesheet_link_tag "print-#{t 'html.dir'}", :media => "print" %> - + <%= stylesheet_link_tag "small-#{dir}", :media => "only screen and (max-width:641px)" %> + <%= stylesheet_link_tag "large-#{dir}", :media => "screen and (min-width: 642px)" %> + <%= stylesheet_link_tag "print-#{dir}", :media => "print" %> + <%= favicon_link_tag "favicon.ico" %> <%= favicon_link_tag "osm_logo.png", :rel => "apple-touch-icon", :type => "image/png" %> <%= tag("link", { :rel => "publisher", :href => "https://plus.google.com/111953119785824514010" }) %> diff --git a/app/views/layouts/site.html.erb b/app/views/layouts/site.html.erb index cee35efb6..f1ae440e7 100644 --- a/app/views/layouts/site.html.erb +++ b/app/views/layouts/site.html.erb @@ -1,5 +1,5 @@ - + <%= render :partial => "layouts/head" %>
diff --git a/app/views/layouts/slim.html.erb b/app/views/layouts/slim.html.erb index 862f55d87..ba02104f4 100644 --- a/app/views/layouts/slim.html.erb +++ b/app/views/layouts/slim.html.erb @@ -1,5 +1,5 @@ - + <%= render :partial => "layouts/head" %>