Skip to content

Commit

Permalink
core needs patching
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrammatiko committed Jul 21, 2017
1 parent b0a580d commit 214db09
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 43 deletions.
34 changes: 16 additions & 18 deletions installation/template/html/system/message.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,19 @@
JApplicationCms::MSG_DEBUG => 'info',
];
?>
<div id="system-message-container">
<?php if (is_array($msgList) && !empty($msgList)) : ?>
<div id="system-message">
<?php foreach ($msgList as $type => $msgs) : ?>
<joomla-alert level="<?php echo isset($alert[$type]) ? $alert[$type] : $type; ?>" dismiss="true">
<?php if (!empty($msgs)) : ?>
<h4><?php echo JText::_($type); ?></h4>
<div>
<?php foreach ($msgs as $msg) : ?>
<div><?php echo $msg; ?></div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</joomla-alert>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php if (is_array($msgList) && !empty($msgList)) : ?>
<div id="system-message">
<?php foreach ($msgList as $type => $msgs) : ?>
<joomla-alert level="<?php echo isset($alert[$type]) ? $alert[$type] : $type; ?>" dismiss="true">
<?php if (!empty($msgs)) : ?>
<h4><?php echo JText::_($type); ?></h4>
<div>
<?php foreach ($msgs as $msg) : ?>
<div><?php echo $msg; ?></div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</joomla-alert>
<?php endforeach; ?>
</div>
<?php endif; ?>
8 changes: 5 additions & 3 deletions installation/template/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@
</header>
<?php // Container ?>
<section class="container container-main" role="main">
<jdoc:include type="message" />
<div id="system-message-container">
<jdoc:include type="message" />
</div>
<div id="javascript-warning">
<noscript>
<div class="alert alert-danger text-center">
<joomla-alert level="danger text-center">
<?php echo JText::_('INSTL_WARNJAVASCRIPT'); ?>
</div>
</joomla-alert>
</noscript>
</div>
<div id="container-installation" class="container-installation flex no-js" data-base-url="<?php echo JUri::root(); ?>" style="display:none">
Expand Down
73 changes: 52 additions & 21 deletions media/system/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,23 +316,42 @@ Joomla.editors.instances = Joomla.editors.instances || {
// Array of messages of this type
typeMessages = messages[ type ];

// Create the alert box
messagesBox = document.createElement( 'div' );
if (window.customElements && typeof customElements.get('joomla-alert') === 'function') {
messagesBox = document.createElement( 'joomla-alert' );

if (['notice','message', 'error'].indexOf(type) > -1) {
alertClass = (type == 'notice') ? 'info' : type;
alertClass = (type == 'message') ? 'success' : alertClass;
alertClass = (type == 'error') ? 'danger' : alertClass;
} else {
alertClass = 'info';
}

// Message class
alertClass = (type == 'notice') ? 'alert-info' : 'alert-' + type;
alertClass = (type == 'message') ? 'alert-success' : alertClass;
alertClass = (type == 'error') ? 'alert-danger' : alertClass;
messagesBox.setAttribute('level', alertClass);
messagesBox.setAttribute('dismiss', 'true');
} else {
// Create the alert box
messagesBox = document.createElement( 'div' );

// Message class
if (['notice','message', 'error'].indexOf(type) > -1) {
alertClass = (type == 'notice') ? 'info' : type;
alertClass = (type == 'message') ? 'success' : alertClass;
alertClass = (type == 'error') ? 'danger' : alertClass;
} else {
alertClass = 'info';
}

messagesBox.className = 'alert ' + alertClass;
messagesBox.className = 'alert ' + alertClass;

// Close button
var buttonWrapper = document.createElement( 'button' );
buttonWrapper.setAttribute('type', 'button');
buttonWrapper.setAttribute('data-dismiss', 'alert');
buttonWrapper.className = 'close';
buttonWrapper.innerHTML = '×';
messagesBox.appendChild( buttonWrapper );
// Close button
var buttonWrapper = document.createElement( 'button' );
buttonWrapper.setAttribute('type', 'button');
buttonWrapper.setAttribute('data-dismiss', 'alert');
buttonWrapper.className = 'close';
buttonWrapper.innerHTML = '×';
messagesBox.appendChild( buttonWrapper );
}

// Title
title = Joomla.JText._( type );
Expand All @@ -341,7 +360,7 @@ Joomla.editors.instances = Joomla.editors.instances || {
if ( typeof title != 'undefined' ) {
titleWrapper = document.createElement( 'h4' );
titleWrapper.className = 'alert-heading';
titleWrapper.innerHTML = Joomla.JText._( type );
titleWrapper.innerHTML = Joomla.JText._( type ) ? Joomla.JText._( type ) : type;
messagesBox.appendChild( titleWrapper );
}

Expand Down Expand Up @@ -378,14 +397,26 @@ Joomla.editors.instances = Joomla.editors.instances || {
} else {
messageContainer = container;
}
if (!messageContainer) {
messageContainer = document;
}

// Empty container with a while for Chrome performance issues
while ( messageContainer.firstChild ) messageContainer.removeChild( messageContainer.firstChild );
if (window.customElements && customElements.get('joomla-alert')) {
var messages = messageContainer.querySelectorAll('joomla-alert');
if (messages.length) {
for (var i = 0, l = messages.length; i < l; i++) {
messages[i].parentNode.remove(messages[i]);
}
}
} else {
// Empty container with a while for Chrome performance issues
while ( messageContainer.firstChild ) messageContainer.removeChild( messageContainer.firstChild );

// Fix Chrome bug not updating element height
messageContainer.style.display = 'none';
messageContainer.offsetHeight;
messageContainer.style.display = '';
// Fix Chrome bug not updating element height
messageContainer.style.display = 'none';
messageContainer.offsetHeight;
messageContainer.style.display = '';
}
};

/**
Expand Down
Loading

0 comments on commit 214db09

Please sign in to comment.