1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-08-09 15:35:25 +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 * @typedef {Object} PageData
* @property {string} _id - page id * @property {string} _id - page id
* @property {string} title - page title * @property {string} title - page title
* @property {string} uri - page uri
* @property {*} body - page body * @property {*} body - page body
* @property {string} parent - id of parent page * @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} _id - page id
* @property {string} title - page title * @property {string} title - page title
* @property {string} uri - page uri
* @property {*} body - page body * @property {*} body - page body
* @property {string} _parent - id of parent page * @property {string} _parent - id of parent page
*/ */
@ -69,6 +71,7 @@ class Page {
this.body = body || this.body; this.body = body || this.body;
this.title = this.extractTitleFromBody(); this.title = this.extractTitleFromBody();
this.uri = this._id;
this._parent = parent || this._parent; this._parent = parent || this._parent;
} }
@ -81,6 +84,7 @@ class Page {
return { return {
_id: this._id, _id: this._id,
title: this.title, title: this.title,
uri: this.uri,
body: this.body, body: this.body,
parent: this._parent parent: this._parent
}; };

View file

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