From e79d29d18cece165bb334428cca3b9b925d57aaa Mon Sep 17 00:00:00 2001
From: Armand Bahi <armand.bahi@veremes.com>
Date: Thu, 22 Nov 2018 11:21:47 +0100
Subject: [PATCH] =?UTF-8?q?Comparaison=20impressions=20l=C3=A9gende?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../module/javascript/app/vmap/tools/print.js | 22 ++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/module_vmap/module/javascript/app/vmap/tools/print.js b/src/module_vmap/module/javascript/app/vmap/tools/print.js
index efc99e6a..27938571 100644
--- a/src/module_vmap/module/javascript/app/vmap/tools/print.js
+++ b/src/module_vmap/module/javascript/app/vmap/tools/print.js
@@ -635,10 +635,17 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.print = function
     var printStyleId = opt_options.printStyleId;
 
     // Set includesJSON
-    var includesJson = JSON.stringify([{
+    var aIncludes = [{
             'target': '#map_legend',
-            'html': this_.getLegendTemplate()
-        }]);
+            'html': this_.getLegendTemplate('#maplegend')
+        }];
+    if(this.$scope_["$root"]["compare_enabled"]){
+        aIncludes.push({
+            'target': '#map_legend_compare',
+            'html': this_.getLegendTemplate('#compare_maplegend')
+        });
+    }
+    var includesJson = JSON.stringify(aIncludes);
 
     // Set scope
     var oPrintScope = goog.isDefAndNotNull(opt_options.scope) ? opt_options.scope : {};
@@ -780,6 +787,10 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.print = function
     return 1;
 };
 
+/**
+ * Get the maps JSON defs
+ * @param  {object} opt_options
+ */
 nsVmap.nsToolsManager.Print.prototype.printController.prototype.getMapsJsonDef = function (opt_options) {
     oVmap.log('nsVmap.nsToolsManager.Print.prototype.printController.prototype.getMapsJsonDef');
 
@@ -928,11 +939,12 @@ nsVmap.nsToolsManager.Print.prototype.printController.prototype.getTemplateTarge
 
 /**
  * Get the html definition of the template with base64 images
+ * @param  {string} sTarget
  * @returns {String}
  */
-nsVmap.nsToolsManager.Print.prototype.printController.prototype.getLegendTemplate = function () {
+nsVmap.nsToolsManager.Print.prototype.printController.prototype.getLegendTemplate = function (sTarget) {
 
-    var template = $('#maplegend').clone();
+    var template = $(sTarget).clone();
 
     // Transforme les images en base64
     template.find('img').each(function (index) {
-- 
GitLab