mirror of https://github.com/freeCodeCamp/devdocs
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.
31 lines
545 B
31 lines
545 B
app.views.StaticPage = class StaticPage extends app.View {
|
|
static className = "_static";
|
|
|
|
static titles = {
|
|
about: "About",
|
|
news: "News",
|
|
help: "User Guide",
|
|
notFound: "404",
|
|
};
|
|
|
|
deactivate() {
|
|
if (super.deactivate(...arguments)) {
|
|
this.empty();
|
|
this.page = null;
|
|
}
|
|
}
|
|
|
|
render(page) {
|
|
this.page = page;
|
|
this.html(this.tmpl(`${this.page}Page`));
|
|
}
|
|
|
|
getTitle() {
|
|
return this.constructor.titles[this.page];
|
|
}
|
|
|
|
onRoute(context) {
|
|
this.render(context.page || "notFound");
|
|
}
|
|
};
|