Skip to content

Commit

Permalink
Merge pull request #37 from C-Lodder/messageclass
Browse files Browse the repository at this point in the history
Revisit the enqueueMessage classes
  • Loading branch information
C-Lodder authored Oct 6, 2016
2 parents cb86db9 + 28a9cbd commit 08d1f44
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 9 deletions.
1 change: 1 addition & 0 deletions administrator/templates/atum/_src/scss/template.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@import "../../../../../media/vendor/bootstrap/scss/variables";
@import "../../../../../media/vendor/bootstrap/scss/bootstrap";
@import "../../../../../media/system/scss/jfont-awesome";
@import "../../../../../media/system/scss/jalert";


html, body {
Expand Down
7 changes: 4 additions & 3 deletions administrator/templates/atum/css/template.css
Original file line number Diff line number Diff line change
Expand Up @@ -3318,13 +3318,13 @@ a.tag:focus, a.tag:hover {
right: -1rem;
color: inherit; }

.alert-success {
.alert-success, .alert-message {
background-color: #dff0d8;
border-color: #d0e9c6;
color: #3c763d; }
.alert-success hr {
.alert-success hr, .alert-message hr {
border-top-color: #c1e2b3; }
.alert-success .alert-link {
.alert-success .alert-link, .alert-message .alert-link {
color: #2b542c; }

.alert-info {
Expand Down Expand Up @@ -6908,6 +6908,7 @@ a.text-danger:focus, a.text-danger:hover {
[class*=" icon-"].disabled {
font-weight: normal; }

/* Bootstrap alert mapping */
html, body {
font-size: 14px; }

Expand Down
5 changes: 3 additions & 2 deletions administrator/templates/atum/css/template.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion administrator/templates/atum/css/template.min.css

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions layouts/joomla/system/message.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,30 @@

$msgList = $displayData['msgList'];

$alert = [
JApplicationCms::MSG_EMERGENCY => 'alert-danger',
JApplicationCms::MSG_ALERT => 'alert-danger',
JApplicationCms::MSG_CRITICAL => 'alert-danger',
JApplicationCms::MSG_ERROR => 'alert-danger',
JApplicationCms::MSG_WARNING => 'alert-warning',
JApplicationCms::MSG_NOTICE => 'alert-info',
JApplicationCms::MSG_INFO => 'alert-info',
JApplicationCms::MSG_DEBUG => 'alert-info',
];

?>
<div id="system-message-container">
<?php if (is_array($msgList) && !empty($msgList)) : ?>
<div id="system-message">
<?php foreach ($msgList as $type => $msgs) : ?>
<div class="alert alert-<?php echo $type; ?>">
<div class="alert <?php echo isset($alert[$type]) ? $alert[$type] : 'alert-' . $type; ?>">
<?php // This requires JS so we should add it trough JS. Progressive enhancement and stuff. ?>
<a class="close" data-dismiss="alert">&times;</a>
<?php if (!empty($msgs)) : ?>
<h4 class="alert-heading"><?php echo JText::_($type); ?></h4>
<div>
<?php foreach ($msgs as $msg) : ?>
<div class="alert-message"><?php echo $msg; ?></div>
<div><?php echo $msg; ?></div>
<?php endforeach; ?>
</div>
<?php endif; ?>
Expand Down
66 changes: 65 additions & 1 deletion libraries/cms/application/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,70 @@
*/
class JApplicationCms extends JApplicationWeb
{
/**
* Constant defining an enqueued emergency message
*
* @var string
* @since 4.0
*/
const MSG_EMERGENCY = 'emergency';

/**
* Constant defining an enqueued alert message
*
* @var string
* @since 4.0
*/
const MSG_ALERT = 'alert';

/**
* Constant defining an enqueued critical message
*
* @var string
* @since 4.0
*/
const MSG_CRITICAL = 'critical';

/**
* Constant defining an enqueued error message
*
* @var string
* @since 4.0
*/
const MSG_ERROR = 'error';

/**
* Constant defining an enqueued warning message
*
* @var string
* @since 4.0
*/
const MSG_WARNING = 'warning';

/**
* Constant defining an enqueued notice message
*
* @var string
* @since 4.0
*/
const MSG_NOTICE = 'notice';

/**
* Constant defining an enqueued info message
*
* @var string
* @since 4.0
*/
const MSG_INFO = 'info';

/**
* Constant defining an enqueued debug message
*
* @var string
* @since 4.0
*/
const MSG_DEBUG = 'debug';

/**
* Array of options for the JDocument object
*
Expand Down Expand Up @@ -228,7 +292,7 @@ public function checkSession()
*
* @since 3.2
*/
public function enqueueMessage($msg, $type = 'message')
public function enqueueMessage($msg, $type = self::MSG_INFO)
{
// Don't add empty messages.
if (!strlen(trim($msg)))
Expand Down
5 changes: 5 additions & 0 deletions media/system/scss/_jalert.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* Bootstrap alert mapping */

.alert-message {
@extend .alert-success;
}

0 comments on commit 08d1f44

Please sign in to comment.