]> git.openstreetmap.org Git - rails.git/commitdiff
Switch back to links for sharing
authorJohn Firebaugh <john.firebaugh@gmail.com>
Wed, 10 Jul 2013 22:17:42 +0000 (15:17 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Thu, 18 Jul 2013 17:45:17 +0000 (10:45 -0700)
app/assets/javascripts/leaflet.share.js
app/assets/stylesheets/common.css.scss
config/locales/en.yml

index e34d5ffdb67c442d1b19fdfe6862768c4e60fe42..f261a9d726b6be66118ec76a25e24492eccb55cd 100644 (file)
@@ -29,39 +29,24 @@ L.OSM.share = function (options) {
         $('<h4>')
           .text(I18n.t('javascripts.share.title')));
 
         $('<h4>')
           .text(I18n.t('javascripts.share.title')));
 
-    var $share_link = $('<section>')
+    var $linkSection = $('<section>')
+      .attr('class', 'share-link')
       .appendTo($ui);
 
       .appendTo($ui);
 
-    var $title = $('<h4>')
+    $('<h4>')
       .text(I18n.t('javascripts.share.link'))
       .text(I18n.t('javascripts.share.link'))
-      .appendTo($share_link);
+      .appendTo($linkSection);
 
 
-    var $input = $('<input />')
-      .attr('type', 'text')
-      .on('click', select)
-      .appendTo($share_link);
+    var $shortLink, $longLink;
 
 
-    var $list = $('<ul>')
-      .appendTo($share_link);
-
-    var $short_option = $('<li>')
-      .appendTo($list);
-
-    var $short_url_label = $('<label></label>')
-      .attr('for', 'short_url')
-      .appendTo($short_option);
-
-    var $short_url_input = $('<input />')
-      .attr('id', 'short_url')
-      .attr('type', 'checkbox')
-      .prop('checked', 'checked')
-      .appendTo($short_url_label)
-      .bind('change', function() {
-          options.short = $(this).prop('checked');
-          update();
-      });
-
-    $short_url_label.append(I18n.t('javascripts.share.short_url'));
+    $('<ul>')
+      .appendTo($linkSection)
+      .append($('<li>')
+        .append($longLink = $('<a>')
+          .text(I18n.t('javascripts.share.long_link'))))
+      .append($('<li>')
+        .append($shortLink = $('<a>')
+          .text(I18n.t('javascripts.share.short_link'))));
 
     map.on('moveend layeradd layerremove', update);
 
 
     map.on('moveend layeradd layerremove', update);
 
@@ -71,13 +56,12 @@ L.OSM.share = function (options) {
       e.stopPropagation();
       e.preventDefault();
       options.sidebar.togglePane($ui);
       e.stopPropagation();
       e.preventDefault();
       options.sidebar.togglePane($ui);
-      $input.select();
+      update();
     }
 
     function update() {
     }
 
     function update() {
-      $input.val(
-          options.short ? options.getShortUrl(map) : options.getUrl(map)
-      );
+      $shortLink.attr('href', options.getShortUrl(map));
+      $longLink.attr('href', options.getUrl(map));
     }
 
     function select() {
     }
 
     function select() {
index 4afc71533a42304d3a3c3f6f129f82ab7dafb5c7..615bdeedcf25cd36c3826552c9069d18b46c241c 100644 (file)
@@ -624,6 +624,15 @@ a.donate {
   }
 }
 
   }
 }
 
+.share-ui {
+  .share-link {
+    li {
+      display: inline-block;
+      width: 50%;
+    }
+  }
+}
+
 .site-index .leaflet-top,
 .site-export .leaflet-top {
   top: $lineheight/2 !important;
 .site-index .leaflet-top,
 .site-export .leaflet-top {
   top: $lineheight/2 !important;
index 3daf2504d03f0a1b8ffae7285f0c2de6b0073e00..e542006d701120ca7be1eb463f4c28f77578fe29 100644 (file)
@@ -2042,7 +2042,8 @@ en:
       title: "Share"
       cancel: "Cancel"
       link: "Link"
       title: "Share"
       cancel: "Cancel"
       link: "Link"
-      short_url: "Short URL"
+      short_link: "Short Link"
+      long_link: "Long Link"
     key:
       title: "Map Key"
       tooltip: "Map Key"
     key:
       title: "Map Key"
       tooltip: "Map Key"