mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
experementing with changes browser...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
15711beb16
commit
5a3b3e735d
@ -1478,6 +1478,9 @@ var ChangesActions = actions.Actions({
|
|||||||
// NOTE: in the complex format all fields ar optional; if a field
|
// NOTE: in the complex format all fields ar optional; if a field
|
||||||
// is not included it is not written (same as when set to false)
|
// is not included it is not written (same as when set to false)
|
||||||
// NOTE: .current is written always.
|
// NOTE: .current is written always.
|
||||||
|
//
|
||||||
|
// XXX this should be a prop to enable correct changes tracking via
|
||||||
|
// events...
|
||||||
chages: null,
|
chages: null,
|
||||||
|
|
||||||
clone: [function(full){
|
clone: [function(full){
|
||||||
@ -1489,6 +1492,7 @@ var ChangesActions = actions.Actions({
|
|||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
// XXX this should also track .changes...
|
||||||
markChanged: ['- System/',
|
markChanged: ['- System/',
|
||||||
doc`Mark data sections as changed...
|
doc`Mark data sections as changed...
|
||||||
|
|
||||||
|
|||||||
@ -7,22 +7,69 @@
|
|||||||
(function(require){ var module={} // make module AMD/node compatible...
|
(function(require){ var module={} // make module AMD/node compatible...
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
|
var toggler = require('lib/toggler')
|
||||||
var actions = require('lib/actions')
|
var actions = require('lib/actions')
|
||||||
var features = require('lib/features')
|
var features = require('lib/features')
|
||||||
|
|
||||||
var core = require('features/core')
|
var core = require('features/core')
|
||||||
|
var widgets = require('features/ui-widgets')
|
||||||
|
|
||||||
|
var widget = require('lib/widget/widget')
|
||||||
|
var browse = require('lib/widget/browse')
|
||||||
|
var overlay = require('lib/widget/overlay')
|
||||||
|
var drawer = require('lib/widget/drawer')
|
||||||
|
|
||||||
|
var browseWalk = require('lib/widget/browse-walk')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
var ExperimentActions = actions.Actions({
|
var ExperimentActions = actions.Actions({
|
||||||
/* trying an argument mutation method... (FAILED: arguments is mutable)
|
// XXX depends on ui, ...
|
||||||
argumentMutation: [
|
// XXX should we add ability to pick and chose the changes???
|
||||||
function(a, b){
|
// XXX would be nice to have a universal .save() action...
|
||||||
console.log('ACTIONS ARGS:', a, b)
|
browseChanges: ['Experimental/$Changes...',
|
||||||
}],
|
{dialogTitle: 'Unsaved changes'},
|
||||||
*/
|
widgets.makeUIDialog(function(path){
|
||||||
|
var that = this
|
||||||
|
var handlers_setup = false
|
||||||
|
return browse.makeLister(null, function(_, make){
|
||||||
|
var keys = Object.keys(that.changes || {})
|
||||||
|
if(keys.length == 0){
|
||||||
|
make.Empty('No changes...')
|
||||||
|
|
||||||
|
} else {
|
||||||
|
keys
|
||||||
|
.forEach(function(key){
|
||||||
|
make(key)
|
||||||
|
})
|
||||||
|
|
||||||
|
make('---')
|
||||||
|
make('Save', {
|
||||||
|
open: function(){
|
||||||
|
that.saveIndexHere
|
||||||
|
&& that.saveIndexHere()
|
||||||
|
},
|
||||||
|
close: function(){
|
||||||
|
that.off('markChanged', 'changes-dialog-updater')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if(!handlers_setup){
|
||||||
|
// XXX this needs to be triggered after save
|
||||||
|
// is done in a more universal way...
|
||||||
|
// ...also unbind on error/close...
|
||||||
|
// XXX need to clean this up in a better way...
|
||||||
|
// XXX this should also track .changes...
|
||||||
|
that.on('markChanged', 'changes-dialog-updater', function(){
|
||||||
|
make.dialog.update()
|
||||||
|
})
|
||||||
|
handlers_setup = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})],
|
||||||
})
|
})
|
||||||
|
|
||||||
var ExperimentFeature =
|
var ExperimentFeature =
|
||||||
@ -32,19 +79,11 @@ module.ExperimentFeature = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
tag: 'experiments',
|
tag: 'experiments',
|
||||||
|
|
||||||
isApplicable: function(actions){ return actions.experimental },
|
//isApplicable: function(actions){ return actions.experimental },
|
||||||
|
|
||||||
actions: ExperimentActions,
|
actions: ExperimentActions,
|
||||||
|
|
||||||
handlers: [
|
handlers: [
|
||||||
/* trying an argument mutation method... (FAILED: arguments is mutable)
|
|
||||||
['argumentMutation.pre',
|
|
||||||
function(a, b){
|
|
||||||
console.log('EVENT ARGS:', a, b)
|
|
||||||
arguments[0] += 1
|
|
||||||
arguments[1] += 1
|
|
||||||
}],
|
|
||||||
*/
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -173,8 +173,8 @@ core.ImageGridFeatures.Feature('imagegrid-testing', [
|
|||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------- testing ---
|
//----------------------------------------------------- testing ---
|
||||||
|
'experiments',
|
||||||
'-tests',
|
'-tests',
|
||||||
'-experiments',
|
|
||||||
|
|
||||||
// missing suggested feature test -- should show up in .features.missing...
|
// missing suggested feature test -- should show up in .features.missing...
|
||||||
'missing-feature',
|
'missing-feature',
|
||||||
|
|||||||
@ -1363,6 +1363,7 @@ var BrowseActionsActions = actions.Actions({
|
|||||||
'-70:$Help',
|
'-70:$Help',
|
||||||
'-80:---',
|
'-80:---',
|
||||||
'-90:Development',
|
'-90:Development',
|
||||||
|
'-90:Experimental',
|
||||||
'-90:Test',
|
'-90:Test',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user