From b3a9ae6c46c0163c9bc9c6154863917ddb893fab Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Wed, 5 Apr 2017 14:24:36 +0200
Subject: [PATCH] CIP #57952 revive article info in popup + improve popup
 position + behavior

---
 .../admin/views/scripts/cms/edit.phtml        |  5 ++--
 public/admin/js/treeselect/treeselect.js      |  2 +-
 public/admin/skins/bokeh74/form.css           | 24 +++++++++++++++++++
 public/admin/skins/bokeh74/jquery.css         | 23 +++++++++++++++---
 public/opac/css/global.css                    |  1 +
 public/opac/js/subModal.js                    | 15 ++++++------
 .../admin/controllers/CmsControllerTest.php   | 18 ++++++++++++++
 7 files changed, 74 insertions(+), 14 deletions(-)

diff --git a/application/modules/admin/views/scripts/cms/edit.phtml b/application/modules/admin/views/scripts/cms/edit.phtml
index 6fa3862b764..3c45021526c 100644
--- a/application/modules/admin/views/scripts/cms/edit.phtml
+++ b/application/modules/admin/views/scripts/cms/edit.phtml
@@ -1,7 +1,8 @@
 <?php
-if(!$this->_is_popup)
-  echo $this->partial('cms/_newsform_head.phtml', ['article' => $this->article]);
+echo $this->partial('cms/_newsform_head.phtml', ['article' => $this->article]);
+
 if ($this->article->isTraduction())
   $this->form->setOriginal($this->article->getArticleOriginal());
+
 echo $this->renderForm($this->form);
 ?>
diff --git a/public/admin/js/treeselect/treeselect.js b/public/admin/js/treeselect/treeselect.js
index a54010fce3f..a60673642a7 100644
--- a/public/admin/js/treeselect/treeselect.js
+++ b/public/admin/js/treeselect/treeselect.js
@@ -298,7 +298,7 @@
       this._findConnectedIn(li, this.selectedItems).
 	hide('fast', function(){
 	  $(this).remove()});
-
+      this.itemsTree.closest('form').find('input').first().change();
       li.children('input').removeAttr('checked');
       li.find("li input").removeAttr('disabled');
       li.children('a').removeClass('ui-state-active');
diff --git a/public/admin/skins/bokeh74/form.css b/public/admin/skins/bokeh74/form.css
index 2400d19a8de..fa7f74f4122 100644
--- a/public/admin/skins/bokeh74/form.css
+++ b/public/admin/skins/bokeh74/form.css
@@ -46,4 +46,28 @@
 
 .admin-form [type="checkbox"] {
     -webkit-appearance: checkbox;
+}
+
+.content_edit_head dt,
+.content_edit_head dd {
+    display: inline-block;
+    margin: 0;
+}
+
+.content_edit_head dt {
+    font-weight: bold;
+    padding-right: 0.3em;
+}
+
+.content_edit_head dd {
+    padding-right: 1em;
+}
+
+.content_edit_head dl {
+    margin: 0.3em 0;
+}
+
+.content_edit_head img {
+    height: 16px;
+    margin: 0 0.3em;
 }
\ No newline at end of file
diff --git a/public/admin/skins/bokeh74/jquery.css b/public/admin/skins/bokeh74/jquery.css
index c67f705ec9a..068f28dd7be 100644
--- a/public/admin/skins/bokeh74/jquery.css
+++ b/public/admin/skins/bokeh74/jquery.css
@@ -14,7 +14,7 @@ body .ui-tabs .ui-tabs-panel {
 }
 
 body .ui-dialog-titlebar {
-    background: var(--nav-background);
+    background: var(--nav-background) !important;
 }
 
 body .ui-dialog-titlebar .ui-dialog-title {
@@ -29,9 +29,12 @@ body .ui-widget-content {
     padding: 0;
 }
 
-body .ui-dialog {
-    z-index: 1001;
+body .ui-dialog.fixed_popup {
     position: fixed !important;
+}
+
+
+body .ui-dialog {
     box-shadow: 0 0 15px var(--widget-shadow);
     border: 2px solid var(--nav-background);
     border-radius: 0;
@@ -163,3 +166,17 @@ body .ui-accordion .ui-accordion-header {
 body .ui-state-active .ui-accordion-header-icon {
     transform: rotate(-90deg);
 }
+
+body .ui-dialog table td {
+    border: none !important;
+}
+
+body .ui-dialog table td.gauche *,
+body .ui-dialog table td.gauche {
+    text-align: left !important;
+}
+
+body .ui-dialog table td.droite *,
+body .ui-dialog table td.droite {
+    text-align: right !important;
+}
\ No newline at end of file
diff --git a/public/opac/css/global.css b/public/opac/css/global.css
index 5e0e02a7887..dcb76a3f24f 100644
--- a/public/opac/css/global.css
+++ b/public/opac/css/global.css
@@ -3503,6 +3503,7 @@ a.edit_menu {
     margin: 0;
     left: 0;
     top: 3px;
+    z-index: 101;
 }
 
 a.edit_menu img {
diff --git a/public/opac/js/subModal.js b/public/opac/js/subModal.js
index 66023fdb515..aa3af84ef28 100644
--- a/public/opac/js/subModal.js
+++ b/public/opac/js/subModal.js
@@ -74,6 +74,9 @@
   var onOpen = function() {
     initializePopups();
     addLoadingClass();
+    setTimeout(function() {
+      $('.ui-dialog').addClass('fixed_popup');
+    }, 100);
   }
 
 
@@ -149,23 +152,19 @@
 
     container[0].innerHTML = data['content'];
 
-    if(data['width'])
-      modal_size['width'] = data['width'];
-
     if (data['show_modal'] && data['show_modal']=='true')
       show_modal=true;
 
     var titre = titre;
     var modal = container.dialog({
-      width:modal_size['width'],
-      height:modal_size['height'],
+      width: modal_size.width,
+      height: modal_size.height,
+      maxHeight: 800,
+      maxWidth: 1024,
       modal:show_modal,
       dialogClass: dialogClass,
       close:onClose,
       open: function() {setTimeout(onOpen, 100);},
-      position: {my : 'center bottom',
-		 at : 'center center',
-		 of : window}
     }).closest('.ui-dialog').find('.ui-dialog-title').html(titre);
     return modal;
   }
diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php
index 4a593913a84..d1a7cf26cd0 100644
--- a/tests/application/modules/admin/controllers/CmsControllerTest.php
+++ b/tests/application/modules/admin/controllers/CmsControllerTest.php
@@ -779,6 +779,24 @@ class CmsControllerArticleConcertEditRenderPopupActionTest extends CmsController
     $this->_xpath = new Storm_Test_XPath();
   }
 
+  /** @test */
+  public function tagPreviewArticleShouldNotHaveRenderPopupInLink() {
+    $this->_xpath->assertXPath($this->_json->content,
+                               '//a[contains(@href, "cms/articleview/id/4?iframe=true")]');
+  }
+
+
+  /** @test */
+  public function prettyPhotoShouldBeLoaded() {
+    $this->_xpath->assertXPath($this->_json->content, '//script[contains(@src, "jquery.prettyPhoto")]');
+  }
+
+
+  /** @test */
+  public function linkToEditLangEnShouldHaveDataPopup() {
+    $this->_xpath->assertXPath($this->_json->content, '//a[contains(@href, "edit/id/4/lang/en")][@data-popup="true"]');
+  }
+
 
   /** @test */
   public function boutonRetourShouldCloseThePopup() {
-- 
GitLab