mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
more refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
fed78ba0e9
commit
d8141e0aab
@ -286,6 +286,32 @@ module.LifeCycle = ImageGridFeatures.Feature({
|
||||
})
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
var UtilActions = actions.Actions({
|
||||
mergeConfig: ['- System/',
|
||||
function(config){
|
||||
config = config instanceof Function ? config.call(this)
|
||||
: typeof(config) == typeof('str') ? this.config[config]
|
||||
: config
|
||||
var that = this
|
||||
Object.keys(config).forEach(function(key){
|
||||
that.config[key] = config[key]
|
||||
})
|
||||
}],
|
||||
})
|
||||
|
||||
|
||||
var Util =
|
||||
module.Util = ImageGridFeatures.Feature({
|
||||
title: '',
|
||||
doc: '',
|
||||
|
||||
tag: 'util',
|
||||
|
||||
actions: UtilActions,
|
||||
})
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Introspection...
|
||||
@ -349,10 +375,10 @@ module.makeWorkspaceConfigWriter = function(keys, callback){
|
||||
return function(workspace){
|
||||
var that = this
|
||||
|
||||
keys = typeof(keys) == typeof(function(){}) ? keys.call(this) : keys
|
||||
var data = keys instanceof Function ? keys.call(this) : keys
|
||||
|
||||
// store data...
|
||||
keys.forEach(function(key){
|
||||
data.forEach(function(key){
|
||||
workspace[key] = JSON.parse(JSON.stringify(that.config[key]))
|
||||
})
|
||||
|
||||
@ -368,10 +394,10 @@ module.makeWorkspaceConfigLoader = function(keys, callback){
|
||||
return function(workspace){
|
||||
var that = this
|
||||
|
||||
keys = typeof(keys) == typeof(function(){}) ? keys.call(this) : keys
|
||||
var data = keys instanceof Function ? keys.call(this) : keys
|
||||
|
||||
// load data...
|
||||
keys.forEach(function(key){
|
||||
data.forEach(function(key){
|
||||
// the key exists...
|
||||
if(key in workspace){
|
||||
that.config[key] = JSON.parse(JSON.stringify(workspace[key]))
|
||||
@ -401,16 +427,12 @@ var WorkspaceActions = actions.Actions({
|
||||
},
|
||||
|
||||
get workspace(){
|
||||
return this.config.workspace
|
||||
},
|
||||
return this.config.workspace },
|
||||
set workspace(value){
|
||||
this.loadWorkspace(value)
|
||||
},
|
||||
this.loadWorkspace(value) },
|
||||
|
||||
get workspaces(){
|
||||
return this.config.workspaces
|
||||
},
|
||||
|
||||
return this.config.workspaces },
|
||||
|
||||
getWorkspace: ['- Workspace/',
|
||||
function(){ return this.saveWorkspace(null) }],
|
||||
|
||||
@ -412,6 +412,9 @@ module.PartialRibbons = core.ImageGridFeatures.Feature({
|
||||
|
||||
//this.preCacheJumpTargets()
|
||||
}],
|
||||
|
||||
|
||||
|
||||
],
|
||||
})
|
||||
|
||||
|
||||
@ -246,15 +246,8 @@ var SingleImageActions = actions.Actions({
|
||||
|
||||
if(this.workspaces['single-image'] == null){
|
||||
this.loadWorkspace('ui-chrome-hidden')
|
||||
|
||||
// setup defaults...
|
||||
var that = this
|
||||
var defaults = this.config['single-image-config-defaults'] || {}
|
||||
Object.keys(defaults)
|
||||
.forEach(function(key){
|
||||
that.config[key] = JSON.parse(JSON.stringify(defaults[key])) })
|
||||
|
||||
this.saveWorkspace('single-image')
|
||||
this.mergeConfig('single-image-config-defaults')
|
||||
this.saveWorkspace('single-image')
|
||||
}
|
||||
|
||||
this.loadWorkspace('single-image')
|
||||
@ -333,7 +326,8 @@ module.SingleImageView = core.ImageGridFeatures.Feature({
|
||||
|
||||
tag: 'ui-single-image',
|
||||
depends: [
|
||||
'ui'
|
||||
'ui',
|
||||
'util',
|
||||
],
|
||||
suggested: [
|
||||
'ui-single-image-local-storage',
|
||||
@ -434,12 +428,16 @@ module.SingleImageView = core.ImageGridFeatures.Feature({
|
||||
|
||||
// Workspace...
|
||||
// ...set ribbon focus mode to order (default) in single image mode...
|
||||
//
|
||||
// XXX move these to ui-partial-ribbons???
|
||||
['saveWorkspace',
|
||||
core.makeWorkspaceConfigWriter(
|
||||
Object.keys(SingleImageActions.config['single-image-config-defaults']))],
|
||||
function(){
|
||||
return Object.keys(this.config['single-image-config-defaults'] || {}) })],
|
||||
['loadWorkspace',
|
||||
core.makeWorkspaceConfigLoader(
|
||||
Object.keys(SingleImageActions.config['single-image-config-defaults']),
|
||||
function(){
|
||||
return Object.keys(this.config['single-image-config-defaults'] || {}) },
|
||||
// NOTE: considering that 'ribbon-focus-mode' is handled
|
||||
// by a toggler that can have things bound to it,
|
||||
// active is the way to go here...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user