type.js 395 B

12345678910111213141516171819
  1. app.models.Type = class Type extends app.Model {
  2. // Attributes: name, slug, count
  3. fullPath() {
  4. return `/${this.doc.slug}-${this.slug}/`;
  5. }
  6. entries() {
  7. return this.doc.entries.findAllBy("type", this.name);
  8. }
  9. toEntry() {
  10. return new app.models.Entry({
  11. doc: this.doc,
  12. name: `${this.doc.name} / ${this.name}`,
  13. path: ".." + this.fullPath(),
  14. });
  15. }
  16. };