Skip to content

Commit c23ccc2

Browse files
author
Roman Ganin
committed
Merge branch 'develop' of https://github.corp.ebay.com/magento2/magento2ce into troll_s30
2 parents b3b105b + baadf05 commit c23ccc2

File tree

144 files changed

+4248
-6474
lines changed

Some content is hidden

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

144 files changed

+4248
-6474
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<strong class="notifications-entry-title"><?php echo $block->escapeHtml($notification->getTitle()); ?></strong>
2525
<span class="notifications-entry-description"><?php echo $block->escapeHtml($notification->getDescription()); ?></span>
2626
<time class="notifications-entry-time"><?php echo $block->escapeHtml($block->formatNotificationDate($notification->getDateAdded())); ?></time>
27-
<button class="action close notifications-close"><span><?php echo __('Close'); ?></span></button>
27+
<button type="button" class="action close notifications-close"><span><?php echo __('Close'); ?></span></button>
2828
<div class="notifications-dialog-content" data-title="<?php echo __('Notification'); ?>" data-cancel-caption="<?php echo __('Cancel'); ?>" data-acknowledge-caption="<?php echo __('Acknowledge'); ?>">
2929
<strong class="notifications-entry-title"><?php echo $block->escapeHtml($notification->getTitle()); ?></strong>
3030
<span class="notifications-entry-description"><?php echo $block->escapeHtml($notification->getDescription()); ?></span>

app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,60 @@
22
* Copyright © 2015 Magento. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5-
/*jshint jquery:true*/
65
define([
7-
"jquery",
8-
"jquery/ui",
9-
"jquery/template"
10-
], function($){
11-
12-
$.template(
13-
'systemMessageDialog',
14-
'<li class="{{if severity == 1}}error{{else}}warning{{/if}}">{{html text}}</li>'
15-
);
6+
'jquery',
7+
'mage/template',
8+
'jquery/ui'
9+
], function ($, mageTemplate) {
10+
'use strict';
1611

1712
$.widget('mage.systemMessageDialog', $.ui.dialog, {
1813
options: {
19-
systemMessageTemplate: 'systemMessageDialog'
14+
systemMessageTemplate:
15+
'<% _.each(data.items, function(item) { %>' +
16+
'<li class="<% if (item.severity == 1) { %>error<% } else { %>warning<% } %>">' +
17+
'<%= item.text %>' +
18+
'</li>' +
19+
'<% }); %>'
2020
},
21-
open: function(severity) {
21+
22+
open: function (severity) {
2223
var superMethod = $.proxy(this._super, this);
24+
2325
$.ajax({
2426
url: this.options.ajaxUrl,
2527
type: 'GET',
26-
data: {severity: severity}
27-
}).done($.proxy(function(data) {
28+
data: {
29+
severity: severity
30+
}
31+
}).done($.proxy(function (data) {
32+
var tmpl = mageTemplate(this.options.systemMessageTemplate, {
33+
data: {
34+
items: data
35+
}
36+
});
37+
38+
tmpl = $(tmpl);
39+
2840
this.element.html(
29-
$('<ul />', {'class': "message-system-list"}).append(
30-
$.tmpl(this.options.systemMessageTemplate, data)
31-
)
41+
$('<ul />', {
42+
'class': 'message-system-list'
43+
}).append(tmpl)
3244
).trigger('contentUpdated');
45+
3346
superMethod();
3447
}, this));
48+
3549
return this;
3650
}
3751
});
3852

39-
$(document).ready(function(){
40-
$('#system_messages .message-system-short .error').on('click', function() {
53+
$(document).ready(function () {
54+
$('#system_messages .message-system-short .error').on('click', function () {
4155
$('#message-system-all').systemMessageDialog('open', 1);
4256
});
43-
$('#system_messages .message-system-short .warning').on('click', function() {
57+
58+
$('#system_messages .message-system-short .warning').on('click', function () {
4459
$('#message-system-all').systemMessageDialog('open', 2);
4560
});
4661
});

app/code/Magento/Backend/Block/System/Config/Form/Field/Select/Allowspecific.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class Allowspecific extends \Magento\Framework\Data\Form\Element\Select
2222
*/
2323
public function getAfterElementHtml()
2424
{
25-
$javaScript = "\n <script type=\"text/javascript\">\n Event.observe('{$this->getHtmlId()}', 'change', function(){\n specific=\$('{$this
25+
$javaScript = "\n <script type=\"text/javascript\">require(['prototype'], function(){\n Event.observe('{$this->getHtmlId()}', 'change', function(){\n specific=\$('{$this
2626
->getHtmlId()}').value;\n \$('{$this
27-
->_getSpecificCountryElementId()}').disabled = (!specific || specific!=1);\n });\n </script>";
27+
->_getSpecificCountryElementId()}').disabled = (!specific || specific!=1);\n });\n });</script>";
2828
return $javaScript . parent::getAfterElementHtml();
2929
}
3030

app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml

Lines changed: 69 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -14,88 +14,93 @@
1414
data-url="<?php echo $block->getConfig()->getUrl() ?>" multiple="multiple" />
1515
</div>
1616
<div class="clear"></div>
17-
<div class="no-display" id="<?php echo $block->getHtmlId() ?>-template">
18-
<div id="{{id}}" class="file-row">
19-
<span class="file-info">{{name}} ({{size}})</span>
17+
<script id="<?php echo $block->getHtmlId() ?>-template" type="text/x-magento-template">
18+
<div id="<%= data.id %>" class="file-row">
19+
<span class="file-info"><%= data.name %> (<%= data.size %>)</span>
2020
<div class="progressbar-container">
2121
<div class="progressbar upload-progress" style="width: 0%;"></div>
2222
</div>
2323
<div class="clear"></div>
2424
</div>
25-
</div>
25+
</script>
2626
</div>
2727

2828
<script>
2929
require([
3030
"jquery",
31+
'mage/template',
3132
"mage/translate",
3233
"jquery/file-uploader"
33-
], function($){
34+
], function ($, mageTemplate) {
3435

35-
$(function () {
36-
$('#fileupload').fileupload({
37-
dataType: 'json',
38-
dropZone: '[data-tab-panel=image-management]',
39-
sequentialUploads: true,
40-
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
41-
maxFileSize: <?php echo $block->getFileSizeService()->getMaxFileSize() ?>,
42-
add: function(e, data) {
43-
$.each(data.files, function (index, file) {
44-
data.fileId = Math.random().toString(33).substr(2, 18);
45-
var progressTmpl = $('#<?php echo $block->getHtmlId(); ?>-template').children(':first').clone();
46-
progressTmpl.attr('id', data.fileId);
47-
var fileInfoHtml = progressTmpl.html().replace('{{size}}', byteConvert(file.size))
48-
.replace('{{name}}', file.name);
49-
progressTmpl.html(fileInfoHtml) ;
36+
$('#fileupload').fileupload({
37+
dataType: 'json',
38+
dropZone: '[data-tab-panel=image-management]',
39+
sequentialUploads: true,
40+
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
41+
maxFileSize: <?php echo $block->getFileSizeService()->getMaxFileSize() ?> ,
42+
add: function (e, data) {
43+
var progressTmpl = mageTemplate('#<?php echo $block->getHtmlId(); ?>-template'),
44+
fileSize,
45+
tmpl;
5046

51-
progressTmpl.appendTo('#<?php echo $block->getHtmlId() ?>');
47+
$.each(data.files, function (index, file) {
48+
fileSize = typeof file.size == "undefined" ?
49+
$.mage.__('We could not detect a size.') :
50+
byteConvert(file.size);
5251

52+
data.fileId = Math.random().toString(33).substr(2, 18);
53+
54+
tmpl = progressTmpl({
55+
data: {
56+
name: file.name,
57+
size: fileSize,
58+
id: data.fileId
59+
}
5360
});
54-
$(this).fileupload('process', data).done(function () {
55-
data.submit();
56-
});
57-
},
58-
done: function(e, data) {
59-
if (data.result && !data.result.error) {
60-
$('#<?php echo $block->getParentBlock()->getHtmlId() ?>').trigger('addItem', data.result);
61-
} else {
62-
$('#' + data.fileId)
63-
.delay(2000)
64-
.hide('highlight');
65-
alert($.mage.__('File extension not known or unsupported type.'));
66-
}
67-
$('#' + data.fileId).remove();
68-
},
69-
progress: function(e, data) {
70-
var progress = parseInt(data.loaded / data.total * 100, 10);
71-
var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
72-
$(progressSelector).css('width', progress + '%');
73-
},
74-
fail: function(e, data) {
75-
var progressSelector = '#' + data.fileId;
76-
$(progressSelector).removeClass('upload-progress').addClass('upload-failure')
61+
62+
$(tmpl).appendTo('#<?php echo $block->getHtmlId() ?>');
63+
});
64+
65+
$(this).fileupload('process', data).done(function () {
66+
data.submit();
67+
});
68+
},
69+
done: function (e, data) {
70+
if (data.result && !data.result.error) {
71+
$('#<?php echo $block->getParentBlock()->getHtmlId() ?>').trigger('addItem', data.result);
72+
} else {
73+
$('#' + data.fileId)
7774
.delay(2000)
78-
.hide('highlight')
79-
.remove();
75+
.hide('highlight');
76+
alert($.mage.__('File extension not known or unsupported type.'));
8077
}
81-
});
82-
$('#fileupload').fileupload('option', {
83-
process: [
84-
{
85-
action: 'load',
86-
fileTypes: /^image\/(gif|jpeg|png)$/
87-
},
88-
{
89-
action: 'resize',
90-
maxWidth: <?php echo \Magento\Framework\File\Uploader::MAX_IMAGE_WIDTH ?>,
91-
maxHeight: <?php echo \Magento\Framework\File\Uploader::MAX_IMAGE_HEIGHT ?>
92-
},
93-
{
94-
action: 'save'
95-
}
96-
]
97-
});
78+
$('#' + data.fileId).remove();
79+
},
80+
progress: function (e, data) {
81+
var progress = parseInt(data.loaded / data.total * 100, 10);
82+
var progressSelector = '#' + data.fileId + ' .progressbar-container .progressbar';
83+
$(progressSelector).css('width', progress + '%');
84+
},
85+
fail: function (e, data) {
86+
var progressSelector = '#' + data.fileId;
87+
$(progressSelector).removeClass('upload-progress').addClass('upload-failure')
88+
.delay(2000)
89+
.hide('highlight')
90+
.remove();
91+
}
92+
});
93+
$('#fileupload').fileupload('option', {
94+
process: [{
95+
action: 'load',
96+
fileTypes: /^image\/(gif|jpeg|png)$/
97+
}, {
98+
action: 'resize',
99+
maxWidth: <?php echo \Magento\Framework\File\Uploader::MAX_IMAGE_WIDTH ?> ,
100+
maxHeight: <?php echo \Magento\Framework\File\Uploader::MAX_IMAGE_HEIGHT ?>
101+
}, {
102+
action: 'save'
103+
}]
98104
});
99-
100105
});
101106
</script>

app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
data-role="website-id" data-param="<?php echo $block->getWebsiteVarName() ?>"
2626
value="<?php echo $block->escapeHtml($block->getWebsiteId()) ?>"
2727
onchange="switchScope(this);"<?php echo $block->getUiId()?> />
28-
<button class="action toggle" data-mage-init='{"dropdown":{}}' data-toggle="dropdown" aria-haspopup="true">
28+
<button type="button" class="action toggle" data-mage-init='{"dropdown":{}}' data-toggle="dropdown" aria-haspopup="true">
2929
<span><?php echo $block->getCurrentSelectionName() ?></span>
3030
</button>
3131
<ul class="dropdown-menu" data-role="stores-list">

app/code/Magento/Backend/view/adminhtml/templates/system/config/form/field/array.phtml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,27 @@ $_colspan = $block->isAddAfter() ? 2 : 1;
3737
<input type="hidden" name="<?php echo $block->getElement()->getName(); ?>[__empty]" value="" />
3838

3939
<script>
40-
require(['prototype'], function(){
40+
require([
41+
'mage/template',
42+
'prototype'
43+
], function (mageTemplate) {
4144
// create row creator
4245
var arrayRow<?php echo $_htmlId ?> = {
4346

4447
// define row prototypeJS template
45-
template: new Template(
46-
'<tr id="#{_id}">'
48+
template: mageTemplate(
49+
'<tr id="<%= _id %>">'
4750
<?php foreach ($block->getColumns() as $columnName => $column): ?>
4851
+ '<td>'
4952
+ '<?php echo $block->renderCellTemplate($columnName)?>'
5053
+ '<\/td>'
5154
<?php endforeach; ?>
5255

5356
<?php if ($block->isAddAfter()): ?>
54-
+ '<td><button class="action- add" type="button" id="addAfterBtn#{_id}"><span><?php echo __('Add after'); ?><\/span><\/button><\/td>'
57+
+ '<td><button class="action- add" type="button" id="addAfterBtn<%= _id %>"><span><?php echo __('Add after'); ?><\/span><\/button><\/td>'
5558
<?php endif; ?>
5659

57-
+ '<td class="col-actions"><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="action- delete" type="button"><span><?php echo __('Delete'); ?><\/span><\/button><\/td>'
60+
+ '<td class="col-actions"><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'<%= _id %>\')" class="action- delete" type="button"><span><?php echo __('Delete'); ?><\/span><\/button><\/td>'
5861
+'<\/tr>'
5962
),
6063

@@ -77,9 +80,9 @@ $_colspan = $block->isAddAfter() ? 2 : 1;
7780

7881
// Insert new row after specified row or at the bottom
7982
if (insertAfterId) {
80-
Element.insert($(insertAfterId), {after: this.template.evaluate(templateValues)});
83+
Element.insert($(insertAfterId), {after: this.template(templateValues)});
8184
} else {
82-
Element.insert($('addRow<?php echo $_htmlId ?>'), {bottom: this.template.evaluate(templateValues)});
85+
Element.insert($('addRow<?php echo $_htmlId ?>'), {bottom: this.template(templateValues)});
8386
}
8487

8588
// Fill controls with data

app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@
2525
<button type="submit" class="action search-global-action" title="<?php echo __('Search') ?>"><span><?php echo __('Search') ?></span></button>
2626
</div>
2727
</form>
28-
<script data-template="search-suggest" type="text/x-jquery-tmpl">
28+
<script data-template="search-suggest" type="text/x-magento-template">
2929
<ul class="dropdown-menu search-global-menu">
30-
{{if items.length}}
31-
{{each items}}
30+
<% if (data.items.length) { %>
31+
<% _.each(data.items, function(value){ %>
3232
<li class="item"
33-
{{html optionData($value)}}
33+
<%= data.optionData(value) %>
3434
>
35-
<a href="${$value.url}" class="title">${$value.name}</a>
36-
<div class="type">${$value.type}</div>
37-
${$value.description || ""}
35+
<a href="<%= value.url %>" class="title"><%= value.name %></a>
36+
<div class="type"><%= value.type %></div>
37+
<%= value.description || "" %>
3838
</li>
39-
{{/each}}
40-
{{else}}
39+
<% }); %>
40+
<% } else { %>
4141
<li><span class="mage-suggest-no-records"><?php echo __('No records found.') ?></span></li>
42-
{{/if}}
42+
<% } %>
4343
</ul>
4444
</script>
4545
</div>

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ protected function _prepareLayout()
152152
'add_selection_button',
153153
'Magento\Backend\Block\Widget\Button',
154154
[
155-
'id' => $this->getFieldId() . '_{{index}}_add_button',
155+
'id' => $this->getFieldId() . '_<%= data.index %>_add_button',
156156
'label' => __('Add Products to Option'),
157157
'class' => 'add add-selection'
158158
]
@@ -162,7 +162,7 @@ protected function _prepareLayout()
162162
'close_search_button',
163163
'Magento\Backend\Block\Widget\Button',
164164
[
165-
'id' => $this->getFieldId() . '_{{index}}_close_button',
165+
'id' => $this->getFieldId() . '_<%= data.index %>_close_button',
166166
'label' => __('Close'),
167167
'on_click' => 'bSelection.closeSearch(event)',
168168
'class' => 'back no-display'
@@ -272,12 +272,12 @@ public function getTypeSelectHtml()
272272
'Magento\Framework\View\Element\Html\Select'
273273
)->setData(
274274
[
275-
'id' => $this->getFieldId() . '_{{index}}_type',
275+
'id' => $this->getFieldId() . '_<%= data.index %>_type',
276276
'class' => 'select select-product-option-type required-option-select',
277277
'extra_params' => 'onchange="bOption.changeType(event)"',
278278
]
279279
)->setName(
280-
$this->getFieldName() . '[{{index}}][type]'
280+
$this->getFieldName() . '[<%= data.index %>][type]'
281281
)->setOptions(
282282
$this->_optionTypes->toOptionArray()
283283
);
@@ -293,9 +293,9 @@ public function getRequireSelectHtml()
293293
$select = $this->getLayout()->createBlock(
294294
'Magento\Framework\View\Element\Html\Select'
295295
)->setData(
296-
['id' => $this->getFieldId() . '_{{index}}_required', 'class' => 'select']
296+
['id' => $this->getFieldId() . '_<%= data.index %>_required', 'class' => 'select']
297297
)->setName(
298-
$this->getFieldName() . '[{{index}}][required]'
298+
$this->getFieldName() . '[<%= data.index %>][required]'
299299
)->setOptions(
300300
$this->_yesno->toOptionArray()
301301
);

0 commit comments

Comments
 (0)