minor rework to actions...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-09-18 15:46:06 +03:00
parent 5c45fbc5c6
commit b5ea4bfcb1
3 changed files with 18 additions and 8 deletions

View File

@ -274,7 +274,8 @@ object.Constructor('BasePage', {
this.actions[this.name] === true ? this.actions[this.name] === true ?
this.name this.name
: this.actions[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 var res = (this.isPattern
&& !this.__energetic && !this.__energetic
&& !page[name].energetic) ? && !page[name].energetic) ?
@ -282,12 +283,12 @@ object.Constructor('BasePage', {
.map(function(page){ .map(function(page){
var res = page[name] var res = page[name]
return typeof(res) == 'function' ? return typeof(res) == 'function' ?
res.bind(page) res.bind(page.get(name, {args}))
: function(){ : function(){
return res } }) return res } })
: await page[name] : await page[name]
return typeof(res) == 'function' ? return typeof(res) == 'function' ?
res.bind(page) res.bind(this)
: res instanceof Array ? : res instanceof Array ?
res res
: function(){ : function(){
@ -311,8 +312,7 @@ object.Constructor('BasePage', {
?? (this.__title = res.title) ?? (this.__title = res.title)
//*/ //*/
return typeof(res) == 'function' ? return typeof(res) == 'function' ?
//res.bind(this) res.bind(this)
res.bind(this.get('..', {args: this.args}))
: res }).call(this) }, : res }).call(this) },
set data(value){ set data(value){
this.__update__(value) }, this.__update__(value) },
@ -892,6 +892,7 @@ object.Constructor('Page', BasePage, {
.parse({ .parse({
seen: state.seen, seen: state.seen,
depends, depends,
renderer: state.renderer,
})} })}
: this.get(src) : this.get(src)
.parse(state) } .parse(state) }
@ -1362,13 +1363,14 @@ object.Constructor('Page', BasePage, {
state = text state = text
text = null } text = null }
state = state ?? {} state = state ?? {}
state.renderer = state.renderer ?? this
// this is here for debugging and introspection... // this is here for debugging and introspection...
'__debug_last_render_state' in this '__debug_last_render_state' in this
&& (this.__debug_last_render_state = state) && (this.__debug_last_render_state = state)
// parse... // parse...
return this.__parser__.parse( return this.__parser__.parse(
this.get('.', { this.get('.', {
renderer: this, renderer: state.renderer,
args: this.args, args: this.args,
}), }),
text, text,
@ -2022,8 +2024,11 @@ module.System = {
// redirect... // redirect...
this.renderer this.renderer
&& (this.renderer.location = this.referrer) && (this.renderer.location = this.referrer)
&& this.renderer.refresh()
// show info about the delete operation... // show info about the delete operation...
return target.get('DeletingPage/_text').text }, //return target.get('DeletingPage/_text').text
return ''
},
// XXX copy/move/... // XXX copy/move/...
// XXX do we need this as a page action??? // XXX do we need this as a page action???

View File

@ -44,6 +44,10 @@ module = {
// //
// This acts the same as elements in .SEARCH_PATHS but should contain // This acts the same as elements in .SEARCH_PATHS but should contain
// all the default and fallback templates. // 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', SYSTEM_PATH: '/.system',
/*/ XXX NORMCACHE... /*/ XXX NORMCACHE...

View File

@ -4,7 +4,8 @@
* XXX ASAP start writing docs in pwiki * XXX ASAP start writing docs in pwiki
* - WYSIWYG markdown editor/viewer (ASAP) * - WYSIWYG markdown editor/viewer (ASAP)
* - fs store/export in browser or a simple way to export/import... * - 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: * XXX BUG:
* /System/info * /System/info
* and: * and: