mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
some refactoring to better link stuff together....
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2c58605dc1
commit
3cd74e216a
@ -50,6 +50,9 @@ var CLIActions = actions.Actions({
|
|||||||
function(path){
|
function(path){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
|
// XXX is this correct???
|
||||||
|
path = path || this.location.path
|
||||||
|
|
||||||
return this.loadImages(path)
|
return this.loadImages(path)
|
||||||
.then(function(){ return that.makePreviews('all') })
|
.then(function(){ return that.makePreviews('all') })
|
||||||
.then(function(){ return that.sortImages() })
|
.then(function(){ return that.sortImages() })
|
||||||
|
|||||||
@ -11,6 +11,7 @@ define(function(require){ var module = {}
|
|||||||
// XXX
|
// XXX
|
||||||
var DEBUG = typeof(DEBUG) != 'undefined' ? DEBUG : true
|
var DEBUG = typeof(DEBUG) != 'undefined' ? DEBUG : true
|
||||||
|
|
||||||
|
var object = require('lib/object')
|
||||||
var actions = require('lib/actions')
|
var actions = require('lib/actions')
|
||||||
var features = require('lib/features')
|
var features = require('lib/features')
|
||||||
var toggler = require('lib/toggler')
|
var toggler = require('lib/toggler')
|
||||||
@ -57,10 +58,19 @@ function(attr, states, a, b){
|
|||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
// Root ImageGrid.viewer object...
|
// Root ImageGrid.viewer object constructor...
|
||||||
//
|
//
|
||||||
|
var ImageGrid = object.makeConstructor('ImageGrid', actions.MetaActions)
|
||||||
|
|
||||||
|
// Root ImageGrid feature set....
|
||||||
var ImageGridFeatures =
|
var ImageGridFeatures =
|
||||||
module.ImageGridFeatures = Object.create(features.FeatureSet)
|
module.ImageGridFeatures = new features.FeatureSet()
|
||||||
|
|
||||||
|
// setup base instance constructor...
|
||||||
|
ImageGridFeatures.__actions__ = function(){
|
||||||
|
return actions.Actions(ImageGrid())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|||||||
@ -1202,10 +1202,15 @@ module.MetaActions = {
|
|||||||
if(this.__proto__.config && !Object.hasOwnProperty(this, 'config')){
|
if(this.__proto__.config && !Object.hasOwnProperty(this, 'config')){
|
||||||
this.config = Object.create(this.__proto__.config)
|
this.config = Object.create(this.__proto__.config)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var ActionSet =
|
||||||
|
module.ActionSet =
|
||||||
|
object.makeConstructor('ActionSet', MetaActions)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// An action set...
|
// An action set...
|
||||||
//
|
//
|
||||||
@ -1249,13 +1254,12 @@ module.MetaActions = {
|
|||||||
//
|
//
|
||||||
// XXX add doc, ldoc, tags and save them to each action...
|
// XXX add doc, ldoc, tags and save them to each action...
|
||||||
// XXX is .config processing correct here???
|
// XXX is .config processing correct here???
|
||||||
// XXX should this be a full fledged object???
|
|
||||||
var Actions =
|
var Actions =
|
||||||
module.Actions =
|
module.Actions =
|
||||||
function Actions(a, b){
|
function Actions(a, b){
|
||||||
var obj = b == null ? a : b
|
var obj = b == null ? a : b
|
||||||
var proto = b == null ? MetaActions : a
|
var proto = b == null ? b : a
|
||||||
obj = obj || {}
|
obj = obj || new ActionSet()
|
||||||
|
|
||||||
// NOTE: this is intentionally done only for own attributes...
|
// NOTE: this is intentionally done only for own attributes...
|
||||||
Object.keys(obj).forEach(function(k){
|
Object.keys(obj).forEach(function(k){
|
||||||
|
|||||||
@ -11,6 +11,7 @@ define(function(require){ var module = {}
|
|||||||
var args2array = require('lib/util').args2array
|
var args2array = require('lib/util').args2array
|
||||||
|
|
||||||
var actions = require('lib/actions')
|
var actions = require('lib/actions')
|
||||||
|
var object = require('lib/object')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -231,9 +232,9 @@ Feature.prototype = FeatureProto
|
|||||||
Feature.prototype.constructor = Feature
|
Feature.prototype.constructor = Feature
|
||||||
|
|
||||||
|
|
||||||
var FeatureSet =
|
var FeatureSetProto = {
|
||||||
module.FeatureSet = {
|
|
||||||
__feature__: Feature,
|
__feature__: Feature,
|
||||||
|
__actions__: actions.Actions,
|
||||||
|
|
||||||
// if true, .setup(..) will report things it's doing...
|
// if true, .setup(..) will report things it's doing...
|
||||||
__verbose__: null,
|
__verbose__: null,
|
||||||
@ -582,7 +583,8 @@ module.FeatureSet = {
|
|||||||
obj = null
|
obj = null
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = obj || actions.Actions()
|
obj = obj || (this.__actions__ || actions.Actions)()
|
||||||
|
|
||||||
lst = lst.constructor !== Array ? [lst] : lst
|
lst = lst.constructor !== Array ? [lst] : lst
|
||||||
var features = this.buildFeatureList(obj, lst)
|
var features = this.buildFeatureList(obj, lst)
|
||||||
lst = features.features
|
lst = features.features
|
||||||
@ -658,10 +660,15 @@ module.FeatureSet = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var FeatureSet =
|
||||||
|
module.FeatureSet = object.makeConstructor('FeatureSet', FeatureSetProto)
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
var Features =
|
var Features =
|
||||||
module.Features = Object.create(FeatureSet)
|
module.Features = new FeatureSet()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user