Add 'x' to close welcome box; remember preference

This commit is contained in:
Richard Fairhurst 2013-12-01 19:08:56 +00:00 committed by Tom Hughes
parent aff0583a34
commit 640ff57465
2 changed files with 13 additions and 3 deletions

View file

@ -140,6 +140,9 @@ $(document).ready(function () {
$('.leaflet-control .control-button').tooltip({placement: 'left', container: 'body'}); $('.leaflet-control .control-button').tooltip({placement: 'left', container: 'body'});
var expiry = new Date();
expiry.setYear(expiry.getFullYear() + 10);
map.on('moveend layeradd layerremove', function() { map.on('moveend layeradd layerremove', function() {
updatelinks( updatelinks(
map.getCenter().wrap(), map.getCenter().wrap(),
@ -147,11 +150,18 @@ $(document).ready(function () {
map.getLayersCode(), map.getLayersCode(),
map._object); map._object);
var expiry = new Date();
expiry.setYear(expiry.getFullYear() + 10);
$.cookie("_osm_location", cookieContent(map), { expires: expiry }); $.cookie("_osm_location", cookieContent(map), { expires: expiry });
}); });
if ($.cookie('_osm_welcome') == 'hide') {
$('.welcome').hide();
}
$('.welcome .close').on('click', function() {
$('.welcome').hide();
$.cookie("_osm_welcome", 'hide', { expires: expiry });
});
if (OSM.PIWIK) { if (OSM.PIWIK) {
map.on('layeradd', function (e) { map.on('layeradd', function (e) {
if (e.layer.options) { if (e.layer.options) {

View file

@ -46,7 +46,7 @@
<% unless @user %> <% unless @user %>
<div class="welcome"> <div class="welcome">
<h2><%= t 'layouts.intro_header' %></h2> <h2><a><span class="icon close"></span></a><%= t 'layouts.intro_header' %></h2>
<p><%= t 'layouts.intro_text' %></p> <p><%= t 'layouts.intro_text' %></p>
<a class="button learn-more" href="<%= about_path %>"><%= t('layouts.learn_more') %></a> <a class="button learn-more" href="<%= about_path %>"><%= t('layouts.learn_more') %></a>
<a class="button sign-up" href="<%= user_new_path %>"><%= t('layouts.start_mapping') %></a> <a class="button sign-up" href="<%= user_new_path %>"><%= t('layouts.start_mapping') %></a>