Skip to content

Commit

Permalink
Merge branch 'develop_mainline' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	setup/view/magento/setup/add-database.phtml
  • Loading branch information
eddielau committed Mar 14, 2015
2 parents 0a8bca9 + 8e8d3ae commit 1d1766e
Show file tree
Hide file tree
Showing 350 changed files with 21,082 additions and 18,574 deletions.
6 changes: 4 additions & 2 deletions app/code/Magento/AdminNotification/Block/System/Messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ public function getSystemMessageDialogJson()
[
'systemMessageDialog' => [
'autoOpen' => false,
'width' => 600,
'ajaxUrl' => $this->_getMessagesUrl(),
'width' => '75%',
'modal' => true,
'dialogClass' => 'ui-dialog-active ui-popup-message',
'ajaxUrl' => $this->_getMessagesUrl()
],
]
);
Expand Down
32 changes: 31 additions & 1 deletion app/code/Magento/AdminNotification/Block/ToolbarEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ class ToolbarEntry extends \Magento\Backend\Block\Template
/**
* Number of notifications showed on expandable window
*/
const NOTIFICATIONS_NUMBER = 4;
const NOTIFICATIONS_NUMBER = 3;

/**
* Number of notifications showed on icon
*/
const NOTIFICATIONS_COUNTER_MAX = 99;

/**
* Length of notification description showed by default
*/
const NOTIFICATION_DESCRIPTION_LENGTH = 150;

/**
* Collection of latest unread notifications
Expand All @@ -41,6 +51,26 @@ public function __construct(
$this->_notificationList = $notificationList;
}

/**
* Retrieve notification description start length
*
* @return int
*/
public function getNotificationDescriptionLength()
{
return self::NOTIFICATION_DESCRIPTION_LENGTH;
}

/**
* Retrieve notification counter max value
*
* @return int
*/
public function getNotificationCounterMax()
{
return self::NOTIFICATIONS_COUNTER_MAX;
}

/**
* Retrieve number of unread notifications
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<head>
<css src="Magento_Theme::prototype/magento.css"/>
</head>
<body>
<referenceContainer name="notifications">
<block class="Magento\AdminNotification\Block\System\Messages" name="system_messages" as="system_messages" before="-" template="Magento_AdminNotification::system/messages.phtml"/>
<block class="Magento\AdminNotification\Block\System\Messages\UnreadMessagePopup" name="unread_system_messages" as="unread_system_messages" after="system_messages" template="Magento_AdminNotification::system/messages/popup.phtml"/>
<block class="Magento\AdminNotification\Block\Window" name="notification_window" as="notification_window" acl="Magento_AdminNotification::show_toolbar" template="notification/window.phtml"/>
</referenceContainer>
<referenceContainer name="header">
<block class="Magento\AdminNotification\Block\ToolbarEntry" before="user" template="toolbar_entry.phtml"/>
<block class="Magento\AdminNotification\Block\ToolbarEntry" name="notification.messages" before="user" template="toolbar_entry.phtml"/>
</referenceContainer>
</body>
</page>
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@
* @see \Magento\AdminNotification\Block\Window
*/
?>
<div data-mage-init='{"modalPopup": {}}' class="fade critical-notification">
<div data-mage-init='{"modalPopup": {}}' class="fade critical-notification admin__scope">
<div class="popup popup-<?php echo preg_replace('#[^a-z0-9]+#', '-', strtolower($block->getSeverityText())) ?>">
<div class="popup-inner">
<header class="popup-header">
<h2 class="popup-title"><?php echo $block->getHeaderText(); ?></h2>
</header>
<div class="popup-header">
<div class="popup-title"><?php echo $block->getHeaderText(); ?></div>
</div>
<div class="popup-content">
<span><?php echo $block->getSeverityText();?></span>

<p class="message-text"><?php echo $block->getNoticeMessageText(); ?></p>

<a href="<?php echo $block->getNoticeMessageUrl(); ?>"><?php echo $block->getReadDetailsText(); ?></a>
</div>
<span class="close" data-dismiss="popup" title="<?php echo __('Close popup'); ?>"><?php echo __('Close'); ?></span>
<span class="action close" data-dismiss="popup" title="<?php echo $block->escapeHtml(__('Close popup'));?>"><?php echo __('Close'); ?></span>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,34 @@
<?php /** @var $block \Magento\AdminNotification\Block\System\Messages */ ?>

<?php $lastCritical = $block->getLastCritical();?>
<div id="system_messages" class="message-system<?php if ($lastCritical): ?> message-system-unread<?php endif; ?>">
<div id="system_messages" class="message-system<?php if ($lastCritical): ?> message-system-unread<?php endif; ?> admin__scope">
<div class="message-system-inner">
<?php if ($lastCritical): ?>
<ul class="message-system-list">
<li class="error"><!-- warning -->
<li class="message message-warning error">
<?php echo $lastCritical->getText();?>
</li>
</ul>
<?php endif; ?>
<div class="message-system-short">
System Messages:
<span class="message-system-short-label">
<?php echo __('System Messages:')?>
</span>

<?php if ($block->getCriticalCount()): ?>
<span class="error"><a href="#" title="<?php echo $block->escapeHtml(__('Critical System Messages'));?>"><?php echo $block->getCriticalCount();?></a></span>
<div class="message message-warning error">
<a class="message-link" href="#" title="<?php echo $block->escapeHtml(__('Critical System Messages'));?>">
<?php echo $block->getCriticalCount();?>
</a>
</div>
<?php endif;?>

<?php if ($block->getMajorCount()): ?>
<span class="warning"><a href="#" title="<?php echo $block->escapeHtml(__('Major System Messages'));?>"><?php echo $block->getMajorCount();?></a></span>
<div class="message message-warning warning">
<a class="message-link" href="#" title="<?php echo $block->escapeHtml(__('Major System Messages'));?>">
<?php echo $block->getMajorCount();?>
</a>
</div>
<?php endif;?>
</div>
<div id="message-system-all" title="<?php echo $block->escapeHtml(__('System messages'));?>" data-mage-init='<?php echo $block->escapeHtml($block->getSystemMessageDialogJson());?>'></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@

?>
<?php /** @var $block \Magento\AdminNotification\Block\System\Messages\UnreadMessagePopup */ ?>
<div id="system_messages_list" title="<?php echo $block->escapeHtml($block->getPopupTitle()); ?>">

<div id="system_messages_list" class="admin__scope" title="<?php echo $block->escapeHtml($block->getPopupTitle()); ?>">
<ul class="message-system-list">
<?php foreach ($block->getUnreadMessages() as $message): ?>
<li class="<?php echo $block->getItemClass($message);?>">
<li class="message message-warning <?php echo $block->getItemClass($message);?>">
<?php echo $message->getText();?>
</li>
<?php endforeach;?>
</ul>
</div>

<script>
require([
"jquery",
Expand All @@ -27,18 +29,21 @@ require([
$("#system_messages_list").dialog({
autoOpen: true,
resizable: false,
width: 650,
width: '75%',
modal: true,
dialogClass: 'ui-popup-message',
position: {
using: function(pos) {
$(this).css({
"position": "absolute",
"top": Math.ceil($(window).height()/2 - $(this).height()/2),
"left": pos.left
});
}
my: 'left+12.5% top',
at: 'center top',
of: 'body'
},
open: function() {
$(this).closest('.ui-dialog').addClass('ui-dialog-active');

var topMargin = $(this).closest('.ui-dialog').children('.ui-dialog-titlebar').outerHeight() + 10;
$(this).closest('.ui-dialog').css('margin-top', topMargin);
}
});
});

});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,77 @@

?>
<?php /** @var $this \Magento\AdminNotification\Block\ToolbarEntry */ ?>
<?php $notificationCount = $block->getUnreadNotificationCount(); ?>
<div data-mage-init='{"toolbarEntry": {}}' class="notifications-summary" data-notification-count="<?php echo $block->escapeHtml($notificationCount); ?>">
<?php
$notificationCount = $block->getUnreadNotificationCount();
$notificationCounterMax = $block->getNotificationCounterMax();
?>
<div
data-mage-init='{"toolbarEntry": {}}'
class="notifications-wrapper"
data-notification-count="<?php echo $notificationCount; ?>">
<?php if ($notificationCount > 0) : ?>
<a href="<?php echo $block->getUrl('adminhtml/notification/index'); ?>" class="action notifications-action" data-mage-init='{"dropdown":{}}' title="<?php echo __('Notifications'); ?>" data-toggle="dropdown">
<span class="text"><?php echo __('Notifications'); ?></span>
<span class="counter qty"><?php echo $block->escapeHtml($notificationCount); ?></span>
<a
href="<?php echo $block->getUrl('adminhtml/notification/index'); ?>"
class="notifications-action"
data-mage-init='{"dropdown":{}}'
title="<?php echo __('Notifications'); ?>"
data-toggle="dropdown">
<span class="notifications-counter">
<?php echo ($notificationCount > $notificationCounterMax) ? $notificationCounterMax . '+' : $notificationCount; ?>
</span>
</a>
<ul class="dropdown-menu notifications-list" data-mark-as-read-url="<?php echo $block->getUrl('adminhtml/notification/ajaxMarkAsRead'); ?>">
<ul
class="notifications-list"
data-mark-as-read-url="<?php echo $block->getUrl('adminhtml/notification/ajaxMarkAsRead'); ?>">
<?php foreach ($block->getLatestUnreadNotifications() as $notification) : ?>
<?php /** @var $notification \Magento\AdminNotification\Model\Inbox*/ ?>
<li class="notifications-entry<?php if ($notification->getSeverity() == 1): ?> notifications-critical<?php endif; ?>"
data-notification-id="<?php echo $block->escapeHtml($notification->getId()); ?>"
data-notification-id="<?php echo $notification->getId(); ?>"
data-notification-severity="<?php if ($notification->getSeverity() == 1): ?>1<?php endif; ?>">
<strong class="notifications-entry-title"><?php echo $block->escapeHtml($notification->getTitle()); ?></strong>
<span class="notifications-entry-description"><?php echo $block->escapeHtml($notification->getDescription()); ?></span>
<time class="notifications-entry-time"><?php echo $block->escapeHtml($block->formatNotificationDate($notification->getDateAdded())); ?></time>
<button type="button" class="action close notifications-close"><span><?php echo __('Close'); ?></span></button>
<div class="notifications-dialog-content" data-title="<?php echo __('Notification'); ?>" data-cancel-caption="<?php echo __('Cancel'); ?>" data-acknowledge-caption="<?php echo __('Acknowledge'); ?>">
<strong class="notifications-entry-title"><?php echo $block->escapeHtml($notification->getTitle()); ?></strong>
<span class="notifications-entry-description"><?php echo $block->escapeHtml($notification->getDescription()); ?></span>
<div class="actions notifications-entry-actions">
<a class="notifications-url" href="<?php echo $block->escapeUrl($notification->getUrl()); ?>" target="_blank"><?php echo __('Read Details'); ?></a>
</div>
<time class="notifications-entry-time"><?php echo $block->escapeHtml($block->formatNotificationDate($notification->getDateAdded())); ?></time>
</div>
<?php
$notificationDescription = $block->escapeHtml($notification->getDescription());
$notificationDescriptionLength = $block->getNotificationDescriptionLength();
?>
<strong class="notifications-entry-title">
<?php echo $block->escapeHtml($notification->getTitle()); ?>
</strong>
<?php if (strlen($notificationDescription) > $notificationDescriptionLength) : ?>
<p class="notifications-entry-description _cutted">
<span class="notifications-entry-description-start">
<?php echo substr($notificationDescription, 0, $notificationDescriptionLength); ?>
</span>
<span class="notifications-entry-description-end">
<?php echo substr($notificationDescription, $notificationDescriptionLength); ?>
</span>
</p>
<?php else : ?>
<p class="notifications-entry-description">
<?php echo $notificationDescription; ?>
</p>
<?php endif; ?>
<time class="notifications-entry-time">
<?php echo $block->formatNotificationDate($notification->getDateAdded()); ?>
</time>
<button
type="button"
class="notifications-close"
title="<?php echo __('Close'); ?>"
></button>
</li>
<?php endforeach; ?>
<li class="last">
<a href="<?php echo $block->getUrl('adminhtml/notification/index'); ?>" class="action more notification-more"><?php echo __('See All (%1 unread)', $notificationCount); ?></a>
<li class="notifications-entry notifications-entry-last">
<a
href="<?php echo $block->getUrl('adminhtml/notification/index'); ?>"
class="action-tertiary action-more">
<?php echo __('See All (') ?><span class="notifications-counter"><?php echo $notificationCount ?></span><?php echo __(' unread)'); ?>
</a>
</li>
</ul>
<?php else : ?>
<a href="<?php echo $block->getUrl('adminhtml/notification/index'); ?>" class="action notifications-action empty" title="<?php echo __('Notifications'); ?>">
<span class="text"><?php echo __('Notifications'); ?></span>
<a
class="notifications-action"
href="<?php echo $block->getUrl('adminhtml/notification/index'); ?>"
title="<?php echo __('Notifications'); ?>">
</a>
<?php endif; ?>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ define([
options: {
systemMessageTemplate:
'<% _.each(data.items, function(item) { %>' +
'<li class="<% if (item.severity == 1) { %>error<% } else { %>warning<% } %>">' +
'<li class="message message-warning <% if (item.severity == 1) { %>error<% } else { %>warning<% } %>">' +
'<%= item.text %>' +
'</li>' +
'<% }); %>'
},

open: function (severity) {
var superMethod = $.proxy(this._super, this);
var superMethod = $.proxy(this._super, this),
listTemplate,
fullTemplate;

$.ajax({
url: this.options.ajaxUrl,
Expand All @@ -36,12 +38,12 @@ define([
});

tmpl = $(tmpl);
listTemplate = $('<ul class="message-system-list"></ul>').append(tmpl);
fullTemplate = $('<div class="admin__scope"></div>').append(listTemplate);

this.element.html(
$('<ul />', {
'class': 'message-system-list'
}).append(tmpl)
).trigger('contentUpdated');
this.element
.html(fullTemplate)
.trigger('contentUpdated');

superMethod();
}, this));
Expand Down
Loading

0 comments on commit 1d1766e

Please sign in to comment.