|
@@ -187,23 +187,13 @@ var doAjaxFormData = function (url, data, pre, post, onSuccess, onFailure, suppr
|
|
|
|
|
|
var justLog = false; //THIS IS FOR TEST MODE, FORMS WILL NOT TRIGGER REFRESH/REDIR
|
|
var justLog = false; //THIS IS FOR TEST MODE, FORMS WILL NOT TRIGGER REFRESH/REDIR
|
|
|
|
|
|
-var pageReload = function () {
|
|
|
|
|
|
+var pageReload = function (_target) {
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
hideMoeFormMask();
|
|
hideMoeFormMask();
|
|
- fastReload();
|
|
|
|
|
|
+ fastReload(_target);
|
|
}, 500);
|
|
}, 500);
|
|
};
|
|
};
|
|
|
|
|
|
-var fastReload = function() {
|
|
|
|
- var targetLocation = window.top.location.pathname + window.top.location.search;
|
|
|
|
- if(targetLocation.indexOf('/mc') === 0) {
|
|
|
|
- targetLocation = targetLocation.substr(3);
|
|
|
|
- }
|
|
|
|
- if(targetLocation === '' || targetLocation[0] !== '/') targetLocation = '/' + targetLocation;
|
|
|
|
- fastLoad(targetLocation, false, false);
|
|
|
|
- return false;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
if (typeof String.prototype.startsWith != 'function') {
|
|
if (typeof String.prototype.startsWith != 'function') {
|
|
// see below for better implementation!
|
|
// see below for better implementation!
|
|
String.prototype.startsWith = function (str) {
|
|
String.prototype.startsWith = function (str) {
|
|
@@ -329,6 +319,8 @@ var initMoes = function() {
|
|
var form = moe.find('[url]')[0]; // REQUIRED
|
|
var form = moe.find('[url]')[0]; // REQUIRED
|
|
var url = $(form).attr('url'); // REQUIRED
|
|
var url = $(form).attr('url'); // REQUIRED
|
|
var redir = $(form).attr('redir'); // OPTIONAL
|
|
var redir = $(form).attr('redir'); // OPTIONAL
|
|
|
|
+ var target = $(form).attr('target'); // OPTIONAL
|
|
|
|
+ var noreload = $(form).is('[noreload]'); // OPTIONAL
|
|
var submit = moe.find('[submit]'); // REQUIRED
|
|
var submit = moe.find('[submit]'); // REQUIRED
|
|
var cancel = moe.find('[cancel]')[0]; // OPTIONAL
|
|
var cancel = moe.find('[cancel]')[0]; // OPTIONAL
|
|
|
|
|
|
@@ -506,6 +498,13 @@ var initMoes = function() {
|
|
doAjax(url, data, null, function () {
|
|
doAjax(url, data, null, function () {
|
|
moe.isProcessing = false;
|
|
moe.isProcessing = false;
|
|
}, function (data) {
|
|
}, function (data) {
|
|
|
|
+ if(noreload) {
|
|
|
|
+ $(cancel).trigger('click.moe');
|
|
|
|
+ hideMoeFormMask();
|
|
|
|
+ hideMask();
|
|
|
|
+ toastr.success('Done');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if (justLog) { // this is to test!
|
|
if (justLog) { // this is to test!
|
|
console.log('RETURNED', data);
|
|
console.log('RETURNED', data);
|
|
} else if(isDynamicStagPopupPresent()) {
|
|
} else if(isDynamicStagPopupPresent()) {
|
|
@@ -530,7 +529,7 @@ var initMoes = function() {
|
|
initAutoRxAndICDComplete();
|
|
initAutoRxAndICDComplete();
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
- pageReload();
|
|
|
|
|
|
+ pageReload(target);
|
|
}
|
|
}
|
|
}, function (errorMessage) {
|
|
}, function (errorMessage) {
|
|
|
|
|
|
@@ -540,6 +539,13 @@ var initMoes = function() {
|
|
doAjaxFormData(url, data, null, function () {
|
|
doAjaxFormData(url, data, null, function () {
|
|
moe.isProcessing = false;
|
|
moe.isProcessing = false;
|
|
}, function (data) {
|
|
}, function (data) {
|
|
|
|
+ if(noreload) {
|
|
|
|
+ $(cancel).trigger('click.moe');
|
|
|
|
+ hideMoeFormMask();
|
|
|
|
+ hideMask();
|
|
|
|
+ toastr.success('Done');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if (justLog) { // this is to test!
|
|
if (justLog) { // this is to test!
|
|
console.log('RETURNED', data);
|
|
console.log('RETURNED', data);
|
|
} else if(isDynamicStagPopupPresent()) {
|
|
} else if(isDynamicStagPopupPresent()) {
|
|
@@ -564,7 +570,7 @@ var initMoes = function() {
|
|
initAutoRxAndICDComplete();
|
|
initAutoRxAndICDComplete();
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
- pageReload();
|
|
|
|
|
|
+ pageReload(target);
|
|
}
|
|
}
|
|
}, function (errorMessage) {
|
|
}, function (errorMessage) {
|
|
|
|
|