some tweaking to browse.js and history...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-05-04 18:01:19 +03:00
parent 7a5d694f94
commit 25c927342a
3 changed files with 30 additions and 6 deletions

View File

@ -104,6 +104,8 @@ var FileSystemLoaderActions = actions.Actions({
}], }],
// NOTE: when passed no path this will not do anything... // NOTE: when passed no path this will not do anything...
// NOTE: this will add a .from field to .location, this will indicate
// the date starting from which saves are loaded.
// //
// XXX how should .location be handled when merging indexes or // XXX how should .location be handled when merging indexes or
// viewing multiple/clustered indexes??? // viewing multiple/clustered indexes???
@ -221,7 +223,10 @@ var FileSystemLoaderActions = actions.Actions({
that.__location = { that.__location = {
path: loaded.length == 1 ? loaded[0] : path, path: loaded.length == 1 ? loaded[0] : path,
method: 'loadIndex', method: 'loadIndex',
from: from_date || 'all', }
if(from_date){
that.__location.from = from_date
} }
}) })
}], }],
@ -554,7 +559,9 @@ var FileSystemLoaderUIActions = actions.Actions({
// XXX handle named saves... // XXX handle named saves...
// XXX add ability to name a save... // XXX add ability to name a save...
// XXX need to handle saves when loaded a specific history position... // XXX need to handle saves when loaded a specific history position...
listSaveHistoryDialog: ['File/List save history...', // XXX should this also list journal stuff or have the ability for
// extending???
listSaveHistoryDialog: ['File/History...',
widgets.makeUIDialog(function(){ widgets.makeUIDialog(function(){
var that = this var that = this
@ -570,7 +577,7 @@ var FileSystemLoaderUIActions = actions.Actions({
var from = that.location.from var from = that.location.from
from = from && Date.fromTimeStamp(from).toShortDate() from = from && Date.fromTimeStamp(from).toShortDate()
make('Load all') make('Latest')
.on('open', function(){ .on('open', function(){
that.reloadState() that.reloadState()
}) })
@ -603,8 +610,16 @@ 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 ? 'highlighted selected' : '') .addClass(txt == from ? 'selected' : '')
}) })
// loading may take a some time so we'll need to
// update selection our selves...
//
// NOTE: here we will select 'Latest' if nothing
// was selected...
o.select()
.addClass('highlighted')
}) })
}) })
.on('open', function(){ .on('open', function(){

View File

@ -399,7 +399,7 @@ var URLHistoryUIActions = actions.Actions({
// XXX make availabilyty checking live (now on open dialog)... // XXX make availabilyty checking live (now on open dialog)...
// XXX need to check items... // XXX need to check items...
// XXX use svg icons for buttons... // XXX use svg icons for buttons...
listURLHistory: ['History|File/Show history...', listURLHistory: ['History|File/Location history...',
widgets.makeUIDialog(function(){ widgets.makeUIDialog(function(){
var that = this var that = this
var parent = this.preventClosing ? this.preventClosing() : null var parent = this.preventClosing ? this.preventClosing() : null

View File

@ -554,6 +554,9 @@ var BrowserPrototype = {
.toArray() .toArray()
}, },
set path(value){ set path(value){
this.update(value)
/*
// XXX check if path has changed... // XXX check if path has changed...
value = this.path2list(value) value = this.path2list(value)
var cur = this.path var cur = this.path
@ -563,6 +566,7 @@ var BrowserPrototype = {
&& cur && cur
.filter(function(e, i){ return e == value[i] }).length != cur.length .filter(function(e, i){ return e == value[i] }).length != cur.length
&& this.update(value) && this.update(value)
*/
}, },
// String path... // String path...
@ -2004,7 +2008,12 @@ var BrowserPrototype = {
if(path && (path.constructor == Array || /[\\\/]/.test(path))){ if(path && (path.constructor == Array || /[\\\/]/.test(path))){
path = this.path2list(path) path = this.path2list(path)
var elem = path.slice(-1)[0] var elem = path.slice(-1)[0]
this.path = path.slice(0, -1)
// only update path if it has changed...
if(this.path.filter(function(e, i){ return e == path[i] }).length != path.length - 1){
this.path = path.slice(0, -1)
}
elem = this.select('"'+ elem +'"') elem = this.select('"'+ elem +'"')
// get path + selection... // get path + selection...