From ac4b7dce864aa6375b0011db844fc98a51680bc6 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 1 Sep 2015 12:41:44 +0300 Subject: [PATCH] updated docs + added a browser imbeding in another browser demo... Signed-off-by: Alex A. Naanou --- ui (gen4)/experiments/browse-dialog.html | 32 +++++++++++++++++++++--- ui (gen4)/experiments/browse-dialog.js | 2 +- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/ui (gen4)/experiments/browse-dialog.html b/ui (gen4)/experiments/browse-dialog.html index 624d3a62..1b51f4f6 100755 --- a/ui (gen4)/experiments/browse-dialog.html +++ b/ui (gen4)/experiments/browse-dialog.html @@ -166,7 +166,7 @@ requirejs(['../lib/keyboard', '../object', './browse-dialog'], function(k, o, br list: function(path, make){ var cur = TREE - path.forEach(function(p){ + this.path2list(path).forEach(function(p){ cur = cur[p] }) @@ -244,7 +244,8 @@ requirejs(['../lib/keyboard', '../object', './browse-dialog'], function(k, o, br // path list demo... f3 = browser.makePathList($('.container.pathlist'), { - // XXX need a way to trigger open ecents with touch/mouse... + // build a basic tree... + // XXX need a way to trigger open events with touch/mouse... '/dir 1': function(_, p){ console.log('dir:', p) }, 'dir 1/option 1': function(_, p){ console.log('option:', p) }, 'dir 1/option 2/': function(_, p){ console.log('option:', p) }, @@ -254,10 +255,13 @@ requirejs(['../lib/keyboard', '../object', './browse-dialog'], function(k, o, br // XXX this is the wrong way to do this, but it shows a bug... // XXX BUG: for some reason 2 and 3 are set to traversable while // 1 is not... - 'option 5': function(_, p){ + 'bug demo': function(_, p){ console.log('option:', p) - f3.update(p + '/', function(){ return [1, 2, 3] }) + f3.update(p + '/', function(){ return [ + 'not traversable?!', + 'traversable!', + 'also traversable!'] }) }, // render a custom sub-tree... @@ -273,10 +277,30 @@ requirejs(['../lib/keyboard', '../object', './browse-dialog'], function(k, o, br // this will override the 'dynamic/*' in case of longer // matches... + // NOTE: this will make more sence when path patterns are + // supported... 'dynamic/1/1/*': function(path, make){ make('mooo!/') make('fooo!') }, + + // include another list... + // NOTE: we need to trim the path before passing it to the + // list to avoid confusing it... + // NOTE: this will lose any instance data and works here + // befause b references TREE in a closure... + // Thus, it is recommended to avoid storing state in + // the browser object. + // ...also note that internally nothing is stored in the + // browser object, other than the options. + 'browser/*': function(path, make){ + var list = b.options.list + + // trim off the base path... + path = this.path2list(path).slice(1) + + return list.call(this, path, make) + }, }) }) diff --git a/ui (gen4)/experiments/browse-dialog.js b/ui (gen4)/experiments/browse-dialog.js index f178fd8a..0e0c5f13 100755 --- a/ui (gen4)/experiments/browse-dialog.js +++ b/ui (gen4)/experiments/browse-dialog.js @@ -1716,7 +1716,7 @@ module.makeList = function(elem, list){ var PathListPrototype = Object.create(BrowserPrototype) PathListPrototype.options = { - fullPathEdit: false, + fullPathEdit: true, traversable: true, flat: false,