From 8296f08eb0b351dab118035134cbddc5ec691074 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 12 Dec 2016 16:29:32 +0300 Subject: [PATCH] more introspection + refactoring... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/ui-widgets.js | 33 ++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 305893ee..57eaba6c 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -548,6 +548,34 @@ var DialogsActions = actions.Actions({ 'ui-overlay-blur': 'on', }, + // introspection... + // XXX should these be more like .getDoc(..) and support lists of actions??? + getDocPath: ['- Interface/', + function(action, clean, join){ + clean = clean == null ? true : clean + join = join == null ? '/' : join + var path = (this.getDoc(action)[action].shift() || action) + .split(/[\\\/]/g) + // remove priority... + .map(function(e){ + return clean ? e.replace(/^[-+]?[0-9]+:\s*/, '') : e }) + return join ? path.join('/') : path + }], + getDocBaseDir: ['- Interface/', + function(action, clean, join){ + clean = clean == null ? true : clean + join = join == null ? '/' : join + var path = this.getDocPath(action, clean, false) + // drop the title... + .slice(0, -1) + return join ? path.join('/') : path + }], + getDocTitle: ['- Interface/', + function(action, clean){ + clean = clean == null ? true : clean + return this.getDocPath(action, clean, false).pop() + }], + // a bit of introspection... get uiContainers(){ return this.actions.filter(this.isUIContainer.bind(this)) }, @@ -709,10 +737,7 @@ module.Dialogs = core.ImageGridFeatures.Feature({ var elem = (res.dom || res) !elem.attr('dialog-title') - && elem.attr( - 'dialog-title', - (this.getDoc(action)[action].shift() || action) - .split(/[\\\/]/g).pop()) + && elem.attr('dialog-title', this.getDocTitle(action)) } }], ],