static_page.js 985 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // TODO: This file was created by bulk-decaffeinate.
  2. // Sanity-check the conversion and remove this comment.
  3. /*
  4. * decaffeinate suggestions:
  5. * DS102: Remove unnecessary code created because of implicit returns
  6. * DS206: Consider reworking classes to avoid initClass
  7. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
  8. */
  9. const Cls = (app.views.StaticPage = class StaticPage extends app.View {
  10. static initClass() {
  11. this.className = '_static';
  12. this.titles = {
  13. about: 'About',
  14. news: 'News',
  15. help: 'User Guide',
  16. notFound: '404'
  17. };
  18. }
  19. deactivate() {
  20. if (super.deactivate(...arguments)) {
  21. this.empty();
  22. this.page = null;
  23. }
  24. }
  25. render(page) {
  26. this.page = page;
  27. this.html(this.tmpl(`${this.page}Page`));
  28. }
  29. getTitle() {
  30. return this.constructor.titles[this.page];
  31. }
  32. onRoute(context) {
  33. this.render(context.page || 'notFound');
  34. }
  35. });
  36. Cls.initClass();