]> git.openstreetmap.org Git - rails.git/commitdiff
Design adjustments to Link / HTML sharing
authorJohn Firebaugh <john.firebaugh@gmail.com>
Sat, 27 Jul 2013 01:17:36 +0000 (18:17 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Mon, 5 Aug 2013 15:31:46 +0000 (08:31 -0700)
app/assets/javascripts/leaflet.share.js
app/assets/stylesheets/common.css.scss
config/locales/en.yml

index 1f13bf60966ca8e74338a82b453510cb7f976012..9388bde658f992812547546cd64ab8034a839ad7 100644 (file)
@@ -34,7 +34,7 @@ L.OSM.share = function (options) {
         $('<h4>')
           .text(I18n.t('javascripts.share.title')));
 
-    // Link
+    // Link / Embed
 
     var $linkSection = $('<div>')
       .attr('class', 'section share-link')
@@ -63,45 +63,42 @@ L.OSM.share = function (options) {
 
     var $shortLink, $longLink;
 
-    $('<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'))));
-
-    // Embeddable HTML
-
-    var $embedSection = $('<div>')
-      .attr('class', 'section share-html')
-      .appendTo($ui);
-
-    $('<h4>')
-      .text(I18n.t('javascripts.share.embed'))
-      .appendTo($embedSection);
-
-    $form = $('<form>')
-      .attr('class', 'standard-form')
-      .appendTo($embedSection);
+    $('<div>')
+      .attr('class', 'form-row')
+      .appendTo($form)
+      .append($('<label>')
+        .attr('for', 'long_input')
+        .text(I18n.t('javascripts.share.long_link')))
+      .append($('<a>')
+        .attr('id', 'long_link')
+        .append($('<span>')
+          .attr('class', 'icon link')))
+      .append($('<input>')
+        .attr('id', 'long_input')
+        .attr('type', 'text')
+        .on('click', select));
 
     $('<div>')
       .attr('class', 'form-row')
       .appendTo($form)
-      .append(
-        $('<label>')
-          .attr('for', 'embed_marker')
-          .append(
-            $('<input>')
-              .attr('id', 'embed_marker')
-              .attr('type', 'checkbox')
-              .bind('change', toggleMarker))
-          .append(I18n.t('javascripts.share.include_marker')));
+      .append($('<label>')
+        .attr('for', 'short_input')
+        .text(I18n.t('javascripts.share.short_link')))
+      .append($('<a>')
+        .attr('id', 'short_link')
+        .append($('<span>')
+          .attr('class', 'icon link')))
+      .append($('<input>')
+        .attr('id', 'short_input')
+        .attr('type', 'text')
+        .on('click', select));
 
     $('<div>')
       .attr('class', 'form-row')
       .appendTo($form)
+      .append($('<label>')
+        .attr('for', 'embed_html')
+        .text(I18n.t('javascripts.share.embed')))
       .append(
         $('<textarea>')
           .attr('id', 'embed_html')
@@ -110,7 +107,7 @@ L.OSM.share = function (options) {
     $('<p>')
       .attr('class', 'deemphasize')
       .text(I18n.t('javascripts.share.paste_html'))
-      .appendTo($embedSection);
+      .appendTo($linkSection);
 
     // Image
 
@@ -250,18 +247,18 @@ L.OSM.share = function (options) {
     function update() {
       var bounds = map.getBounds();
 
-      $('#link_marker, #embed_marker')
+      $('#link_marker')
         .prop('checked', map.hasLayer(marker));
 
       $('#image_filter')
         .prop('checked', locationFilter.isEnabled());
 
-      // Link
-
-      $shortLink.attr('href', map.getShortUrl(marker));
-      $longLink.attr('href', map.getUrl(marker));
+      // Link / Embed
 
-      // Embed
+      $('#short_input').val(map.getShortUrl(marker));
+      $('#long_input').val(map.getUrl(marker));
+      $('#short_link').attr('href', map.getShortUrl(marker));
+      $('#long_link').attr('href', map.getUrl(marker));
 
       var params = {
         bbox: bounds.toBBoxString(),
index 42966accd70debe5d19ba7b4035ab29c7dc38400..94f3f84e2a5f41370bf0f5f44eafd6d04d60af75 100644 (file)
@@ -638,17 +638,19 @@ a.donate {
 
 .share-ui {
   .share-link {
-    li {
-      display: inline-block;
-      text-align: center;
-      width: 50%;
+    a {
+      margin-left: 5px;
+    }
+
+    input,
+    textarea {
+      font-family: monospace;
+      font-size: small;
     }
   }
 
   #embed_html {
     resize: vertical;
-    font-family: monospace;
-    font-size: small;
   }
 
   #mapnik_scale {
index 97b856c92a71eb3299c1a7689fda225dd42d78a4..8a11960e0cb65d0cbbde48899d63cd8d6758f4b7 100644 (file)
@@ -2052,7 +2052,7 @@ en:
       title: "Share"
       cancel: "Cancel"
       image: "Image"
-      link: "Link"
+      link: "Link or HTML"
       short_link: "Short Link"
       long_link: "Long Link"
       embed: "Embeddable HTML"