1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-08-09 07:25:21 +02:00

Added uri property to Page model

This commit is contained in:
DorofeevMark 2018-12-11 14:43:56 +03:00
parent 9966131100
commit 2364fd2ea2
6 changed files with 41 additions and 2134 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -4,6 +4,7 @@ const {pages: db} = require('../utils/database/index');
* @typedef {Object} PageData
* @property {string} _id - page id
* @property {string} title - page title
* @property {string} uri - page uri
* @property {*} body - page body
* @property {string} parent - id of parent page
*
@ -15,6 +16,7 @@ const {pages: db} = require('../utils/database/index');
*
* @property {string} _id - page id
* @property {string} title - page title
* @property {string} uri - page uri
* @property {*} body - page body
* @property {string} _parent - id of parent page
*/
@ -69,6 +71,7 @@ class Page {
this.body = body || this.body;
this.title = this.extractTitleFromBody();
this.uri = this._id;
this._parent = parent || this._parent;
}
@ -81,6 +84,7 @@ class Page {
return {
_id: this._id,
title: this.title,
uri: this.uri,
body: this.body,
parent: this._parent
};

View file

@ -1,7 +1,7 @@
<div class="docs-aside">
{% for firstLevelPage in menu %}
<section class="docs-aside__section">
<a class="docs-aside__section-title" href="/page/{{ firstLevelPage._id }}">
<a class="docs-aside__section-title" href="/page/{{ firstLevelPage.uri }}">
{{ firstLevelPage.title }}
</a>
{% if firstLevelPage.children is not empty %}