WIP: Aureplop/kpsul js refactor #501

Draft
delobell wants to merge 215 commits from aureplop/kpsul_js_refactor into master
Showing only changes of commit 3b9affb3f3 - Show all commits

View file

@ -19,6 +19,17 @@ class KPsulManager {
} }
} }
focus() {
if (this.checkout_manager.is_empty())
this.checkout_manager.focus();
else if (this.account_manager.is_empty())
this.account_manager.focus();
else
this.article_manager.focus();
return this;
}
} }
@ -267,11 +278,7 @@ class CheckoutManager {
(data) => this._update_on_success(data), (data) => this._update_on_success(data),
() => this.reset_data()); () => this.reset_data());
if (kpsul.account_manager.is_empty()) { kpsul.focus();
kpsul.account_manager.focus();
} else {
kpsul.article_manager.focus();
}
} }
_update_on_success(data) { _update_on_success(data) {
@ -336,6 +343,11 @@ class CheckoutManager {
this.display(); this.display();
} }
focus() {
this.selection.focus();
return this;
}
} }
@ -368,6 +380,11 @@ class CheckoutSelection {
reset() { reset() {
this._$input.find('option:first').prop('selected', true); this._$input.find('option:first').prop('selected', true);
} }
focus() {
this._$input.focus();
return this;
}
} }
class ArticleManager { class ArticleManager {