From f6f7b3b78275989ff8d09fb703cc0335ffadf4bb Mon Sep 17 00:00:00 2001
From: efalcy <efalcy@afi-sa.fr>
Date: Wed, 13 Sep 2017 16:15:28 +0200
Subject: [PATCH] dev #64203 tune progressbar

---
 .../views/scripts/users/manage-double.phtml    | 18 +++++++++++++++---
 library/Class/Admin/Skin.php                   |  3 ++-
 public/admin/js/onload_utils.js                |  8 ++++++--
 public/admin/skins/bokeh74/buttons.css         |  7 +++++++
 public/admin/skins/bokeh74/jquery.css          | 14 +++++++++++++-
 5 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/application/modules/admin/views/scripts/users/manage-double.phtml b/application/modules/admin/views/scripts/users/manage-double.phtml
index 7f6c85015ac..60f031b2d21 100644
--- a/application/modules/admin/views/scripts/users/manage-double.phtml
+++ b/application/modules/admin/views/scripts/users/manage-double.phtml
@@ -3,9 +3,7 @@ echo $this->tag('p',
                 $this->_('Vous avez %s comptes abonnés possédant au moins un doublon dans votre base de données.',
                          $this->tag('b', $this->double_manager->countDouble())));
 
-echo $this->tag('p',
-                $this->tag('small',
-                           $this->_('Requête d\'identification des doublons : %s', $this->tag('b', $this->double_manager->getRequest()))));
+
 
 echo $this->button((new Class_Entity())
                    ->setUrl($this->url(['module' => 'admin',
@@ -42,3 +40,17 @@ echo $this->button((new Class_Entity())
                                             ['style' => 'filter: invert();']))
 
                    ->setText($this->_('Gérer manuellement les doublons')));
+
+
+echo $this->button((new Class_Entity())
+                     ->setAttribs([
+                                   'onclick' => '$(this).next().toggle();'])
+                   ->setImage($this->tagImg(Class_Admin_Skin::current()
+                                            ->getIconUrl('actions',
+                                                         'help'),
+                                            ['style' => 'filter: invert();']))
+                   ->setText($this->_('Voir la requete')));
+
+echo $this->tag('p',
+                $this->double_manager->getRequest(),
+                ['style' => 'display:none']);
diff --git a/library/Class/Admin/Skin.php b/library/Class/Admin/Skin.php
index 97622f7a3ed..09456f7644e 100644
--- a/library/Class/Admin/Skin.php
+++ b/library/Class/Admin/Skin.php
@@ -136,7 +136,8 @@ class Class_Admin_Skin {
 
 
   public function renderButtonCssOn($script_loader) {
-    return $this->_renderCssOn($script_loader, 'buttons.css');
+    return $this->_renderCssOn($script_loader, 'buttons.css')
+                ->renderJQueryCssOn($script_loader);
   }
 
 
diff --git a/public/admin/js/onload_utils.js b/public/admin/js/onload_utils.js
index a67fe93282b..a3de1bfb84a 100644
--- a/public/admin/js/onload_utils.js
+++ b/public/admin/js/onload_utils.js
@@ -165,7 +165,7 @@ var dedupeUsers = function(url, total, cursor = 0) {
       var percent = data.done * 100 / total;
       var new_cursor = data.cursor;
       run = data.run;
-
+      percent = percent ? percent : 1;
       $("#dedupe-users-button span")
 	.progressbar({value: percent});
 
@@ -174,7 +174,11 @@ var dedupeUsers = function(url, total, cursor = 0) {
 
     },
     complete: function(event, ui) {
-      if(!run)
+      if(run)
+	return;
+      $("#dedupe-users-button span")
+	.progressbar({value: 100});
+
 	location.reload();      
     }});
 }
diff --git a/public/admin/skins/bokeh74/buttons.css b/public/admin/skins/bokeh74/buttons.css
index 7e78097b720..ffa3ba453b0 100644
--- a/public/admin/skins/bokeh74/buttons.css
+++ b/public/admin/skins/bokeh74/buttons.css
@@ -26,6 +26,7 @@
     transition: background 0.4s;
     border: none;
     cursor: pointer;
+    vertical-align: top;
 }
 
 .admin-button > img {
@@ -44,4 +45,10 @@ div.admin-buttons {
 
 .admin-button:disabled > img {
     filter: opacity(0.2);
+}
+
+
+.admin-button span.ui-progressbar {
+    display: block;
+    margin: 5px;
 }
\ No newline at end of file
diff --git a/public/admin/skins/bokeh74/jquery.css b/public/admin/skins/bokeh74/jquery.css
index 5455929e9dd..fdc02c463ea 100644
--- a/public/admin/skins/bokeh74/jquery.css
+++ b/public/admin/skins/bokeh74/jquery.css
@@ -150,4 +150,16 @@ body .ui-dialog .show_drag_and_drop {
 body .ui-tabs a.errors.ui-tabs-anchor {
     color: white;
     background: var(--error-text);
-}
\ No newline at end of file
+}
+
+
+body .ui-progressbar .ui-progressbar-value {
+    background : var(--success-background);
+    margin: 0;
+
+}
+
+body .ui-progressbar {
+    height: 1em;
+}
+
-- 
GitLab