]> git.openstreetmap.org Git - rails.git/commitdiff
Redo mobile styles
authorJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 8 Nov 2013 01:04:44 +0000 (17:04 -0800)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 8 Nov 2013 01:25:03 +0000 (17:25 -0800)
app/assets/javascripts/application.js
app/assets/javascripts/index.js
app/assets/javascripts/index/export.js
app/assets/javascripts/index/history.js
app/assets/javascripts/index/search.js
app/assets/stylesheets/common.css.scss
app/assets/stylesheets/small.css.scss
app/views/layouts/_content.html.erb
app/views/layouts/_header.html.erb
app/views/layouts/map.html.erb
app/views/site/index.html.erb

index 83c17b6ecfca4281de4cf3a6652c5d78640dd76a..f1a13132c6b305bab642fef8c744a44ef09cb159 100644 (file)
@@ -131,7 +131,8 @@ $(document).ready(function () {
   var auth_token = $("meta[name=csrf-token]").attr("content");
   $("form input[name=authenticity_token]").val(auth_token);
 
-  $("#menu-icon").on("click", function() {
+  $("#menu-icon").on("click", function(e) {
+    e.preventDefault();
     $("header").toggleClass("closed");
   });
 
index 5cc3a25b86c291815d808b277b45f8fa60344733..2ed869905995753fecea8b6515c4f72ed63414cc 100644 (file)
@@ -234,11 +234,16 @@ $(document).ready(function () {
     var page = {};
 
     page.pushstate = page.popstate = function(path) {
-      $("#sidebar").addClass("minimized");
+      $("#content").addClass("overlay-sidebar");
       map.invalidateSize();
       $('#sidebar_content').load(path);
     };
 
+    page.unload = function() {
+      $("#content").removeClass("overlay-sidebar");
+      map.invalidateSize();
+    };
+
     return page;
   };
 
@@ -246,16 +251,12 @@ $(document).ready(function () {
     var page = {};
 
     page.pushstate = page.popstate = function(path, type, id) {
-      $("#sidebar").removeClass("minimized");
-      map.invalidateSize();
       $('#sidebar_content').load(path, function() {
         page.load(path, type, id);
       });
     };
 
     page.load = function(path, type, id) {
-      $("#sidebar").removeClass("minimized");
-
       if (OSM.STATUS === 'api_offline' || OSM.STATUS === 'database_offline') return;
 
       if (type === 'note') {
@@ -302,17 +303,4 @@ $(document).ready(function () {
       map.getCenter().lat.toFixed(precision) + "," +
       map.getCenter().lng.toFixed(precision)));
   });
-
-  function removeSidebar() {
-    if ($(window).width() < 721) {
-      $('#sidebar').addClass("minimized");
-    }
-  }
-
-  $(window).resize(function() {
-    removeSidebar();
-  });
-
-  removeSidebar();
-
 });
index 199f226f5e18b1e5713c610f870ad7e0798f73ed..413caea3f737aa666c37687d2583c36f78205598 100644 (file)
@@ -51,13 +51,10 @@ OSM.Export = function(map) {
 
   page.pushstate = page.popstate = function(path) {
     $("#export_tab").addClass("current");
-    $("#sidebar").removeClass("minimized");
-    map.invalidateSize();
     $("#sidebar_content").load(path, page.load);
   };
 
   page.load = function() {
-    $("#sidebar").removeClass("minimized");
     map
       .addLayer(locationFilter)
       .on("moveend", update);
index d27a069439233748cefee2a2b580c100c4f5f5e7..be62d37344d692b9797c749c6e55062e4fc69b36 100644 (file)
@@ -99,12 +99,10 @@ OSM.History = function(map) {
 
   page.pushstate = page.popstate = function(path) {
     $("#history_tab").addClass("current");
-    map.invalidateSize();
     $("#sidebar_content").load(path, page.load);
   };
 
   page.load = function() {
-    $("#sidebar").removeClass("minimized");
     map
       .on("moveend", loadData)
       .addLayer(group);
index 434135df50c21353489a4d289c8f0ef26c9299c9..c97b6991dfa0dc2cdcd7989aaff4124ccfedbcb4 100644 (file)
@@ -49,12 +49,10 @@ OSM.Search = function(map) {
   page.pushstate = page.popstate = function(path) {
     var params = querystring.parse(path.substring(path.indexOf('?') + 1));
     $("#query").val(params.query);
-    map.invalidateSize();
     $("#sidebar_content").load(path, page.load);
   };
 
   page.load = function() {
-    $("#sidebar").removeClass("minimized");
     $(".search_results_entry").each(function() {
       var entry = $(this);
       $.ajax({
index 313c535623d9593fc33282a72d690a7b18f675fb..e7b723d41506b80d0f9dc606378c859f926cf46f 100644 (file)
@@ -661,7 +661,7 @@ nav.secondary {
             transition: margin 300ms linear;
   }
 
-  #sidebar.minimized {
+  .overlay-sidebar #sidebar {
     position: absolute;
     z-index: 1000;
     height: auto;
index d6fb6f7580cfb54dc125360a5ae63b8385637133..2a85081718c16426b6c66c951f959f101c38e439 100644 (file)
@@ -1,21 +1,18 @@
 /* Styles specific to a small screen, such as iPhone, Android, etc... */
 
 input[type="submit"],
-input[type="text"] { -webkit-appearance: none; }
-
-/* Default rules for the body of every page */
+input[type="text"] {
+  -webkit-appearance: none;
+}
 
 .column-1 {
   width: 100%;
 }
 
-/* Rules for the whole left sidebar, including the logo */
-
 #menu-icon {
   display: inline-block !important;
 }
 
-
 nav.primary,
 nav.secondary {
   float: none !important;
@@ -25,32 +22,32 @@ nav.secondary {
 }
 
 header {
-  min-height: 54px;
   height: auto;
   background: #fff;
-  border-bottom: 1px solid #ddd;
-  clear: both;
-  position: fixed;
-  width: 100%;
-  top: 0;
-  h1 { padding-bottom: 15px; }
-  &.closed {
-    nav.primary,
-    nav.secondary {
-      display: none;
-    }
+
+  h1 {
+    padding-bottom: 15px;
+  }
+
+  &.closed nav {
+    display: none;
   }
 }
 
-.mobile-hide { display: none !important; }
+#edit_tab,
+#export_tab {
+  display: none;
+}
 
 nav.primary {
   padding: 0;
+
   ul, li {
     border: none;
     border-radius: 0;
     width: 100%;
   }
+
   ul {
     border-top: 1px solid #eee;
     li {
@@ -67,6 +64,8 @@ nav.primary {
 }
 
 nav.secondary {
+  border-bottom: 1px solid #eee;
+
   .user-menu {
     display: block;
     width: 100%;
@@ -84,42 +83,29 @@ nav.secondary {
 #compact-secondary-nav {
   display: none;
 }
+
 .compact-hide {
   display: inline-block;
 }
 
-#content { margin-top: 58px; }
-
 .map-layout {
-  #sidebar {
-    width: 100%;
-    position: fixed;
-    top: 58px;
-    height: 240px;
+  #sidebar, #map {
+    position: relative;
     overflow-x: hidden;
-    z-index: 1;
-    background: #fff;
-    p.large-text {
-      font-size: 1.2em;
-      line-height: 1.4em;
+    width: 100%;
+    height: 50%;
+  }
+
+  .overlay-sidebar {
+    #sidebar {
+      width: 300px;
     }
-    &.minimized {
-      background: none;
+
+    #map {
+      height: 100%;
     }
   }
-  #content {
-    position: fixed;
-    top: 0;
-    display: block;
-    height: 100%;
-    margin-top: 0;
-    padding-top: 58px;
-  }
-  #map {
-    width: 100%;
-    // height: 100%;
-    // position: fixed;
-  }
+
   #map-ui {
     z-index: 9999;
     width: 100%;
index 632a5c83961ab937feed1bfbad0feb3680bd94c6..a4d93cc0ec59027adc5a292858538c4f5024b758 100644 (file)
@@ -1,4 +1,4 @@
-<div id="content">
+<div id="content" class="<%= content_for :content_class %>">
   <% if content_for? :content %>
     <%= yield :content %>
   <% else %>
index 60a68a4888403cd0c39e523ed08382eacb515357..b0631b43127ead4dff1c6aa3f4c85541f2264ff1 100644 (file)
@@ -8,7 +8,7 @@
   <a href="#" id="menu-icon"></a>
   <nav class='primary'>
     <ul>
-      <li id="edit_tab" class="mobile-hide dropdown <%= current_page_class(edit_path) %>">
+      <li id="edit_tab" class="dropdown <%= current_page_class(edit_path) %>">
         <%= link_to t('layouts.edit'), edit_path, :class => "tab geolink object",
                     :id => 'editanchor',
                     :data => { :editor => preferred_editor }
@@ -27,7 +27,7 @@
       <li id="history_tab" class="<%= current_page_class(history_path) %>">
         <%= link_to t('layouts.history'), history_path, :class => 'tab geolink' %>
       </li>
-      <li id="export_tab" class="mobile-hide <%= current_page_class(export_path) %>">
+      <li id="export_tab" class="<%= current_page_class(export_path) %>">
         <%= link_to t('layouts.export'), export_path, :class => 'tab geolink' %>
       </li>
     </ul>
index 449e1e54879e0ca6b220fb5023f5ce5d6f31a8f8..524dc566f58f136c782c51deb62d9b202c6a5f87 100644 (file)
@@ -17,7 +17,7 @@
 <% end %>
 
 <% content_for :content do %>
-  <div id="sidebar" class="minimized">
+  <div id="sidebar">
     <%= form_tag search_path, :id => "search_form" do %>
       <%= submit_tag t('site.search.submit_text') %>
       <div id='query_wrapper'>
index 5eb2a66fe1c5a318ca812be6ed2aa0e49d726f44..8a6a5d85a9bb99e5cc6e38a8ffa9bed3bef841fe 100644 (file)
@@ -1,3 +1,5 @@
+<% content_for(:content_class) { "overlay-sidebar" } %>
+
 <% unless @user %>
   <div class="welcome">
     <h2><%= t 'layouts.intro_header' %></h2>