Skip to content

Commit

Permalink
MAGETWO-42996: Implement prompt, alert, confirm dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaets Volodymyr committed Sep 28, 2015
1 parent 2076868 commit faa5f9a
Show file tree
Hide file tree
Showing 25 changed files with 651 additions and 459 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

<?php if (is_array($block->getChildBlock('diagrams')->getTabsIds())) : ?>
<script>
require(['prototype'], function(){
require([
'Magento_Ui/js/modal/alert',
'prototype'
], function(alert){

window.changeDiagramsPeriod = function(periodObj) {
periodParam = periodObj.value ? 'period/' + periodObj.value + '/' : '';
Expand All @@ -25,7 +28,9 @@ window.changeDiagramsPeriod = function(periodObj) {
if (transport.responseText.isJSON()) {
var response = transport.responseText.evalJSON()
if (response.error) {
alert(response.message);
alert({
content: response.message
});
}
if(response.ajaxExpired && response.ajaxRedirect) {
setLocation(response.ajaxRedirect);
Expand All @@ -47,9 +52,11 @@ window.changeDiagramsPeriod = function(periodObj) {
tabContentElementId = 'dashboard_diagram_totals';
try {
if (transport.responseText.isJSON()) {
var response = transport.responseText.evalJSON()
var response = transport.responseText.evalJSON();
if (response.error) {
alert(response.message);
alert({
content: response.message
});
}
if(response.ajaxExpired && response.ajaxRedirect) {
setLocation(response.ajaxRedirect);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
require([
"jquery",
'mage/template',
'Magento_Ui/js/modal/alert',
"mage/translate",
"jquery/file-uploader"
], function ($, mageTemplate) {
], function ($, mageTemplate, alert) {

$('#fileupload').fileupload({
dataType: 'json',
Expand Down Expand Up @@ -75,7 +76,9 @@ require([
$('#' + data.fileId)
.delay(2000)
.hide('highlight');
alert($.mage.__('We don\'t recognize or support this file extension type.'));
alert({
content: $.mage.__('We don\'t recognize or support this file extension type.')
});
}
$('#' + data.fileId).remove();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ require([
"jquery",
"tinymce",
'Magento_Ui/js/modal/confirm',
'Magento_Ui/js/modal/alert',
"loadingPopup",
"mage/backend/floating-header"
], function(jQuery, tinyMCE, confirm){
], function(jQuery, tinyMCE, confirm, alert){

//<![CDATA[
function categoryReset(url,useAjax){
Expand Down Expand Up @@ -87,7 +88,9 @@ require([
});
$categoryContainer.html('');
} catch (e) {
alert(e.message);
alert({
content: e.message
});
}
$categoryContainer.html(data.content).trigger('contentUpdated');
setTimeout(function() {
Expand All @@ -104,7 +107,9 @@ require([
window.refreshTreeArea();
}
} catch (e) {
alert(e.message);
alert({
content: e.message
});
};
}, 25);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@

?>
<script>
require(["jquery", "collapsable", "prototype"], function(jQuery){
require([
"jquery",
'Magento_Ui/js/modal/alert',
"collapsable",
"prototype"
], function(jQuery, alert){

function toggleApplyVisibility(select) {
if ($(select).value == 1) {
Expand Down Expand Up @@ -269,7 +274,10 @@ function saveAttributeInNewSet(promptMessage)
var rules = ['required-entry', 'validate-no-html-tags'];
for (var i = 0; i < rules.length; i++) {
if (!jQuery.validator.methods[rules[i]](newAttributeSetName)) {
alert(jQuery.validator.messages[rules[i]]);
alert({
content: jQuery.validator.messages[rules[i]]
});

return;
}
}
Expand Down
Loading

0 comments on commit faa5f9a

Please sign in to comment.