Skip to content

Commit e297781

Browse files
author
Natalia Momotenko
committed
MAGETWO-31195: Image compression and sizing
- Merge remote-tracking branch 'magento2ce/develop' into develop Conflicts: Gruntfile.js app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml lib/web/jquery/farbtastic/images/marker.png lib/web/jquery/farbtastic/images/mask.png lib/web/jquery/farbtastic/images/wheel.png
2 parents 9276f80 + 9e8434e commit e297781

File tree

953 files changed

+22351
-96613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

953 files changed

+22351
-96613
lines changed

Gruntfile.js

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ module.exports = function (grunt) {
1212
// Required plugins
1313
// _____________________________________________
1414

15+
require('./dev/tools/grunt/tasks/mage-minify')(grunt);
16+
1517
// Time how long tasks take. Can help when optimizing build times
1618
require('time-grunt')(grunt);
1719

@@ -37,6 +39,9 @@ module.exports = function (grunt) {
3739
less: {
3840
setup: 'setup/module/Magento/Setup/styles'
3941
},
42+
uglify: {
43+
legacy: 'lib/web/legacy-build.min.js'
44+
},
4045
doc: 'lib/web/css/docs'
4146
};
4247

@@ -413,6 +418,29 @@ module.exports = function (grunt) {
413418
}
414419
},
415420

421+
'mage-minify': {
422+
legacy: {
423+
options: {
424+
type: 'yui-js',
425+
tempPath: 'var/cache/',
426+
options: ['--nomunge=true']
427+
},
428+
files: {
429+
'<%= config.path.uglify.legacy %>': [
430+
'lib/web/prototype/prototype.js',
431+
'lib/web/prototype/window.js',
432+
'lib/web/scriptaculous/builder.js',
433+
'lib/web/scriptaculous/effects.js',
434+
'lib/web/lib/ccard.js',
435+
'lib/web/prototype/validation.js',
436+
'lib/web/varien/js.js',
437+
'lib/web/mage/adminhtml/varienLoader.js',
438+
'lib/web/mage/adminhtml/tools.js'
439+
]
440+
}
441+
}
442+
},
443+
416444
//
417445

418446
styledocco: {
@@ -442,16 +470,6 @@ module.exports = function (grunt) {
442470
grunt.log.subhead('I\'m default task and at the moment I\'m empty, sorry :/');
443471
});
444472

445-
// Documentation
446-
// ---------------------------------------------
447-
448-
grunt.registerTask('documentation', [
449-
'less:documentation',
450-
'styledocco:documentation',
451-
'clean:var',
452-
'clean:pub'
453-
]);
454-
455473
// Refresh magento frontend & backend
456474
// ---------------------------------------------
457475

@@ -462,6 +480,24 @@ module.exports = function (grunt) {
462480
'less:backend'
463481
]);
464482

483+
// Creates build of a legacy files.
484+
// Mostly prototype dependant libraries.
485+
// ---------------------------------------------
486+
487+
grunt.registerTask('legacy-build', [
488+
'mage-minify:legacy'
489+
]);
490+
491+
// Documentation
492+
// ---------------------------------------------
493+
494+
grunt.registerTask('documentation', [
495+
'less:documentation',
496+
'styledocco:documentation',
497+
'clean:var',
498+
'clean:pub'
499+
]);
500+
465501
// Production
466502
// ---------------------------------------------
467503

app/code/Magento/AdminNotification/view/adminhtml/requirejs-config.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
var config = {
77
map: {
88
'*': {
9-
systemMessageDialog: 'Magento_AdminNotification/system/notification'
9+
systemMessageDialog: 'Magento_AdminNotification/system/notification',
10+
toolbarEntry: 'Magento_AdminNotification/toolbar_entry'
1011
}
11-
},
12-
deps: [
13-
"Magento_AdminNotification/toolbar_entry"
14-
]
12+
}
1513
};

app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @see \Magento\AdminNotification\Block\Window
1313
*/
1414
?>
15-
<div class="fade critical-notification">
15+
<div data-mage-init='{"modalPopup": {}}' class="fade critical-notification">
1616
<div class="popup popup-<?php echo preg_replace('#[^a-z0-9]+#', '-', strtolower($this->getSeverityText())) ?>">
1717
<div class="popup-inner">
1818
<header class="popup-header">

app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
?>
1010
<?php /** @var $this \Magento\AdminNotification\Block\ToolbarEntry */ ?>
1111
<?php $notificationCount = $this->getUnreadNotificationCount(); ?>
12-
<div class="notifications-summary" data-notification-count="<?php echo $this->escapeHtml($notificationCount); ?>">
12+
<div data-mage-init='{"toolbarEntry": {}}' class="notifications-summary" data-notification-count="<?php echo $this->escapeHtml($notificationCount); ?>">
1313
<?php if ($notificationCount > 0) : ?>
1414
<a href="<?php echo $this->getUrl('adminhtml/notification/index'); ?>" class="action notifications-action" data-mage-init='{"dropdown":{}}' title="<?php echo __('Notifications'); ?>" data-toggle="dropdown">
1515
<span class="text"><?php echo __('Notifications'); ?></span>

app/code/Magento/AdminNotification/view/adminhtml/web/toolbar_entry.js

Lines changed: 90 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -4,106 +4,105 @@
44
*/
55
define([
66
"jquery",
7-
"jquery/ui"
7+
"jquery/ui",
8+
"domReady!"
89
], function($){
910
'use strict';
1011

11-
$(document).ready(function() {
12-
// Mark notification as read via AJAX call
13-
var markNotificationAsRead = function(notificationId) {
14-
var requestUrl = $('.notifications-summary .dropdown-menu').attr('data-mark-as-read-url');
15-
$.ajax({
16-
url: requestUrl,
17-
type: 'POST',
18-
dataType: 'json',
19-
data: {
20-
id: notificationId
21-
},
22-
showLoader: false
23-
});
24-
};
25-
var notificationCount = $('.notifications-summary').attr('data-notification-count');
26-
// Remove notification from the list
27-
var removeNotificationFromList = function(notificationEntry) {
28-
notificationEntry.remove();
29-
notificationCount--;
30-
$('.notifications-summary').attr('data-notification-count', notificationCount);
31-
32-
if (notificationCount == 0) {
33-
// Change appearance of the bubble and its behavior when the last notification is removed
34-
$('.notifications-summary .dropdown-menu').remove();
35-
var notificationIcon = $('.notifications-summary .notifications-icon');
36-
notificationIcon.removeAttr('data-toggle');
37-
notificationIcon.off('click.dropdown');
38-
$('.notifications-action .counter').text('');
39-
$('.notifications-action .counter').hide();
40-
} else {
41-
$('.notifications-action .counter').text(notificationCount);
42-
// Modify caption of the 'See All' link
43-
var actionElement = $('.notifications-summary .dropdown-menu .last .action-more');
44-
actionElement.text(actionElement.text().replace(/\d+/, notificationCount));
45-
}
46-
};
47-
48-
// Show popup with notification details
49-
var showNotificationDetails = function(notificationEntry) {
50-
var popupElement = notificationEntry.find('.notifications-dialog-content').clone();
51-
var notificationId = notificationEntry.attr('data-notification-id');
52-
var dialogClassSeverity = 'notifications-entry-dialog';
53-
if (notificationEntry.attr('data-notification-severity')) {
54-
dialogClassSeverity = 'notifications-entry-dialog notifications-entry-dialog-critical';
55-
}
56-
popupElement.dialog({
57-
title: popupElement.attr('data-title'),
58-
minWidth: 500,
59-
modal: true,
60-
dialogClass: dialogClassSeverity,
61-
buttons: [
62-
{
63-
text: popupElement.attr('data-acknowledge-caption'),
64-
'class': 'action-acknowledge primary',
65-
click: function(event) {
66-
markNotificationAsRead(notificationId);
67-
removeNotificationFromList(notificationEntry);
68-
$(this).dialog('close');
69-
}
70-
},
71-
{
72-
text: popupElement.attr('data-cancel-caption'),
73-
'class': 'action-cancel',
74-
click: function(event) {
75-
$(this).dialog('close');
76-
}
77-
}
78-
]
79-
});
80-
popupElement.parent().attr('aria-live','assertive');
81-
popupElement.dialog('open');
82-
};
83-
84-
// Show notification description when corresponding item is clicked
85-
$('.notifications-summary .dropdown-menu .notifications-entry').on('click.showNotification', function(event) {
86-
// hide notification dropdown
87-
$('.notifications-summary .notifications-icon').trigger('click.dropdown');
88-
showNotificationDetails($(this));
89-
event.stopPropagation();
90-
});
91-
92-
// Remove corresponding notification from the list and mark it as read
93-
$('.notifications-close').on('click.removeNotification', function(event) {
94-
var notificationEntry = $(this).closest('.notifications-entry')
95-
var notificationId = notificationEntry.attr('data-notification-id');
96-
markNotificationAsRead(notificationId);
97-
removeNotificationFromList(notificationEntry);
98-
event.stopPropagation();
12+
// Mark notification as read via AJAX call
13+
var markNotificationAsRead = function(notificationId) {
14+
var requestUrl = $('.notifications-summary .dropdown-menu').attr('data-mark-as-read-url');
15+
$.ajax({
16+
url: requestUrl,
17+
type: 'POST',
18+
dataType: 'json',
19+
data: {
20+
id: notificationId
21+
},
22+
showLoader: false
9923
});
24+
};
25+
var notificationCount = $('.notifications-summary').attr('data-notification-count');
26+
// Remove notification from the list
27+
var removeNotificationFromList = function(notificationEntry) {
28+
notificationEntry.remove();
29+
notificationCount--;
30+
$('.notifications-summary').attr('data-notification-count', notificationCount);
10031

101-
// Hide notifications bubble
10232
if (notificationCount == 0) {
33+
// Change appearance of the bubble and its behavior when the last notification is removed
34+
$('.notifications-summary .dropdown-menu').remove();
35+
var notificationIcon = $('.notifications-summary .notifications-icon');
36+
notificationIcon.removeAttr('data-toggle');
37+
notificationIcon.off('click.dropdown');
38+
$('.notifications-action .counter').text('');
10339
$('.notifications-action .counter').hide();
10440
} else {
105-
$('.notifications-action .counter').show();
41+
$('.notifications-action .counter').text(notificationCount);
42+
// Modify caption of the 'See All' link
43+
var actionElement = $('.notifications-summary .dropdown-menu .last .action-more');
44+
actionElement.text(actionElement.text().replace(/\d+/, notificationCount));
45+
}
46+
};
47+
48+
// Show popup with notification details
49+
var showNotificationDetails = function(notificationEntry) {
50+
var popupElement = notificationEntry.find('.notifications-dialog-content').clone();
51+
var notificationId = notificationEntry.attr('data-notification-id');
52+
var dialogClassSeverity = 'notifications-entry-dialog';
53+
if (notificationEntry.attr('data-notification-severity')) {
54+
dialogClassSeverity = 'notifications-entry-dialog notifications-entry-dialog-critical';
10655
}
56+
popupElement.dialog({
57+
title: popupElement.attr('data-title'),
58+
minWidth: 500,
59+
modal: true,
60+
dialogClass: dialogClassSeverity,
61+
buttons: [
62+
{
63+
text: popupElement.attr('data-acknowledge-caption'),
64+
'class': 'action-acknowledge primary',
65+
click: function(event) {
66+
markNotificationAsRead(notificationId);
67+
removeNotificationFromList(notificationEntry);
68+
$(this).dialog('close');
69+
}
70+
},
71+
{
72+
text: popupElement.attr('data-cancel-caption'),
73+
'class': 'action-cancel',
74+
click: function(event) {
75+
$(this).dialog('close');
76+
}
77+
}
78+
]
79+
});
80+
popupElement.parent().attr('aria-live','assertive');
81+
popupElement.dialog('open');
82+
};
83+
84+
// Show notification description when corresponding item is clicked
85+
$('.notifications-summary .dropdown-menu .notifications-entry').on('click.showNotification', function(event) {
86+
// hide notification dropdown
87+
$('.notifications-summary .notifications-icon').trigger('click.dropdown');
88+
showNotificationDetails($(this));
89+
event.stopPropagation();
90+
});
91+
92+
// Remove corresponding notification from the list and mark it as read
93+
$('.notifications-close').on('click.removeNotification', function(event) {
94+
var notificationEntry = $(this).closest('.notifications-entry')
95+
var notificationId = notificationEntry.attr('data-notification-id');
96+
markNotificationAsRead(notificationId);
97+
removeNotificationFromList(notificationEntry);
98+
event.stopPropagation();
10799
});
108100

101+
// Hide notifications bubble
102+
if (notificationCount == 0) {
103+
$('.notifications-action .counter').hide();
104+
} else {
105+
$('.notifications-action .counter').show();
106+
}
107+
109108
});

app/code/Magento/Backend/Block/System/Config/Form/Fieldset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ protected function _getFooterHtml($element)
214214
protected function _getExtraJs($element)
215215
{
216216
$htmlId = $element->getHtmlId();
217-
$output = "Fieldset.applyCollapse('{$htmlId}');";
217+
$output = "require(['prototype'], function(){Fieldset.applyCollapse('{$htmlId}');});";
218218
return $this->_jsHelper->getScript($output);
219219
}
220220

app/code/Magento/Backend/Block/Widget/Button/SplitButton.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function getToggleAttributesHtml()
123123
}
124124

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

128128
$html = $this->_getAttributesString($attributes);
129129
$html .= $this->getUiId('dropdown');

app/code/Magento/Backend/view/adminhtml/layout/default.xml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,10 @@
88
<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">
99
<head>
1010
<title>Magento Admin</title>
11-
<link src="prototype/prototype.js"/>
12-
<link src="prototype/window.js"/>
13-
<link src="scriptaculous/builder.js"/>
14-
<link src="scriptaculous/effects.js"/>
15-
<link src="lib/ccard.js"/>
16-
<link src="prototype/validation.js"/>
17-
<link src="varien/js.js"/>
18-
<link src="mage/adminhtml/varienLoader.js"/>
19-
<link src="mage/adminhtml/tools.js"/>
20-
<link src="lib/ds-sleight.js" ie_condition="lt IE 7" defer="defer"/>
21-
<css src="mage/calendar.css"/>
11+
<link src="legacy-build.min.js"/>
2212
<link src="requirejs/require.js"/>
23-
<link src="mage/requirejs/resolver.js"/>
24-
<link src="jquery/jquery.js"/>
25-
<link src="mage/jquery-no-conflict.js"/>
26-
<link src="app-config.js"/>
27-
<link src="extjs/ext-tree.js"/>
28-
<link src="extjs/ext-tree-checkbox.js"/>
13+
<link src="jquery.js"/>
14+
<css src="mage/calendar.css"/>
2915
<css src="extjs/resources/css/ext-all.css"/>
3016
<css src="extjs/resources/css/ytheme-magento.css"/>
3117
</head>
@@ -87,7 +73,6 @@
8773
<referenceContainer name="after.body.start">
8874
<block class="Magento\RequireJs\Block\Html\Head\Config" name="requirejs-config"/>
8975
<block class="Magento\Translation\Block\Js" name="translate" template="Magento_Translation::translate.phtml"/>
90-
<block class="Magento\Framework\View\Element\Template" name="head.scripts" template="Magento_Backend::page/js/head_scripts.phtml"/>
9176
<block class="Magento\Framework\View\Element\Js\Components" name="head.components" as="components" template="Magento_Backend::page/js/components.phtml"/>
9277
<block class="Magento\Framework\View\Element\Html\Calendar" name="head.calendar" as="calendar" template="Magento_Backend::page/js/calendar.phtml"/>
9378
</referenceContainer>

0 commit comments

Comments
 (0)