WIP: Aureplop/kpsul js refactor #501
1 changed files with 22 additions and 5 deletions
|
@ -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),
|
||||
() => this.reset_data());
|
||||
|
||||
if (kpsul.account_manager.is_empty()) {
|
||||
kpsul.account_manager.focus();
|
||||
} else {
|
||||
kpsul.article_manager.focus();
|
||||
}
|
||||
kpsul.focus();
|
||||
}
|
||||
|
||||
_update_on_success(data) {
|
||||
|
@ -336,6 +343,11 @@ class CheckoutManager {
|
|||
|
||||
this.display();
|
||||
}
|
||||
|
||||
focus() {
|
||||
this.selection.focus();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -368,6 +380,11 @@ class CheckoutSelection {
|
|||
reset() {
|
||||
this._$input.find('option:first').prop('selected', true);
|
||||
}
|
||||
|
||||
focus() {
|
||||
this._$input.focus();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
class ArticleManager {
|
||||
|
|
Loading…
Reference in a new issue