Skip to content

Commit cef7f01

Browse files
committed
Merge branch 'MAGETWO-34949' into PR
2 parents a293b4e + 7db0d0f commit cef7f01

File tree

17 files changed

+734
-113
lines changed

17 files changed

+734
-113
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
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+
<meta name="viewport" content="width=device-width"/>
1112
<link src="requirejs/require.js"/>
1213
<css src="extjs/resources/css/ext-all.css"/>
1314
<css src="extjs/resources/css/ytheme-magento.css"/>

app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function getAfterElementHtml()
132132
'id' => 'add_category_button',
133133
'label' => $newCategoryCaption,
134134
'title' => $newCategoryCaption,
135-
'onclick' => 'jQuery("#new-category").dialog("open")',
135+
'onclick' => 'jQuery("#new-category").trigger("openModal")',
136136
'disabled' => $this->getDisabled(),
137137
]
138138
);

app/code/Magento/Catalog/view/adminhtml/web/js/new-category-dialog.js

Lines changed: 31 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
define([
88
'jquery',
99
'jquery/ui',
10+
'Magento_Ui/js/modal/modal',
1011
'mage/translate',
1112
'mage/backend/tree-suggest',
1213
'mage/backend/validation'
@@ -51,53 +52,37 @@ define([
5152
options.errorClass, options.validClass || '');
5253
}
5354
});
54-
55-
this.element.dialog({
55+
this.element.modal({
56+
type: 'slide',
57+
modalClass: 'mage-new-category-dialog form-inline',
5658
title: $.mage.__('Create Category'),
57-
autoOpen: false,
58-
width: '75%',
59-
dialogClass: 'mage-new-category-dialog form-inline',
60-
modal: true,
61-
multiselect: true,
62-
resizable: false,
63-
position: {
64-
my: 'left top',
65-
at: 'center top',
66-
of: 'body'
67-
},
68-
open: function () {
69-
// fix for suggest field - overlapping dialog z-index
70-
$('#new_category_parent-suggest').css('z-index', $.ui.dialog.maxZ + 1);
59+
opened: function () {
7160
var enteredName = $('#category_ids-suggest').val();
61+
7262
$('#new_category_name').val(enteredName);
7363
if (enteredName === '') {
7464
$('#new_category_name').focus();
7565
}
7666
$('#new_category_messages').html('');
77-
$(this).closest('.ui-dialog').addClass('ui-dialog-active');
78-
79-
var topMargin = $(this).closest('.ui-dialog').children('.ui-dialog-titlebar').outerHeight() + 15;
80-
$(this).closest('.ui-dialog').css('margin-top', topMargin);
8167
},
82-
close: function () {
83-
$('#new_category_name, #new_category_parent-suggest').val('');
68+
closed: function () {
8469
var validationOptions = newCategoryForm.validation('option');
70+
71+
$('#new_category_name, #new_category_parent-suggest').val('');
8572
validationOptions.unhighlight($('#new_category_parent-suggest').get(0),
8673
validationOptions.errorClass, validationOptions.validClass || '');
8774
newCategoryForm.validation('clearError');
8875
$('#category_ids-suggest').focus();
89-
$(this).closest('.ui-dialog').removeClass('ui-dialog-active');
9076
},
9177
buttons: [{
9278
text: $.mage.__('Create Category'),
93-
'class': 'action-primary',
94-
'data-action': 'save',
95-
click: function (event) {
79+
class: 'action-primary',
80+
click: function (e) {
9681
if (!newCategoryForm.valid()) {
9782
return;
9883
}
84+
var thisButton = $(e.currentTarget);
9985

100-
var thisButton = $(event.target).closest('[data-action=save]');
10186
thisButton.prop('disabled', true);
10287
$.ajax({
10388
type: 'POST',
@@ -115,27 +100,25 @@ define([
115100
},
116101
dataType: 'json',
117102
context: $('body')
118-
})
119-
.success(
120-
function (data) {
121-
if (!data.error) {
122-
$('#category_ids-suggest').trigger('selectItem', {
123-
id: data.category.entity_id,
124-
label: data.category.name
125-
});
126-
$('#new_category_name, #new_category_parent-suggest').val('');
127-
$('#category_ids-suggest').val('');
128-
clearParentCategory();
129-
widget.element.dialog('close');
130-
} else {
131-
$('#new_category_messages').html(data.messages);
132-
}
133-
}
134-
)
135-
.complete(
136-
function () {
137-
thisButton.prop('disabled', false);
138-
}
103+
}).success(function (data) {
104+
if (!data.error) {
105+
var $suggest = $('#category_ids-suggest');
106+
107+
$suggest.trigger('selectItem', {
108+
id: data.category.entity_id,
109+
label: data.category.name
110+
});
111+
$('#new_category_name, #new_category_parent-suggest').val('');
112+
$suggest.val('');
113+
clearParentCategory();
114+
widget.element.trigger('closeModal');
115+
} else {
116+
$('#new_category_messages').html(data.messages);
117+
}
118+
}).complete(
119+
function () {
120+
thisButton.prop('disabled', false);
121+
}
139122
);
140123
}
141124
}]

app/code/Magento/Sales/view/adminhtml/web/order/edit/message.js

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
define([
88
"jquery",
99
"jquery/ui",
10+
'Magento_Ui/js/dialog/dialog',
1011
"mage/translate"
1112
], function($){
1213
"use strict";
13-
1414
$.widget('mage.orderEditDialog', {
1515
options: {
1616
url: null,
@@ -29,7 +29,7 @@ define([
2929
* Show dialog
3030
*/
3131
showDialog: function() {
32-
this.options.dialog.html(this.options.message).dialog('open');
32+
this.options.dialog.html(this.options.message).trigger('openDialog');
3333
},
3434

3535
/**
@@ -44,46 +44,9 @@ define([
4444
* @protected
4545
*/
4646
_prepareDialog: function() {
47-
var self = this;
48-
49-
this.options.dialog = $('<div class="ui-dialog-content ui-widget-content"></div>')
50-
.dialog({
51-
autoOpen: false,
52-
title: $.mage.__('Edit Order'),
53-
modal: true,
54-
resizable: false,
55-
width: '75%',
56-
dialogClass: 'edit-order-popup',
57-
position: {
58-
my: 'left top',
59-
at: 'center top',
60-
of: 'body'
61-
},
62-
open: function () {
63-
jQuery(this).closest('.ui-dialog').addClass('ui-dialog-active');
64-
65-
var topMargin = $(this).closest('.ui-dialog').children('.ui-dialog-titlebar').outerHeight() - 20;
66-
$(this).closest('.ui-dialog').css('margin-top', topMargin);
67-
},
68-
close: function() {
69-
jQuery(this).closest('.ui-dialog').removeClass('ui-dialog-active');
70-
},
71-
buttons: [{
72-
text: $.mage.__('Ok'),
73-
'class': 'action-primary',
74-
click: function(){
75-
self.redirect();
76-
}
77-
}, {
78-
text: $.mage.__('Cancel'),
79-
'class': 'action-close',
80-
click: function(){
81-
$(this).dialog('close');
82-
}
83-
}]
84-
});
47+
this.options.dialog = $('<div class="ui-dialog-content ui-widget-content"></div>').dialog();
8548
}
8649
});
87-
50+
8851
return $.mage.orderEditDialog;
89-
});
52+
});

0 commit comments

Comments
 (0)