From b5ea4bfcb111a6d2cf6716938fea926316bfb317 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 18 Sep 2022 15:46:06 +0300 Subject: [PATCH] minor rework to actions... Signed-off-by: Alex A. Naanou --- pwiki/page.js | 19 ++++++++++++------- pwiki/path.js | 4 ++++ pwiki2.js | 3 ++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/pwiki/page.js b/pwiki/page.js index ca357b0..6b1f297 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -274,7 +274,8 @@ object.Constructor('BasePage', { this.actions[this.name] === true ? this.name : this.actions[this.name] - var page = this.get('..', {args: this.args}) + var args = this.args + var page = this.get('..', {args}) var res = (this.isPattern && !this.__energetic && !page[name].energetic) ? @@ -282,12 +283,12 @@ object.Constructor('BasePage', { .map(function(page){ var res = page[name] return typeof(res) == 'function' ? - res.bind(page) + res.bind(page.get(name, {args})) : function(){ return res } }) : await page[name] return typeof(res) == 'function' ? - res.bind(page) + res.bind(this) : res instanceof Array ? res : function(){ @@ -311,8 +312,7 @@ object.Constructor('BasePage', { ?? (this.__title = res.title) //*/ return typeof(res) == 'function' ? - //res.bind(this) - res.bind(this.get('..', {args: this.args})) + res.bind(this) : res }).call(this) }, set data(value){ this.__update__(value) }, @@ -892,6 +892,7 @@ object.Constructor('Page', BasePage, { .parse({ seen: state.seen, depends, + renderer: state.renderer, })} : this.get(src) .parse(state) } @@ -1362,13 +1363,14 @@ object.Constructor('Page', BasePage, { state = text text = null } state = state ?? {} + state.renderer = state.renderer ?? this // this is here for debugging and introspection... '__debug_last_render_state' in this && (this.__debug_last_render_state = state) // parse... return this.__parser__.parse( this.get('.', { - renderer: this, + renderer: state.renderer, args: this.args, }), text, @@ -2022,8 +2024,11 @@ module.System = { // redirect... this.renderer && (this.renderer.location = this.referrer) + && this.renderer.refresh() // show info about the delete operation... - return target.get('DeletingPage/_text').text }, + //return target.get('DeletingPage/_text').text + return '' + }, // XXX copy/move/... // XXX do we need this as a page action??? diff --git a/pwiki/path.js b/pwiki/path.js index 468f57e..bd96094 100755 --- a/pwiki/path.js +++ b/pwiki/path.js @@ -44,6 +44,10 @@ module = { // // This acts the same as elements in .SEARCH_PATHS but should contain // all the default and fallback templates. + // + // NOTE: we can't use .pwiki here as it will be in conflict with the + // fs store's directory structure. + // XXX or can we? SYSTEM_PATH: '/.system', /*/ XXX NORMCACHE... diff --git a/pwiki2.js b/pwiki2.js index 9c502df..a00a417 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -4,7 +4,8 @@ * XXX ASAP start writing docs in pwiki * - WYSIWYG markdown editor/viewer (ASAP) * - fs store/export in browser or a simple way to export/import... -* XXX BUG: /delete is broken... +* XXX currently actions get the parent path (not including the action), +* is this correct??? * XXX BUG: * /System/info * and: