Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move content history to bs modal #4561

Closed
wants to merge 10 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
);

?>
<h3><?php echo JText::_('COM_CONTENTHISTORY_MODAL_TITLE'); ?></h3>
<div class="btn-group pull-right">
<button id="toolbar-load" type="submit" class="btn hasTooltip" data-placement="bottom" title="<?php echo JText::_('COM_CONTENTHISTORY_BUTTON_LOAD_DESC'); ?>"
data-url="<?php echo JRoute::_($loadUrl);?>" id="content-url">
Expand Down
6 changes: 4 additions & 2 deletions administrator/includes/toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,10 @@ public static function preferences($component, $height = '550', $width = '875',
*/
public static function versions($typeAlias, $itemId, $height = 800, $width = 500, $alt = 'JTOOLBAR_VERSIONS')
{
JHtml::_('behavior.modal', 'a.modal_jform_contenthistory');
JHtml::_('bootstrap.modal');

$lang = JFactory::getLanguage();
$lang->load('com_contenthistory', JPATH_ADMINISTRATOR, $lang->getTag(), true);
$contentTypeTable = JTable::getInstance('Contenttype');
$typeId = $contentTypeTable->getTypeId($typeAlias);

Expand Down Expand Up @@ -626,7 +628,7 @@ public static function versions($typeAlias, $itemId, $height = 800, $width = 500
*/
public static function modal($targetModalId, $icon, $alt)
{
JHtml::_('behavior.modal');
JHtml::_('bootstrap.modal');
$title = JText::_($alt);
$dhtml = "<button data-toggle='modal' data-target='#" . $targetModalId . "' class='btn btn-small'>
<i class='" . $icon . "' title='" . $title . "'></i> " . $title . "</button>";
Expand Down
16 changes: 9 additions & 7 deletions administrator/templates/isis/css/template-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -3906,13 +3906,15 @@ input[type="submit"].btn.btn-mini {
line-height: 30px;
}
.modal-body {
width: 98%;
position: relative;
overflow-y: auto;
max-height: 400px;
padding: 15px;
max-height: none;
padding: 1%;
}
.modal-body iframe {
max-height: 390px;
width: 100%;
max-height: none;
border: 0 !important;
}
.modal-form {
Expand Down Expand Up @@ -6151,11 +6153,11 @@ th .tooltip-inner {
}
div.modal {
position: fixed;
top: 10%;
top: 5%;
left: 50%;
z-index: 1050;
width: 580px;
margin-left: -280px;
width: 80%;
margin-left: -40%;
background-color: #fff;
border: 1px solid #999;
border: 1px solid rgba(0,0,0,0.3);
Expand All @@ -6179,7 +6181,7 @@ div.modal.fade {
top: -25%;
}
div.modal.fade.in {
top: 10%;
top: 5%;
}
.modal-batch {
overflow-y: visible;
Expand Down
16 changes: 9 additions & 7 deletions administrator/templates/isis/css/template.css
Original file line number Diff line number Diff line change
Expand Up @@ -3906,13 +3906,15 @@ input[type="submit"].btn.btn-mini {
line-height: 30px;
}
.modal-body {
width: 98%;
position: relative;
overflow-y: auto;
max-height: 400px;
padding: 15px;
max-height: none;
padding: 1%;
}
.modal-body iframe {
max-height: 390px;
width: 100%;
max-height: none;
border: 0 !important;
}
.modal-form {
Expand Down Expand Up @@ -6151,11 +6153,11 @@ th .tooltip-inner {
}
div.modal {
position: fixed;
top: 10%;
top: 5%;
left: 50%;
z-index: 1050;
width: 580px;
margin-left: -280px;
width: 80%;
margin-left: -40%;
background-color: #fff;
border: 1px solid #999;
border: 1px solid rgba(0,0,0,0.3);
Expand All @@ -6179,7 +6181,7 @@ div.modal.fade {
top: -25%;
}
div.modal.fade.in {
top: 10%;
top: 5%;
}
.modal-batch {
overflow-y: visible;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
// open in a modal window
JHtml::_('behavior.modal', 'a.modal');
echo '<a class="modal" href="'.htmlspecialchars($link).'" rel="{handler: \'iframe\', size: {x:600, y:600}}">'.
htmlspecialchars($label) . ' </a>';
htmlspecialchars($label) . ' </a>';
break;

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
// Open in a modal window
JHtml::_('behavior.modal', 'a.modal');
echo '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x:' . $this->escape($width) . ', y:' . $this->escape($height) . '}}">' .
$this->escape($item->title) . ' </a>';
$this->escape($item->title) . ' </a>';
break;

default:
Expand Down
15 changes: 15 additions & 0 deletions layouts/joomla/toolbar/versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,24 @@
*/

defined('_JEXEC') or die;

$link = 'index.php?option=com_contenthistory&amp;view=history&amp;layout=modal&amp;tmpl=component&amp;item_id='
. (int) $displayData['itemId'] . '&amp;type_id=' . $displayData['typeId'] . '&amp;type_alias='
. $displayData['typeAlias'] . '&amp;' . JSession::getFormToken() . '=1';

if (JFactory::getApplication()->isAdmin()) {
echo JHtmlBootstrap::renderModal('versionsModal', array( 'url' => $link, 'title' => JText::_('COM_CONTENTHISTORY_MODAL_TITLE'),'height' => '600px', 'width' => '800px'), '');
}
?>
<?php if (JFactory::getApplication()->isAdmin()) : ?>
<button onclick="jQuery('#versionsModal').modal('show')" class="btn btn-small" data-toggle="modal" title="<?php echo $displayData['title']; ?>">
<span class="icon-archive"></span><?php echo $displayData['title']; ?></button>
<?php endif; ?>

<?php if (JFactory::getApplication()->isSite()) : ?>
<a rel="{handler: 'iframe', size: {x: <?php echo $displayData['height']; ?>, y: <?php echo $displayData['width']; ?>}}"
href="index.php?option=com_contenthistory&amp;view=history&amp;layout=modal&amp;tmpl=component&amp;item_id=<?php echo (int) $displayData['itemId']; ?>&amp;type_id=<?php echo $displayData['typeId']; ?>&amp;type_alias=<?php echo $displayData['typeAlias']; ?>&amp;<?php echo JSession::getFormToken(); ?>=1"
title="<?php echo $displayData['title']; ?>" class="btn btn-small modal_jform_contenthistory">
<i class="icon-archive"></i> <?php echo $displayData['title']; ?>
</a>
<?php endif; ?>
25 changes: 18 additions & 7 deletions libraries/cms/form/field/contenthistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,25 @@ protected function getInput()
. $this->id . '&amp;item_id=' . $itemId . '&amp;type_id=' . $typeId . '&amp;type_alias='
. $this->element['data-typeAlias'] . '&amp;' . JSession::getFormToken() . '=1';

// Load the modal behavior script.
JHtml::_('behavior.modal', 'button.modal_' . $this->id);
if (JFactory::getApplication()->isSite())
{
// Load the modal behavior script.
JHtml::_('behavior.modal', 'button.modal_' . $this->id);

$html[] = ' <button class="btn modal_' . $this->id . '" title="' . $label . '" href="' . $link . '"'
. ' rel="{handler: \'iframe\', size: {x: 800, y: 500}}">';
$html[] = '<i class="icon-archive"></i>';
$html[] = $label;
$html[] = '</button>';
$html[] = ' <button class="btn modal_' . $this->id . '" title="' . $label . '" href="' . $link . '"'
. ' rel="{handler: \'iframe\', size: {x: 800, y: 500}}">';
$html[] = '<i class="icon-archive"></i>';
$html[] = $label;
$html[] = '</button>';
}
elseif (JFactory::getApplication()->isAdmin())
{
// Include jQuery
JHtml::_('jquery.framework');
JHtml::_('bootstrap.modal');
$html[] = '<button href="#versionsModal" role="button" class="btn btn-small" data-toggle="modal" title="' . $label . '"><span class="icon-archive"></span>' . $label . '</button>';
$html[] = JHtmlBootstrap::renderModal('versionsModal', array( 'url' => $link, 'title' => $label ,'height' => '600px', 'width' => '800px'), '');
}

return implode("\n", $html);
}
Expand Down
12 changes: 6 additions & 6 deletions media/jui/less/modals.joomla.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
// Base modal
div.modal {
position: fixed;
top: 10%;
top: 5%;
left: 50%;
z-index: @zindexModal;
width: 580px;
margin-left: -280px;
width: 80%;
margin-left: -40%;
background-color: @white;
border: 1px solid #999;
border: 1px solid rgba(0,0,0,.3);
Expand All @@ -24,10 +24,10 @@ div.modal {
outline: none;

&.fade {
.transition(e('opacity .3s linear, top .3s ease-out'));
top: -25%;
.transition(e('opacity .3s linear, top .3s ease-out'));
top: -25%;
}
&.fade.in { top: 10%; }
&.fade.in { top: 5%; }
}
//Modal for Batch views
.modal-batch {
Expand Down
20 changes: 11 additions & 9 deletions media/jui/less/modals.less
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,23 @@
.close { margin-top: 2px; }
// Heading
h3 {
margin: 0;
line-height: 30px;
margin: 0;
line-height: 30px;
}
}

// Body (where all modal content resides)
.modal-body {
width: 98%;
position: relative;
overflow-y: auto;
max-height: 400px;
padding: 15px;
max-height: none;
padding: 1%;
}
// Remove border and scrollbar from iframe modal
.modal-body iframe {
max-height: 390px;
width: 100%;
max-height: none;
border: 0 !important;
}
// Remove bottom margin if need be
Expand All @@ -67,15 +69,15 @@

// Properly space out buttons
.btn + .btn {
margin-left: 5px;
margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs
margin-left: 5px;
margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs
}
// but override that for button groups
.btn-group .btn + .btn {
margin-left: -1px;
margin-left: -1px;
}
// and override it for block buttons as well
.btn-block + .btn-block {
margin-left: 0;
margin-left: 0;
}
}
16 changes: 9 additions & 7 deletions templates/protostar/css/template.css
Original file line number Diff line number Diff line change
Expand Up @@ -3906,13 +3906,15 @@ input[type="submit"].btn.btn-mini {
line-height: 30px;
}
.modal-body {
width: 98%;
position: relative;
overflow-y: auto;
max-height: 400px;
padding: 15px;
max-height: none;
padding: 1%;
}
.modal-body iframe {
max-height: 390px;
width: 100%;
max-height: none;
border: 0 !important;
}
.modal-form {
Expand Down Expand Up @@ -6151,11 +6153,11 @@ th .tooltip-inner {
}
div.modal {
position: fixed;
top: 10%;
top: 5%;
left: 50%;
z-index: 1050;
width: 580px;
margin-left: -280px;
width: 80%;
margin-left: -40%;
background-color: #fff;
border: 1px solid #999;
border: 1px solid rgba(0,0,0,0.3);
Expand All @@ -6179,7 +6181,7 @@ div.modal.fade {
top: -25%;
}
div.modal.fade.in {
top: 10%;
top: 5%;
}
.modal-batch {
overflow-y: visible;
Expand Down