Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-26 02:50:28 +01:00
Update error handling
Dieser Commit ist enthalten in:
Ursprung
ebab021916
Commit
bab2c95cfe
1 geänderte Dateien mit 9 neuen und 8 gelöschten Zeilen
|
@ -89,15 +89,15 @@ export default {
|
||||||
|
|
||||||
animateInvalidFields() {
|
animateInvalidFields() {
|
||||||
Ember.run.scheduleOnce('afterRender', () => {
|
Ember.run.scheduleOnce('afterRender', () => {
|
||||||
let query = '.invalid input[type=text], .invalid textarea, .invalid input[type=checkbox], .invalid .select-kit';
|
let $element = $('.invalid input[type=text], .invalid textarea, .invalid input[type=checkbox], .invalid .select-kit');
|
||||||
let $element = $(query);
|
|
||||||
let scrollTop = $(query).length ? $(query).offset().top - 200 : 0;
|
|
||||||
|
|
||||||
|
if ($element.length) {
|
||||||
$([document.documentElement, document.body]).animate({
|
$([document.documentElement, document.body]).animate({
|
||||||
scrollTop
|
scrollTop: $(query).offset().top - 200
|
||||||
}, 400, function() {
|
}, 400, function() {
|
||||||
$(query).wiggle(2, 100);
|
$(query).wiggle(2, 100);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -179,6 +179,7 @@ export default {
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
data: { fields }
|
data: { fields }
|
||||||
}).catch(response => {
|
}).catch(response => {
|
||||||
|
console.log(response)
|
||||||
if (response && response.responseJSON && response.responseJSON.errors) {
|
if (response && response.responseJSON && response.responseJSON.errors) {
|
||||||
let wizardErrors = [];
|
let wizardErrors = [];
|
||||||
response.responseJSON.errors.forEach(err => {
|
response.responseJSON.errors.forEach(err => {
|
||||||
|
|
Laden …
In neuem Issue referenzieren