From 12f6488c805b2ca3a7d04ba3deeb672ca78a1d7d Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 21 Jun 2015 04:15:54 +0300 Subject: [PATCH] revised non-traversable handling + test... Signed-off-by: Alex A. Naanou --- ui (gen4)/experiments/browse-dialog.css | 3 +++ ui (gen4)/experiments/browse-dialog.html | 20 +++++++++++++++++++- ui (gen4)/experiments/browse-dialog.js | 14 ++++++++++---- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/ui (gen4)/experiments/browse-dialog.css b/ui (gen4)/experiments/browse-dialog.css index 3414a2f5..f5902129 100755 --- a/ui (gen4)/experiments/browse-dialog.css +++ b/ui (gen4)/experiments/browse-dialog.css @@ -115,6 +115,9 @@ opacity: 0.7; } +.browse .list div:not(.not-traversable):after { + content: "/"; +} .browse:focus .list div.selected, .browse .path .dir:hover, diff --git a/ui (gen4)/experiments/browse-dialog.html b/ui (gen4)/experiments/browse-dialog.html index 6fca6d3f..b69a9e17 100755 --- a/ui (gen4)/experiments/browse-dialog.html +++ b/ui (gen4)/experiments/browse-dialog.html @@ -142,6 +142,7 @@ TREE.dir_c.dir_b.tree = TREE //--- var use_disabled = true +var show_files = false requirejs(['../lib/keyboard', '../object', './browse-dialog'], function(k, o, browser){ keyboard = k @@ -157,7 +158,7 @@ requirejs(['../lib/keyboard', '../object', './browse-dialog'], function(k, o, br return Object.keys(cur) // remove all strings... .filter(function(k){ - return typeof(cur[k]) != typeof('str') + return show_files || typeof(cur[k]) != typeof('str') }) .map(function(k){ // make the element... @@ -166,6 +167,9 @@ requirejs(['../lib/keyboard', '../object', './browse-dialog'], function(k, o, br if(use_disabled && k == 'dir_b'){ e.addClass('disabled') } + if(typeof(cur[k]) == typeof('str')){ + e.addClass('not-traversable') + } return k }) }, @@ -202,6 +206,15 @@ function toggleDisabled(){ use_disabled ? b.disableElements('_b') : b.enableElements('_b') } +function toggleFiles(){ + show_files = !show_files + + // NOTE: we need to update only because .list(..) does not show + // files at all and we need to re-render them, another way + // would be render everything but hide and show files via CSS + // class... + b.update() +} @@ -221,6 +234,11 @@ Theme: Disabled: +
+ +Files: + +
diff --git a/ui (gen4)/experiments/browse-dialog.js b/ui (gen4)/experiments/browse-dialog.js index 17e87831..fe023595 100755 --- a/ui (gen4)/experiments/browse-dialog.js +++ b/ui (gen4)/experiments/browse-dialog.js @@ -648,9 +648,7 @@ var BrowserPrototype = { path.push(elem.text()) // if not traversable call the action... - if(this.isTraversable != null - && (this.isTraversable !== false - || ! this.isTraversable(path))){ + if(elem.hasClass('not-traversable')){ return this.action(path) } @@ -727,12 +725,20 @@ var BrowserPrototype = { // - make should never get called // - the returned list will be rendered // + // + // This can set the following classes on elements: + // + // .disabled + // an element is disabled. + // + // .non-traversable + // an element is not traversable/listable and will trigger the + // .action(..) on push... list: function(path, make){ path = path || this.path var m = this.options.list return m ? m.apply(this, arguments) : [] }, - isTraversable: null, // XXX need to get a container.... // XXX setup instance events...