cleanup and twaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-05-04 19:26:26 +03:00
parent 25c927342a
commit 639d3c9edc
4 changed files with 35 additions and 9 deletions

View File

@ -471,8 +471,6 @@ var FileSystemLoaderUIActions = actions.Actions({
}, },
}, },
// XXX for some reason the path list blinks (.update()???) when sub
// menu is shown...
// XXX should the loader list be nested or open in overlay (as-is now)??? // XXX should the loader list be nested or open in overlay (as-is now)???
browsePath: ['File/Browse file system...', browsePath: ['File/Browse file system...',
widgets.makeUIDialog(function(base, callback){ widgets.makeUIDialog(function(base, callback){
@ -554,6 +552,9 @@ var FileSystemLoaderUIActions = actions.Actions({
// XXX add dialog to list sub-indexes... // XXX add dialog to list sub-indexes...
// XXX // XXX
// NOTE: for multiple indexes this will show the combined history
// and selecting a postion will load all the participating
// indexes to that date.
// NOTE: this will show nothing if .location.method is not loadIndex.. // NOTE: this will show nothing if .location.method is not loadIndex..
// //
// XXX handle named saves... // XXX handle named saves...
@ -610,12 +611,11 @@ var FileSystemLoaderUIActions = actions.Actions({
that.loadIndex(that.location.path, d) that.loadIndex(that.location.path, d)
}) })
// mark the current loaded position... // mark the current loaded position...
.addClass(txt == from ? 'selected' : '') .addClass(txt == from ? 'selected highlighted' : '')
}) })
// loading may take a some time so we'll need to make.done()
// update selection our selves...
//
// NOTE: here we will select 'Latest' if nothing // NOTE: here we will select 'Latest' if nothing
// was selected... // was selected...
o.select() o.select()
@ -1533,6 +1533,8 @@ var FileSystemWriterUIActions = actions.Actions({
dialog.parent.close() dialog.parent.close()
}) })
.addClass('selected') .addClass('selected')
make.done()
}) })
o.dom.addClass('metadata-view tail-action') o.dom.addClass('metadata-view tail-action')

View File

@ -530,6 +530,7 @@ var DialogsActions = actions.Actions({
}) })
}) })
make.done()
}) })
})], })],
}) })
@ -822,8 +823,14 @@ var WidgetTestActions = actions.Actions({
that.parent.close() that.parent.close()
}) })
// XXX the parent is not yet set at this point... // NOTE: the dialog's .parent is not yet set at this point...
//console.log('>>>', that.parent)
// This will finalize the dialog...
//
// NOTE: this is not needed here as the dialog is drawn
// on sync, but for async dialogs this will align
// the selected field correctly.
make.done()
}) })
// NOTE: this is not a dialog event, it is defined by the // NOTE: this is not a dialog event, it is defined by the
// container to notify us that we are closing... // container to notify us that we are closing...

View File

@ -166,9 +166,12 @@ function makeConstructor(name, a, b){
return obj return obj
} }
/* XXX for some reason this works for the _constructor but all
* instances get the wrong name resolved...
Object.defineProperty(_constructor, 'name', { Object.defineProperty(_constructor, 'name', {
value: name, value: name,
}) })
*/
// just in case the browser refuses to change the name, we'll make it // just in case the browser refuses to change the name, we'll make it
// a different offer ;) // a different offer ;)

View File

@ -765,6 +765,12 @@ var BrowserPrototype = {
// .itemButtons // .itemButtons
// //
// //
// Finalize the dialog (optional)...
// - Call make.done() can optionally be called after all the itmes
// are created. This will update the dialog to align the
// selected position.
// This is useful for dialogs with async loading items.
//
// //
// XXX need a way to handle path errors in the extension API... // XXX need a way to handle path errors in the extension API...
// ...for example, if .list(..) can't list or lists a different // ...for example, if .list(..) can't list or lists a different
@ -1043,6 +1049,12 @@ var BrowserPrototype = {
return res return res
} }
// align the dialog...
make.done = function(){
var s = l.find('.selected')
s.length > 0 && that.select(s)
}
// build the list... // build the list...
var res = list.call(this, path, make) var res = list.call(this, path, make)
@ -2170,7 +2182,9 @@ var BrowserPrototype = {
parent.append(dom) parent.append(dom)
} }
// XXX is this the right way to go??? // Select the default path...
//
// NOTE: this may not work when the dialog is loaded async...
setTimeout(function(){ setTimeout(function(){
// load the initial state... // load the initial state...
that.update(options.path || that.path || '/') that.update(options.path || that.path || '/')