You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
devdocs/assets/javascripts/views/misc/notice.js

38 lines
648 B

app.views.Notice = class Notice extends app.View {
static className = "_notice";
static attributes = { role: "alert" };
11 years ago
constructor(type, ...args) {
super();
1 year ago
this.type = type;
this.args = args || [];
this.init0(); // needs this.args
this.refreshElements();
1 year ago
}
11 years ago
init0() {
this.activate();
}
11 years ago
activate() {
1 year ago
if (super.activate(...arguments)) {
this.show();
}
}
11 years ago
deactivate() {
1 year ago
if (super.deactivate(...arguments)) {
this.hide();
}
}
11 years ago
show() {
this.html(this.tmpl(`${this.type}Notice`, ...this.args));
this.prependTo(app.el);
}
11 years ago
hide() {
$.remove(this.el);
}
};