From 9b18e6532f51d54cbd2b3e569581b990c75fd8ea Mon Sep 17 00:00:00 2001
From: Armand Bahi <armand.bahi@veremes.com>
Date: Thu, 8 Nov 2018 12:08:06 +0100
Subject: [PATCH] =?UTF-8?q?Interface=20g=C3=A9n=C3=A9rateur=20d'URL?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../javascript/app/vmap/tools/urlexporter.js  | 21 +++++++++++
 module/template/tools/basictools.html         |  4 +--
 module/template/tools/urlexporter.html        | 35 ++++++++++++++-----
 3 files changed, 50 insertions(+), 10 deletions(-)

diff --git a/module/javascript/app/vmap/tools/urlexporter.js b/module/javascript/app/vmap/tools/urlexporter.js
index 09d3ac86..d89684f2 100644
--- a/module/javascript/app/vmap/tools/urlexporter.js
+++ b/module/javascript/app/vmap/tools/urlexporter.js
@@ -125,6 +125,27 @@ nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController.prototype.urlC
     this["urlToExport"] = sUrl;
 };
 
+
+/**
+ * Copy the generated URL on the clipboard
+ *
+ * @export
+ */
+nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController.prototype.copyUrl = function () {
+    oVmap.log("nsVmap.nsToolsManager.Urlexporter.urlExporterController.copyUrl");
+
+    /* Get the text field */
+    var copyText = document.getElementById("urlExporterField");
+
+    /* Select the text field */
+    copyText.select();
+
+    /* Copy the text inside the text field */
+    document.execCommand("copy");
+
+    $.notify('Copié', 'success');
+}
+
 // Définit la directive et le controller
 oVmap.module.directive('appUrlExporter', nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterDirective);
 oVmap.module.controller('AppUrlExporterController', nsVmap.nsToolsManager.Urlexporter.prototype.urlExporterController);
diff --git a/module/template/tools/basictools.html b/module/template/tools/basictools.html
index c469aad7..03218712 100644
--- a/module/template/tools/basictools.html
+++ b/module/template/tools/basictools.html
@@ -8,9 +8,9 @@
                 <div>
                     <li role="presentation" style="position: inherit" class="basic-tools-dropdown">
                         <a class="basic-tools-element pointer"
-                           title="Générateur d'URL"
+                           title="Lien vers la carte en cours"
                            onclick="oVmap.getToolsManager().getBasicTools().toggleTool(this)">
-                            <span class="icon-at" aria-hidden="true"></span>
+                            <span class="fa fa-link" aria-hidden="true"></span>
                         </a>
                         <div app-url-exporter app-lang="ctrl.lang" app-map="ctrl.map"
                              id="basic-tools-dropdown-urlexporter"
diff --git a/module/template/tools/urlexporter.html b/module/template/tools/urlexporter.html
index 8219c051..c10845a6 100644
--- a/module/template/tools/urlexporter.html
+++ b/module/template/tools/urlexporter.html
@@ -1,11 +1,30 @@
 <!--UrlExporter-->
 <div class="row margin-sides-0 margin-10">
-    <div class="col-md-3" ng-show="ctrl.properties.allow_public_connection">
-        <input type="checkbox" ng-model="ctrl.usePublicToken" id="publicAccountCheckbox">
-        <label for="publicAccountCheckbox" class="control-label">Public</label>
-    </div>          
-    <div class="" ng-class="{'col-md-9' : ctrl.properties.allow_public_connection, 'col-md-12': !ctrl.properties.allow_public_connection}">
-        <label for="urlExporterField" class="control-label">URL</label>
-        <input type="text" class="form-control" ng-model="ctrl.urlToExport" id="urlExporterField">
+    <div class="col-md-12">
+        <div class="left">
+            <label for="urlExporterField" class="control-label">Lien vers la carte en cours</label>
+        </div>
+        <div class="right" ng-if="ctrl.properties.allow_public_connection">
+            <div class="checkbox checkbox-info checkbox-inline">
+                <input id="publicAccountCheckbox"
+                        type="checkbox"
+                        style="cursor:pointer;"
+                        title=">Activer / Désactiver le mode public"
+                        ng-model="ctrl.usePublicToken">
+                <label for="publicAccountCheckbox"
+                       style="cursor:pointer"
+                       title="Activer / Désactiver le mode public">
+                    Public
+                </label>
+            </div>
+        </div>
     </div>
-</div>
\ No newline at end of file
+    <div class="col-md-12">
+        <div class="input-group">
+            <input type="text" class="form-control" ng-model="ctrl.urlToExport" id="urlExporterField">
+            <span class="input-group-btn">
+                <button type="button" class="btn btn-default" ng-click="ctrl.copyUrl()"><span class="icon-copy"></span></button>
+            </span>
+        </div>
+    </div>
+</div>
-- 
GitLab