Eliminate loading flash for welcome overlay

This commit is contained in:
John Firebaugh 2013-11-19 11:18:11 -08:00
parent e91956d0f7
commit bd21a1f7ff
5 changed files with 24 additions and 17 deletions

View file

@ -198,22 +198,19 @@ $(document).ready(function () {
OSM.Index = function(map) { OSM.Index = function(map) {
var page = {}; var page = {};
page.pushstate = function(path) { page.pushstate = function() {
$("#content").addClass("overlay-sidebar"); $("#content").addClass("overlay-sidebar");
map.invalidateSize({pan: false}) map.invalidateSize({pan: false})
.panBy([-350, 0], {animate: false}); .panBy([-350, 0], {animate: false});
OSM.loadSidebarContent(path);
page.load();
}; };
page.load = function() { page.load = function() {
return map.getState(); return map.getState();
}; };
page.popstate = function(path) { page.popstate = function() {
$("#content").addClass("overlay-sidebar"); $("#content").addClass("overlay-sidebar");
map.invalidateSize({pan: false}); map.invalidateSize({pan: false});
OSM.loadSidebarContent(path);
}; };
page.unload = function() { page.unload = function() {

View file

@ -649,12 +649,22 @@ nav.secondary {
} }
} }
.welcome {
display: none;
}
.overlay-sidebar #sidebar { .overlay-sidebar #sidebar {
position: absolute; position: absolute;
z-index: 1000; z-index: 1000;
height: auto; height: auto;
border-bottom-right-radius: 5px; border-bottom-right-radius: 5px;
overflow: hidden; overflow: hidden;
.welcome {
display: block;
}
#sidebar_content {
display: none;
}
} }
.welcome { .welcome {

View file

@ -122,7 +122,7 @@ nav.secondary {
} }
#sidebar .welcome { #sidebar .welcome {
display: none; display: none !important;
} }
.leaflet-top.leaflet-right { .leaflet-top.leaflet-right {

View file

@ -40,6 +40,15 @@
<%= render :partial => "layouts/flash" %> <%= render :partial => "layouts/flash" %>
<%= yield %> <%= yield %>
</div> </div>
<% unless @user %>
<div class="welcome">
<h2><%= t 'layouts.intro_header' %></h2>
<p><%= t 'layouts.intro_text' %></p>
<a class="button learn-more" href="<%= about_path %>"><%= t('layouts.learn_more') %></a>
<a class="button sign-up" href="<%= user_new_path %>"><%= t('layouts.sign_up') %></a>
</div>
<% end %>
</div> </div>
<noscript> <noscript>

View file

@ -1,13 +1,4 @@
<% <%
set_title() set_title()
content_for(:content_class) { "overlay-sidebar" } content_for(:content_class) { "overlay-sidebar" }
%> %>
<% unless @user %>
<div class="welcome">
<h2><%= t 'layouts.intro_header' %></h2>
<p><%= t 'layouts.intro_text' %></p>
<a class="button learn-more" href="<%= about_path %>"><%= t('layouts.learn_more') %></a>
<a class="button sign-up" href="<%= user_new_path %>"><%= t('layouts.sign_up') %></a>
</div>
<% end %>