Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/develop' into MAGETWO-33227
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Makarenko committed Jan 28, 2015
2 parents bef0a3f + 5a00464 commit ab6d04c
Show file tree
Hide file tree
Showing 1,904 changed files with 27,589 additions and 105,776 deletions.
513 changes: 429 additions & 84 deletions Gruntfile.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
var config = {
map: {
'*': {
systemMessageDialog: 'Magento_AdminNotification/system/notification'
systemMessageDialog: 'Magento_AdminNotification/system/notification',
toolbarEntry: 'Magento_AdminNotification/toolbar_entry'
}
},
deps: [
"Magento_AdminNotification/toolbar_entry"
]
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @see \Magento\AdminNotification\Block\Window
*/
?>
<div class="fade critical-notification">
<div data-mage-init='{"modalPopup": {}}' class="fade critical-notification">
<div class="popup popup-<?php echo preg_replace('#[^a-z0-9]+#', '-', strtolower($this->getSeverityText())) ?>">
<div class="popup-inner">
<header class="popup-header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
?>
<?php /** @var $this \Magento\AdminNotification\Block\ToolbarEntry */ ?>
<?php $notificationCount = $this->getUnreadNotificationCount(); ?>
<div class="notifications-summary" data-notification-count="<?php echo $this->escapeHtml($notificationCount); ?>">
<div data-mage-init='{"toolbarEntry": {}}' class="notifications-summary" data-notification-count="<?php echo $this->escapeHtml($notificationCount); ?>">
<?php if ($notificationCount > 0) : ?>
<a href="<?php echo $this->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>
Expand Down
181 changes: 90 additions & 91 deletions app/code/Magento/AdminNotification/view/adminhtml/web/toolbar_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,106 +4,105 @@
*/
define([
"jquery",
"jquery/ui"
"jquery/ui",
"domReady!"
], function($){
'use strict';

$(document).ready(function() {
// Mark notification as read via AJAX call
var markNotificationAsRead = function(notificationId) {
var requestUrl = $('.notifications-summary .dropdown-menu').attr('data-mark-as-read-url');
$.ajax({
url: requestUrl,
type: 'POST',
dataType: 'json',
data: {
id: notificationId
},
showLoader: false
});
};
var notificationCount = $('.notifications-summary').attr('data-notification-count');
// Remove notification from the list
var removeNotificationFromList = function(notificationEntry) {
notificationEntry.remove();
notificationCount--;
$('.notifications-summary').attr('data-notification-count', notificationCount);

if (notificationCount == 0) {
// Change appearance of the bubble and its behavior when the last notification is removed
$('.notifications-summary .dropdown-menu').remove();
var notificationIcon = $('.notifications-summary .notifications-icon');
notificationIcon.removeAttr('data-toggle');
notificationIcon.off('click.dropdown');
$('.notifications-action .counter').text('');
$('.notifications-action .counter').hide();
} else {
$('.notifications-action .counter').text(notificationCount);
// Modify caption of the 'See All' link
var actionElement = $('.notifications-summary .dropdown-menu .last .action-more');
actionElement.text(actionElement.text().replace(/\d+/, notificationCount));
}
};

// Show popup with notification details
var showNotificationDetails = function(notificationEntry) {
var popupElement = notificationEntry.find('.notifications-dialog-content').clone();
var notificationId = notificationEntry.attr('data-notification-id');
var dialogClassSeverity = 'notifications-entry-dialog';
if (notificationEntry.attr('data-notification-severity')) {
dialogClassSeverity = 'notifications-entry-dialog notifications-entry-dialog-critical';
}
popupElement.dialog({
title: popupElement.attr('data-title'),
minWidth: 500,
modal: true,
dialogClass: dialogClassSeverity,
buttons: [
{
text: popupElement.attr('data-acknowledge-caption'),
'class': 'action-acknowledge primary',
click: function(event) {
markNotificationAsRead(notificationId);
removeNotificationFromList(notificationEntry);
$(this).dialog('close');
}
},
{
text: popupElement.attr('data-cancel-caption'),
'class': 'action-cancel',
click: function(event) {
$(this).dialog('close');
}
}
]
});
popupElement.parent().attr('aria-live','assertive');
popupElement.dialog('open');
};

// Show notification description when corresponding item is clicked
$('.notifications-summary .dropdown-menu .notifications-entry').on('click.showNotification', function(event) {
// hide notification dropdown
$('.notifications-summary .notifications-icon').trigger('click.dropdown');
showNotificationDetails($(this));
event.stopPropagation();
});

// Remove corresponding notification from the list and mark it as read
$('.notifications-close').on('click.removeNotification', function(event) {
var notificationEntry = $(this).closest('.notifications-entry')
var notificationId = notificationEntry.attr('data-notification-id');
markNotificationAsRead(notificationId);
removeNotificationFromList(notificationEntry);
event.stopPropagation();
// Mark notification as read via AJAX call
var markNotificationAsRead = function(notificationId) {
var requestUrl = $('.notifications-summary .dropdown-menu').attr('data-mark-as-read-url');
$.ajax({
url: requestUrl,
type: 'POST',
dataType: 'json',
data: {
id: notificationId
},
showLoader: false
});
};
var notificationCount = $('.notifications-summary').attr('data-notification-count');
// Remove notification from the list
var removeNotificationFromList = function(notificationEntry) {
notificationEntry.remove();
notificationCount--;
$('.notifications-summary').attr('data-notification-count', notificationCount);

// Hide notifications bubble
if (notificationCount == 0) {
// Change appearance of the bubble and its behavior when the last notification is removed
$('.notifications-summary .dropdown-menu').remove();
var notificationIcon = $('.notifications-summary .notifications-icon');
notificationIcon.removeAttr('data-toggle');
notificationIcon.off('click.dropdown');
$('.notifications-action .counter').text('');
$('.notifications-action .counter').hide();
} else {
$('.notifications-action .counter').show();
$('.notifications-action .counter').text(notificationCount);
// Modify caption of the 'See All' link
var actionElement = $('.notifications-summary .dropdown-menu .last .action-more');
actionElement.text(actionElement.text().replace(/\d+/, notificationCount));
}
};

// Show popup with notification details
var showNotificationDetails = function(notificationEntry) {
var popupElement = notificationEntry.find('.notifications-dialog-content').clone();
var notificationId = notificationEntry.attr('data-notification-id');
var dialogClassSeverity = 'notifications-entry-dialog';
if (notificationEntry.attr('data-notification-severity')) {
dialogClassSeverity = 'notifications-entry-dialog notifications-entry-dialog-critical';
}
popupElement.dialog({
title: popupElement.attr('data-title'),
minWidth: 500,
modal: true,
dialogClass: dialogClassSeverity,
buttons: [
{
text: popupElement.attr('data-acknowledge-caption'),
'class': 'action-acknowledge primary',
click: function(event) {
markNotificationAsRead(notificationId);
removeNotificationFromList(notificationEntry);
$(this).dialog('close');
}
},
{
text: popupElement.attr('data-cancel-caption'),
'class': 'action-cancel',
click: function(event) {
$(this).dialog('close');
}
}
]
});
popupElement.parent().attr('aria-live','assertive');
popupElement.dialog('open');
};

// Show notification description when corresponding item is clicked
$('.notifications-summary .dropdown-menu .notifications-entry').on('click.showNotification', function(event) {
// hide notification dropdown
$('.notifications-summary .notifications-icon').trigger('click.dropdown');
showNotificationDetails($(this));
event.stopPropagation();
});

// Remove corresponding notification from the list and mark it as read
$('.notifications-close').on('click.removeNotification', function(event) {
var notificationEntry = $(this).closest('.notifications-entry')
var notificationId = notificationEntry.attr('data-notification-id');
markNotificationAsRead(notificationId);
removeNotificationFromList(notificationEntry);
event.stopPropagation();
});

// Hide notifications bubble
if (notificationCount == 0) {
$('.notifications-action .counter').hide();
} else {
$('.notifications-action .counter').show();
}

});
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ protected function _getFooterHtml($element)
protected function _getExtraJs($element)
{
$htmlId = $element->getHtmlId();
$output = "Fieldset.applyCollapse('{$htmlId}');";
$output = "require(['prototype'], function(){Fieldset.applyCollapse('{$htmlId}');});";
return $this->_jsHelper->getScript($output);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function _prepareForm()
'label' => __('Date From'),
'title' => __('Date From'),
'name' => 'date_from',
'image' => $this->getViewFileUrl('images/grid-cal.gif'),
'image' => $this->getViewFileUrl('images/grid-cal.png'),
'date_format' => $dateFormat
//'required' => true
]
Expand All @@ -112,7 +112,7 @@ protected function _prepareForm()
'label' => __('Date To'),
'title' => __('Date To'),
'name' => 'date_to',
'image' => $this->getViewFileUrl('images/grid-cal.gif'),
'image' => $this->getViewFileUrl('images/grid-cal.png'),
'date_format' => $dateFormat
//'required' => true
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function getToggleAttributesHtml()
}

$attributes = ['title' => $title, 'class' => join(' ', $classes), 'disabled' => $disabled];
$this->_getDataAttributes(['toggle' => 'dropdown'], $attributes);
$this->_getDataAttributes(['mage-init' => '{"dropdown": {}}', 'toggle' => 'dropdown'], $attributes);

$html = $this->_getAttributesString($attributes);
$html .= $this->getUiId('dropdown');
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Block/Widget/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ protected function _applyTypeSpecificConfig($inputType, $element, \Magento\Eav\M
$element->setCanBeEmpty(true);
break;
case 'date':
$element->setImage($this->getViewFileUrl('images/grid-cal.gif'));
$element->setImage($this->getViewFileUrl('images/grid-cal.png'));
$element->setDateFormat($this->_localeDate->getDateFormatWithLongYear());
break;
case 'multiline':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function getHtml()
'",
buttonImage: "' .
$this->getViewFileUrl(
'images/grid-cal.gif'
'images/grid-cal.png'
) . '",
buttonText: "' . $this->escapeHtml(__('Date selector')) .
'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function getHtml()
dateFormat: "' . $format . '",
timeFormat: "' . $timeFormat . '",
showsTime: ' . ($this->getColumn()->getFilterTime() ? 'true' : 'false') . ',
buttonImage: "' . $this->getViewFileUrl('images/grid-cal.gif') . '",
buttonImage: "' . $this->getViewFileUrl('images/grid-cal.png') . '",
buttonText: "' . $this->escapeHtml(__('Date selector')) . '",
from: {
id: "' . $htmlId . '_from"
Expand Down
21 changes: 3 additions & 18 deletions app/code/Magento/Backend/view/adminhtml/layout/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,10 @@
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<head>
<title>Magento Admin</title>
<link src="prototype/prototype.js"/>
<link src="prototype/window.js"/>
<link src="scriptaculous/builder.js"/>
<link src="scriptaculous/effects.js"/>
<link src="lib/ccard.js"/>
<link src="prototype/validation.js"/>
<link src="varien/js.js"/>
<link src="mage/adminhtml/varienLoader.js"/>
<link src="mage/adminhtml/tools.js"/>
<link src="lib/ds-sleight.js" ie_condition="lt IE 7" defer="defer"/>
<css src="mage/calendar.css"/>
<link src="legacy-build.min.js"/>
<link src="requirejs/require.js"/>
<link src="mage/requirejs/resolver.js"/>
<link src="jquery/jquery.js"/>
<link src="mage/jquery-no-conflict.js"/>
<link src="app-config.js"/>
<link src="extjs/ext-tree.js"/>
<link src="extjs/ext-tree-checkbox.js"/>
<link src="jquery.js"/>
<css src="mage/calendar.css"/>
<css src="extjs/resources/css/ext-all.css"/>
<css src="extjs/resources/css/ytheme-magento.css"/>
</head>
Expand Down Expand Up @@ -87,7 +73,6 @@
<referenceContainer name="after.body.start">
<block class="Magento\RequireJs\Block\Html\Head\Config" name="requirejs-config"/>
<block class="Magento\Translation\Block\Js" name="translate" template="Magento_Translation::translate.phtml"/>
<block class="Magento\Framework\View\Element\Template" name="head.scripts" template="Magento_Backend::page/js/head_scripts.phtml"/>
<block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Backend::page/js/components.phtml"/>
<block class="Magento\Framework\View\Element\Html\Calendar" name="head.calendar" as="calendar" template="Magento_Backend::page/js/calendar.phtml"/>
</referenceContainer>
Expand Down
41 changes: 0 additions & 41 deletions app/code/Magento/Backend/view/adminhtml/requirejs-config.js

This file was deleted.

Loading

0 comments on commit ab6d04c

Please sign in to comment.