]> git.openstreetmap.org Git - rails.git/commitdiff
Add 'x' to close welcome box; remember preference
authorRichard Fairhurst <richard@systemeD.net>
Sun, 1 Dec 2013 19:08:56 +0000 (19:08 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 1 Dec 2013 21:36:25 +0000 (21:36 +0000)
app/assets/javascripts/index.js
app/views/layouts/map.html.erb

index 1cbd97f86351e442f210d320e41167c5f42b1969..43b7fefe0b4caddd7d4ec2f1d9cefcf143307a50 100644 (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() {
     updatelinks(
       map.getCenter().wrap(),
   map.on('moveend layeradd layerremove', function() {
     updatelinks(
       map.getCenter().wrap(),
@@ -147,11 +150,18 @@ $(document).ready(function () {
       map.getLayersCode(),
       map._object);
 
       map.getLayersCode(),
       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) {
     map.on('layeradd', function (e) {
       if (e.layer.options) {
   if (OSM.PIWIK) {
     map.on('layeradd', function (e) {
       if (e.layer.options) {
index 68162f7032246e51ba540300f3ea5c1f1a42ba61..ed7fe6837a4725e0d9ab708adfa370e89790958a 100644 (file)
@@ -46,7 +46,7 @@
 
     <% unless @user %>
       <div class="welcome">
 
     <% unless @user %>
       <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>
         <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>
         <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.start_mapping') %></a>