Skip to content
Snippets Groups Projects
Commit c88ba315 authored by Denys Rul's avatar Denys Rul
Browse files

MAGETWO-32484: Stabilization of changes and bug fixing

- Rebuild legacy-build.min file using yui compressor
parent 46d72da0
Branches
No related merge requests found
...@@ -11,6 +11,8 @@ module.exports = function (grunt) { ...@@ -11,6 +11,8 @@ module.exports = function (grunt) {
// Require // Require
// -------------------------------------- // --------------------------------------
require('./dev/tools/grunt/tasks/mage-minify')(grunt);
// Time how long tasks take. Can help when optimizing build times // Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt); require('time-grunt')(grunt);
...@@ -136,13 +138,15 @@ module.exports = function (grunt) { ...@@ -136,13 +138,15 @@ module.exports = function (grunt) {
} }
}, },
uglify: { 'mage-minify': {
legacy: { legacy: {
options: { options: {
mangle: false type: 'yui-js',
tempPath: 'var/cache/'
}, },
files: { files: {
'<%= config.path.uglify.legacy %>': [ '<%= config.path.uglify.legacy %>': [
'lib/web/prototype/prototype.js',
'lib/web/prototype/window.js', 'lib/web/prototype/window.js',
'lib/web/scriptaculous/builder.js', 'lib/web/scriptaculous/builder.js',
'lib/web/scriptaculous/effects.js', 'lib/web/scriptaculous/effects.js',
...@@ -162,7 +166,7 @@ module.exports = function (grunt) { ...@@ -162,7 +166,7 @@ module.exports = function (grunt) {
* Mostly prototype dependant libraries. * Mostly prototype dependant libraries.
*/ */
grunt.registerTask('legacy-build', [ grunt.registerTask('legacy-build', [
'uglify:legacy' 'mage-minify:legacy'
]); ]);
// Default task // Default task
......
...@@ -8,10 +8,8 @@ ...@@ -8,10 +8,8 @@
<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"> <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> <head>
<title>Magento Admin</title> <title>Magento Admin</title>
<link src="prototype/prototype.js"/>
<link src="legacy-build.min.js"/> <link src="legacy-build.min.js"/>
<link src="requirejs/require.js"/> <link src="requirejs/require.js"/>
<link src="mage/requirejs/resolver.js"/>
<link src="jquery.js"/> <link src="jquery.js"/>
<css src="mage/calendar.css"/> <css src="mage/calendar.css"/>
<css src="extjs/resources/css/ext-all.css"/> <css src="extjs/resources/css/ext-all.css"/>
......
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
/* @var $this \Magento\ConfigurableProduct\Block\Product\Configurable\AttributeSelector */ /* @var $this \Magento\ConfigurableProduct\Block\Product\Configurable\AttributeSelector */
?> ?>
<script> <script>
(function($){ (function(){
'use strict';
var $form; var $form;
require([ require([
...@@ -14,8 +16,6 @@ ...@@ -14,8 +16,6 @@
"jquery/ui", "jquery/ui",
"Magento_ConfigurableProduct/catalog/product-variation" "Magento_ConfigurableProduct/catalog/product-variation"
], function($){ ], function($){
'use strict';
$form = $('#affected-attribute-set-form'); $form = $('#affected-attribute-set-form');
var resetValidation = function() { var resetValidation = function() {
...@@ -98,37 +98,43 @@ ...@@ -98,37 +98,43 @@
} }
}); });
}); });
require([
'jquery'
], function ($) {
/** /**
* This fix was made in order to properly handle 'stopImmediatePropagation'. * This fix was made in order to properly handle 'stopImmediatePropagation'.
*/ */
$('#save-split-button .item').on('click', function(event) { $('#save-split-button .item').on('click', function(event) {
if ($('#new-variations-attribute-set-id').val() != '') { if ($('#new-variations-attribute-set-id').val() != '') {
return; // affected attribute set was already chosen return; // affected attribute set was already chosen
} }
var extendingAttributes = []; var extendingAttributes = [];
$.each($('#configurable-attributes-container').variationsAttributes('getAttributes'), function () { $.each($('#configurable-attributes-container').variationsAttributes('getAttributes'), function () {
if (!$('#attribute-' + this.code + '-container').length) { if (!$('#attribute-' + this.code + '-container').length) {
extendingAttributes.push(this.id); extendingAttributes.push(this.id);
}
});
if (!extendingAttributes.length) {
$('#new-variations-attribute-set-id').val($('#attribute_set_id').val());
return; // all selected configurable attributes belong to current attribute set
}
if (!$('[data-role=product-variations-matrix] [data-column=entity_id]:checked')
.closest('tr').has('input[name$="[name]"]').length
) {
return; // no new simple products to save from matrix: uniting attribute set is not needed
} }
});
if (!extendingAttributes.length) {
$('#new-variations-attribute-set-id').val($('#attribute_set_id').val());
return; // all selected configurable attributes belong to current attribute set
}
if (!$('[data-role=product-variations-matrix] [data-column=entity_id]:checked')
.closest('tr').has('input[name$="[name]"]').length
) {
return; // no new simple products to save from matrix: uniting attribute set is not needed
}
event.stopImmediatePropagation(); event.stopImmediatePropagation();
$form.data('target', event.target)
.dialog('open');
});
$form.data('target', event.target)
.dialog('open');
}); });
})(jQuery); })();
</script> </script>
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
module.exports = function (grunt) {
'use strict';
var compressor = require('node-minify'),
_ = require('underscore');
/**
* Helper function used to create config object for compressor.
*
* @param {Object} options - Options object for a current task.
* @param {Object} file - File object with 'sorce' and 'destination' properties.
* @return {Object} Config object for compressor.
*/
function getConfig(options, file) {
return _.extend({
fileIn: file.src,
fileOut: file.dest
}, options);
}
grunt.registerMultiTask('mage-minify', 'Minify files with a various compressor engines', function () {
var done = this.async(),
files = this.files,
total = files.length,
options = this.options();
this.files.forEach(function (file, i) {
var config = getConfig(options, file);
/**
* Callback function.
*/
config.callback = function (err) {
if (err) {
done(false);
} else if (i === total - 1) {
done();
}
};
new compressor.minify(config);
});
});
};
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4,17 +4,20 @@ ...@@ -4,17 +4,20 @@
*/ */
/*global require:true*/ /*global require:true*/
(function (factory) { (function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define([ define([
"jquery", 'jquery',
"jquery/ui" 'jquery/ui',
'mage/requirejs/resolver'
], factory); ], factory);
} else { } else {
factory(jQuery); factory(jQuery);
} }
}(function ($) { }(function ($) {
'use strict'; 'use strict';
var resolver = require && require.resolver; var resolver = require && require.resolver;
$.widget('ui.button', $.ui.button, { $.widget('ui.button', $.ui.button, {
...@@ -27,7 +30,7 @@ ...@@ -27,7 +30,7 @@
* Button creation. * Button creation.
* @protected * @protected
*/ */
_create: function() { _create: function () {
if (this.options.event) { if (this.options.event) {
this.options.target = this.options.target || this.element; this.options.target = this.options.target || this.element;
this._bind(); this._bind();
...@@ -39,20 +42,20 @@ ...@@ -39,20 +42,20 @@
* Bind handler on button click. * Bind handler on button click.
* @protected * @protected
*/ */
_bind: function() { _bind: function () {
var waitTillResolved = this.options.waitTillResolved, var waitTillResolved = this.options.waitTillResolved,
handler = !waitTillResolved || !resolver ? this._click : this._proxyClick; handler = !waitTillResolved || !resolver ? this._click : this._proxyClick;
this.element this.element
.off( 'click.button' ) .off('click.button')
.on( 'click.button', $.proxy(handler, this) ); .on('click.button', $.proxy(handler, this));
}, },
/** /**
* Button click handler. * Button click handler.
* @protected * @protected
*/ */
_click: function(){ _click: function () {
var options = this.options; var options = this.options;
$(options.target).trigger(options.event, [options.eventData]); $(options.target).trigger(options.event, [options.eventData]);
...@@ -60,19 +63,16 @@ ...@@ -60,19 +63,16 @@
/** /**
* Proxy button click handler that might postpone the event * Proxy button click handler that might postpone the event
* untill all of the rjs dependencies will be resolved. * untill all of the rjs dependencies will be resolved.
* @protected * @protected
*/ */
_proxyClick: function(){ _proxyClick: function () {
var options = this.options; if (resolver.resolved) {
if( resolver.resolved ){
this._click(); this._click();
} } else if (!resolver.hasListeners('spinnerCover')) {
else if( !resolver.hasListeners('spinnerCover') ){
$('body').trigger('processStart'); $('body').trigger('processStart');
resolver.on('spinnerCover', $.proxy(this._onResolve, this) ); resolver.on('spinnerCover', $.proxy(this._onResolve, this));
} }
}, },
...@@ -80,12 +80,12 @@ ...@@ -80,12 +80,12 @@
* Callback of the rjs resolver 'onAllResolved' event. * Callback of the rjs resolver 'onAllResolved' event.
* @protected * @protected
*/ */
_onResolve: function(){ _onResolve: function () {
$('body').trigger('processStop'); $('body').trigger('processStop');
this._click(); this._click();
} }
}); });
return $.ui.button; return $.ui.button;
})); }));
...@@ -6,10 +6,11 @@ ...@@ -6,10 +6,11 @@
"grunt-contrib-clean": "^0.6.0", "grunt-contrib-clean": "^0.6.0",
"grunt-contrib-less": "^0.12.0", "grunt-contrib-less": "^0.12.0",
"grunt-contrib-watch": "^0.6.1", "grunt-contrib-watch": "^0.6.1",
"grunt-contrib-uglify": "^0.7.0",
"grunt-styledocco": "^0.1.4", "grunt-styledocco": "^0.1.4",
"load-grunt-tasks": "^1.0.0", "load-grunt-tasks": "^1.0.0",
"time-grunt": "^1.0.0" "time-grunt": "^1.0.0",
"underscore": "^1.7.0",
"node-minify": "^1.0.1"
}, },
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment