Redo mobile styles

This commit is contained in:
John Firebaugh 2013-11-07 17:04:44 -08:00
parent 040804335d
commit cdfe2ac21e
11 changed files with 48 additions and 78 deletions

View file

@ -131,7 +131,8 @@ $(document).ready(function () {
var auth_token = $("meta[name=csrf-token]").attr("content"); var auth_token = $("meta[name=csrf-token]").attr("content");
$("form input[name=authenticity_token]").val(auth_token); $("form input[name=authenticity_token]").val(auth_token);
$("#menu-icon").on("click", function() { $("#menu-icon").on("click", function(e) {
e.preventDefault();
$("header").toggleClass("closed"); $("header").toggleClass("closed");
}); });

View file

@ -234,11 +234,16 @@ $(document).ready(function () {
var page = {}; var page = {};
page.pushstate = page.popstate = function(path) { page.pushstate = page.popstate = function(path) {
$("#sidebar").addClass("minimized"); $("#content").addClass("overlay-sidebar");
map.invalidateSize(); map.invalidateSize();
$('#sidebar_content').load(path); $('#sidebar_content').load(path);
}; };
page.unload = function() {
$("#content").removeClass("overlay-sidebar");
map.invalidateSize();
};
return page; return page;
}; };
@ -246,16 +251,12 @@ $(document).ready(function () {
var page = {}; var page = {};
page.pushstate = page.popstate = function(path, type, id) { page.pushstate = page.popstate = function(path, type, id) {
$("#sidebar").removeClass("minimized");
map.invalidateSize();
$('#sidebar_content').load(path, function() { $('#sidebar_content').load(path, function() {
page.load(path, type, id); page.load(path, type, id);
}); });
}; };
page.load = function(path, type, id) { page.load = function(path, type, id) {
$("#sidebar").removeClass("minimized");
if (OSM.STATUS === 'api_offline' || OSM.STATUS === 'database_offline') return; if (OSM.STATUS === 'api_offline' || OSM.STATUS === 'database_offline') return;
if (type === 'note') { if (type === 'note') {
@ -302,17 +303,4 @@ $(document).ready(function () {
map.getCenter().lat.toFixed(precision) + "," + map.getCenter().lat.toFixed(precision) + "," +
map.getCenter().lng.toFixed(precision))); map.getCenter().lng.toFixed(precision)));
}); });
function removeSidebar() {
if ($(window).width() < 721) {
$('#sidebar').addClass("minimized");
}
}
$(window).resize(function() {
removeSidebar();
});
removeSidebar();
}); });

View file

@ -51,13 +51,10 @@ OSM.Export = function(map) {
page.pushstate = page.popstate = function(path) { page.pushstate = page.popstate = function(path) {
$("#export_tab").addClass("current"); $("#export_tab").addClass("current");
$("#sidebar").removeClass("minimized");
map.invalidateSize();
$("#sidebar_content").load(path, page.load); $("#sidebar_content").load(path, page.load);
}; };
page.load = function() { page.load = function() {
$("#sidebar").removeClass("minimized");
map map
.addLayer(locationFilter) .addLayer(locationFilter)
.on("moveend", update); .on("moveend", update);

View file

@ -99,12 +99,10 @@ OSM.History = function(map) {
page.pushstate = page.popstate = function(path) { page.pushstate = page.popstate = function(path) {
$("#history_tab").addClass("current"); $("#history_tab").addClass("current");
map.invalidateSize();
$("#sidebar_content").load(path, page.load); $("#sidebar_content").load(path, page.load);
}; };
page.load = function() { page.load = function() {
$("#sidebar").removeClass("minimized");
map map
.on("moveend", loadData) .on("moveend", loadData)
.addLayer(group); .addLayer(group);

View file

@ -49,12 +49,10 @@ OSM.Search = function(map) {
page.pushstate = page.popstate = function(path) { page.pushstate = page.popstate = function(path) {
var params = querystring.parse(path.substring(path.indexOf('?') + 1)); var params = querystring.parse(path.substring(path.indexOf('?') + 1));
$("#query").val(params.query); $("#query").val(params.query);
map.invalidateSize();
$("#sidebar_content").load(path, page.load); $("#sidebar_content").load(path, page.load);
}; };
page.load = function() { page.load = function() {
$("#sidebar").removeClass("minimized");
$(".search_results_entry").each(function() { $(".search_results_entry").each(function() {
var entry = $(this); var entry = $(this);
$.ajax({ $.ajax({

View file

@ -661,7 +661,7 @@ nav.secondary {
transition: margin 300ms linear; transition: margin 300ms linear;
} }
#sidebar.minimized { .overlay-sidebar #sidebar {
position: absolute; position: absolute;
z-index: 1000; z-index: 1000;
height: auto; height: auto;

View file

@ -1,21 +1,18 @@
/* Styles specific to a small screen, such as iPhone, Android, etc... */ /* Styles specific to a small screen, such as iPhone, Android, etc... */
input[type="submit"], input[type="submit"],
input[type="text"] { -webkit-appearance: none; } input[type="text"] {
-webkit-appearance: none;
/* Default rules for the body of every page */ }
.column-1 { .column-1 {
width: 100%; width: 100%;
} }
/* Rules for the whole left sidebar, including the logo */
#menu-icon { #menu-icon {
display: inline-block !important; display: inline-block !important;
} }
nav.primary, nav.primary,
nav.secondary { nav.secondary {
float: none !important; float: none !important;
@ -25,32 +22,32 @@ nav.secondary {
} }
header { header {
min-height: 54px;
height: auto; height: auto;
background: #fff; background: #fff;
border-bottom: 1px solid #ddd;
clear: both; h1 {
position: fixed; padding-bottom: 15px;
width: 100%; }
top: 0;
h1 { padding-bottom: 15px; } &.closed nav {
&.closed { display: none;
nav.primary,
nav.secondary {
display: none;
}
} }
} }
.mobile-hide { display: none !important; } #edit_tab,
#export_tab {
display: none;
}
nav.primary { nav.primary {
padding: 0; padding: 0;
ul, li { ul, li {
border: none; border: none;
border-radius: 0; border-radius: 0;
width: 100%; width: 100%;
} }
ul { ul {
border-top: 1px solid #eee; border-top: 1px solid #eee;
li { li {
@ -67,6 +64,8 @@ nav.primary {
} }
nav.secondary { nav.secondary {
border-bottom: 1px solid #eee;
.user-menu { .user-menu {
display: block; display: block;
width: 100%; width: 100%;
@ -84,42 +83,29 @@ nav.secondary {
#compact-secondary-nav { #compact-secondary-nav {
display: none; display: none;
} }
.compact-hide { .compact-hide {
display: inline-block; display: inline-block;
} }
#content { margin-top: 58px; }
.map-layout { .map-layout {
#sidebar { #sidebar, #map {
width: 100%; position: relative;
position: fixed;
top: 58px;
height: 240px;
overflow-x: hidden; overflow-x: hidden;
z-index: 1;
background: #fff;
p.large-text {
font-size: 1.2em;
line-height: 1.4em;
}
&.minimized {
background: none;
}
}
#content {
position: fixed;
top: 0;
display: block;
height: 100%;
margin-top: 0;
padding-top: 58px;
}
#map {
width: 100%; width: 100%;
// height: 100%; height: 50%;
// position: fixed;
} }
.overlay-sidebar {
#sidebar {
width: 300px;
}
#map {
height: 100%;
}
}
#map-ui { #map-ui {
z-index: 9999; z-index: 9999;
width: 100%; width: 100%;

View file

@ -1,4 +1,4 @@
<div id="content"> <div id="content" class="<%= content_for :content_class %>">
<% if content_for? :content %> <% if content_for? :content %>
<%= yield :content %> <%= yield :content %>
<% else %> <% else %>

View file

@ -8,7 +8,7 @@
<a href="#" id="menu-icon"></a> <a href="#" id="menu-icon"></a>
<nav class='primary'> <nav class='primary'>
<ul> <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", <%= link_to t('layouts.edit'), edit_path, :class => "tab geolink object",
:id => 'editanchor', :id => 'editanchor',
:data => { :editor => preferred_editor } :data => { :editor => preferred_editor }
@ -27,7 +27,7 @@
<li id="history_tab" class="<%= current_page_class(history_path) %>"> <li id="history_tab" class="<%= current_page_class(history_path) %>">
<%= link_to t('layouts.history'), history_path, :class => 'tab geolink' %> <%= link_to t('layouts.history'), history_path, :class => 'tab geolink' %>
</li> </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' %> <%= link_to t('layouts.export'), export_path, :class => 'tab geolink' %>
</li> </li>
</ul> </ul>

View file

@ -17,7 +17,7 @@
<% end %> <% end %>
<% content_for :content do %> <% content_for :content do %>
<div id="sidebar" class="minimized"> <div id="sidebar">
<%= form_tag search_path, :id => "search_form" do %> <%= form_tag search_path, :id => "search_form" do %>
<%= submit_tag t('site.search.submit_text') %> <%= submit_tag t('site.search.submit_text') %>
<div id='query_wrapper'> <div id='query_wrapper'>

View file

@ -1,3 +1,5 @@
<% content_for(:content_class) { "overlay-sidebar" } %>
<% unless @user %> <% unless @user %>
<div class="welcome"> <div class="welcome">
<h2><%= t 'layouts.intro_header' %></h2> <h2><%= t 'layouts.intro_header' %></h2>