From 6983f9e84a56982393c6c91175d5a19881e33061 Mon Sep 17 00:00:00 2001 From: dgt41 Date: Sun, 12 Oct 2014 03:15:43 +0300 Subject: [PATCH] Move content history to bs modal Same as #4513 and 4514 but for content history Content history is currently using mootools modal. Without affecting in anyway the logic of the field we can use jQuery and bootstrap. B/C Should be 100% compatible Test: Apply the patch Go to administrator -> Banners -> create a new banner change the alternative text and save it again repeat the last part for few more times press the versions button Everything should be ok --- layouts/joomla/toolbar/versions.php | 30 +++++++++++++++++---- libraries/cms/form/field/contenthistory.php | 28 ++++++++++++++----- 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/layouts/joomla/toolbar/versions.php b/layouts/joomla/toolbar/versions.php index 6add897ae609c..7337a0cfa5493 100644 --- a/layouts/joomla/toolbar/versions.php +++ b/layouts/joomla/toolbar/versions.php @@ -8,9 +8,29 @@ */ defined('_JEXEC') or die; + +JFactory::getDocument()->addStyleDeclaration(' + @media only screen and (min-width : 768px) { + #versionsModal { + width: 80% !important; + margin-left:-40% !important; + height:auto; + } + #versionsModal #versionsModal-container .modal-body iframe { + margin:0; + padding:0; + display:block; + width:100%; + height:400px !important; + border:none; + } + }'); + +$link = 'index.php?option=com_contenthistory&view=history&layout=modal&tmpl=component&item_id=' + . (int) $displayData['itemId'] . '&type_id=' . $displayData['typeId'] . '&type_alias=' + . $displayData['typeAlias'] . '&' . JSession::getFormToken() . '=1'; + +echo JHtmlBootstrap::renderModal('versionsModal', array( 'url' => $link, 'title' => $displayData['title'] ,'height' => '600px', 'width' => '800px'), ''); ?> - - - + diff --git a/libraries/cms/form/field/contenthistory.php b/libraries/cms/form/field/contenthistory.php index 33478dd0dc6b8..727cebfe66583 100644 --- a/libraries/cms/form/field/contenthistory.php +++ b/libraries/cms/form/field/contenthistory.php @@ -43,14 +43,28 @@ protected function getInput() . $this->id . '&item_id=' . $itemId . '&type_id=' . $typeId . '&type_alias=' . $this->element['data-typeAlias'] . '&' . JSession::getFormToken() . '=1'; - // Load the modal behavior script. - JHtml::_('behavior.modal', 'button.modal_' . $this->id); + JFactory::getDocument()->addStyleDeclaration(' + @media only screen and (min-width : 768px) { + #versionsModal { + width: 80% !important; + margin-left:-40% !important; + height:auto; + } + #versionsModal #versionsModal-container .modal-body iframe { + margin:0; + padding:0; + display:block; + width:100%; + height:400px !important; + border:none; + } + }'); - $html[] = ' '; + // Include jQuery + JHtml::_('jquery.framework'); + JHtml::_('bootstrap.modal'); + $html[] = ''; + $html[] = JHtmlBootstrap::renderModal('versionsModal', array( 'url' => $link, 'title' => $label ,'height' => '800px', 'width' => '600px'), ''); return implode("\n", $html); }