From f0e7253374196d0ec3afb9fc72b2131fc29ba582 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Thu, 1 Sep 2022 13:33:28 +0200 Subject: [PATCH] Updated docs --- app/imports/server/publications/docs.js | 7 ++- app/imports/ui/pages/Documentation.vue | 71 ++++++++++++++++++------- app/imports/ui/router.js | 8 +++ app/private/dependency-loops.md | 0 app/private/docs/dependency-loops.md | 2 + app/private/docs/docs.md | 38 +++++++++++++ app/private/docs/inline-calculations.md | 2 + app/private/docs/property/effect.md | 2 +- app/private/docs/tags.md | 2 + 9 files changed, 110 insertions(+), 22 deletions(-) delete mode 100644 app/private/dependency-loops.md create mode 100644 app/private/docs/dependency-loops.md create mode 100644 app/private/docs/docs.md diff --git a/app/imports/server/publications/docs.js b/app/imports/server/publications/docs.js index bc20ab54..0844676c 100644 --- a/app/imports/server/publications/docs.js +++ b/app/imports/server/publications/docs.js @@ -2,7 +2,12 @@ import { propsByDocsPath } from '/imports/constants/PROPERTIES.js'; // Manual doc paths -const docPaths = []; +const docPaths = [ + 'computed-fields', + 'dependency-loops', + 'docs', + 'tags', +]; const docs = new Map(); docPaths.forEach(path => { docs.set(path, Assets.getText(`docs/${path}.md`)) diff --git a/app/imports/ui/pages/Documentation.vue b/app/imports/ui/pages/Documentation.vue index 29a78870..8bb7fcf4 100644 --- a/app/imports/ui/pages/Documentation.vue +++ b/app/imports/ui/pages/Documentation.vue @@ -2,13 +2,30 @@ - - - - - + + + + + + + + + + Help document not found for {{ title }} + + + @@ -30,11 +47,24 @@ export default { }, computed: { path() { - return this.$route.params.docPath; + return this.$route.params.docPath || 'docs'; }, prop() { return propsByDocsPath.get(this.path); }, + title() { + if (this.prop) { + return this.prop.name + ' Docs'; + } else { + const titleCase = this.path.replace( + /(\w*)(\W+)/g, + function(txt, word) { + return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase() + ' '; + } + ); + return titleCase || 'DiceCloud Docs'; + } + } }, meteor: { $subscribe: { @@ -48,22 +78,23 @@ export default { }, }, watch: { - path: { + title: { immediate: true, handler(value) { - if (this.prop) { - this.$store.commit('setPageTitle', this.prop.name + ' Docs'); - } else { - const titleCase = value.replace( - /(\w*)(\W+)/g, - function(txt, word) { - return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase() + ' '; - } - ); - this.$store.commit('setPageTitle', titleCase || 'Character Sheet'); - } + this.$store.commit('setPageTitle', value); } } + }, + methods: { + mdClick(e) { + const target = e.target || e.srcElement; + const href = target && target.href; + if (!href) return; + const path = href.split('/docs/')[1]; + if (!path) return; + e.preventDefault(); + this.$router.push('/docs/' + path); + } } } \ No newline at end of file diff --git a/app/imports/ui/router.js b/app/imports/ui/router.js index defb860a..8e30b7c2 100644 --- a/app/imports/ui/router.js +++ b/app/imports/ui/router.js @@ -251,6 +251,14 @@ RouterFactory.configure(router => { meta: { title: 'Documentation', }, + },{ + path: '/docs', + components: { + default: Documentation, + }, + meta: { + title: 'Documentation', + }, },{ path: '/about', components: { diff --git a/app/private/dependency-loops.md b/app/private/dependency-loops.md deleted file mode 100644 index e69de29b..00000000 diff --git a/app/private/docs/dependency-loops.md b/app/private/docs/dependency-loops.md new file mode 100644 index 00000000..432556b9 --- /dev/null +++ b/app/private/docs/dependency-loops.md @@ -0,0 +1,2 @@ +# Dependency loops + diff --git a/app/private/docs/docs.md b/app/private/docs/docs.md new file mode 100644 index 00000000..ca9c7ad7 --- /dev/null +++ b/app/private/docs/docs.md @@ -0,0 +1,38 @@ +# DiceCloud Docs + +## Properties + +- ### [Action](/docs/property/action) +- ### [Attribute](/docs/property/attribute) +- ### [Attribute Damage](/docs/property/attribute-damage) +- ### [Buff](/docs/property/buff) +- ### [Remove Buff](/docs/property/remove-buff) +- ### [Branch](/docs/property/branch) +- ### [Class](/docs/property/class) +- ### [Class Level](/docs/property/class-level) +- ### [Constant](/docs/property/constant) +- ### [Container](/docs/property/container) +- ### [Damage](/docs/property/damage) +- ### [Damage Multiplier](/docs/property/damage-multiplier) +- ### [Effect](/docs/property/effect) +- ### [Feature](/docs/property/feature) +- ### [Item](/docs/property/item) +- ### [Note](/docs/property/note) +- ### [Point Buy](/docs/property/point-buy) +- ### [Proficiency](/docs/property/proficiency) +- ### [Roll](/docs/property/roll) +- ### [Saving Throw](/docs/property/saving-throw) +- ### [Skill](/docs/property/skill) +- ### [Slot](/docs/property/slot) +- ### [Slot Filler](/docs/property/slot-filler) +- ### [Spell List](/docs/property/spell-list) +- ### [Spell](/docs/property/spell) +- ### [Toggle](/docs/property/toggle) +- ### [Trigger](/docs/property/trigger) + +## Topics + +- ### [Computed fields](/docs/computed-fields) +- ### [Inline Calculations](/docs/inline-calculations) +- ### [Dependency Loops](/docs/dependency-loops) +- ### [Tags](/docs/tags) diff --git a/app/private/docs/inline-calculations.md b/app/private/docs/inline-calculations.md index e69de29b..c73a0f30 100644 --- a/app/private/docs/inline-calculations.md +++ b/app/private/docs/inline-calculations.md @@ -0,0 +1,2 @@ +# Inline Calculations + diff --git a/app/private/docs/property/effect.md b/app/private/docs/property/effect.md index f22526aa..b453e94f 100644 --- a/app/private/docs/property/effect.md +++ b/app/private/docs/property/effect.md @@ -1,6 +1,6 @@ # Effects -Effects are the core of the DiceCloud engine. Effect change the values of attributes, skills, and calculations in a way that is transparent and auditable, keeping character sheets organized and understandable, even when using intricate homebrew rules on high level characters. To understand how effects work is to understand DiceCloud characters. +Effects are the core of the DiceCloud engine. Effect change the values of attributes, skills, and calculations in a way that is transparent and auditable, keeping character sheets organized and understandable, even when using intricate homebrew rules on high level characters. --- diff --git a/app/private/docs/tags.md b/app/private/docs/tags.md index e69de29b..3fc2ca3c 100644 --- a/app/private/docs/tags.md +++ b/app/private/docs/tags.md @@ -0,0 +1,2 @@ +# Tags +