mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
fixed a bug in mark/bookmark + some work on sorting with empty .images (not yet happy with this)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
121d9d7e8c
commit
2f32dda3ed
@ -665,7 +665,7 @@ module.SortActions = actions.Actions({
|
||||
var that = this
|
||||
|
||||
if(method == 'reverse'){
|
||||
method = []
|
||||
method = 'update'
|
||||
reverse = true
|
||||
}
|
||||
|
||||
@ -703,6 +703,11 @@ module.SortActions = actions.Actions({
|
||||
i = method.indexOf('reverse')
|
||||
}
|
||||
|
||||
// can't sort if we know nothing about .images
|
||||
if(method && method.length > 0 && (!this.images || this.images.length == 0)){
|
||||
return
|
||||
}
|
||||
|
||||
// build the compare routine...
|
||||
method = method
|
||||
// remove duplicate methods...
|
||||
@ -714,6 +719,9 @@ module.SortActions = actions.Actions({
|
||||
|| (function(){
|
||||
var p = m.split(/\./g)
|
||||
var _get = function(obj){
|
||||
if(obj == null){
|
||||
return null
|
||||
}
|
||||
for(var i=0; i<p.length; i++){
|
||||
obj = obj[p[i]]
|
||||
if(obj === undefined){
|
||||
@ -777,8 +785,9 @@ module.SortActions = actions.Actions({
|
||||
.concat(this.data.manual_order ? ['Manual'] : [])},
|
||||
// prevent setting 'none' as mode...
|
||||
function(mode){
|
||||
return mode != 'none'
|
||||
|| (mode == 'Manual' && this.data.manual_order) },
|
||||
return !!this.images
|
||||
&& (mode != 'none'
|
||||
|| (mode == 'Manual' && this.data.manual_order)) },
|
||||
function(mode){
|
||||
// save manual order...
|
||||
if(this.data.sort_method == 'Manual'){
|
||||
|
||||
@ -72,7 +72,7 @@ module.Demo = core.ImageGridFeatures.Feature({
|
||||
function(){
|
||||
this.load({
|
||||
data: data.Data(demo_data),
|
||||
images: images.Images(data),
|
||||
images: images.Images(),
|
||||
})
|
||||
}],
|
||||
})
|
||||
|
||||
@ -34,7 +34,7 @@ var base = require('features/base')
|
||||
// NOTE: of no data is defined this will not have any effect...
|
||||
function makeTagTogglerAction(tag){
|
||||
var t = function(target, action){
|
||||
if(target == '?' || target == 'on' || target == 'off'){
|
||||
if(target == '?' || target == '??'|| target == 'on' || target == 'off'){
|
||||
var x = action
|
||||
action = target
|
||||
target = x
|
||||
@ -63,8 +63,17 @@ function makeTagTogglerAction(tag){
|
||||
this.untag(tag, target)
|
||||
var res = 'off'
|
||||
|
||||
// ?
|
||||
} else if(action == '?'){
|
||||
var res = this.data.toggleTag(tag, target, '?')
|
||||
res = res.length == 1 ? res[0] : res
|
||||
|
||||
// ??
|
||||
} else if(action == '??'){
|
||||
res = ['on', 'off']
|
||||
|
||||
// next...
|
||||
} else if(action != '?'){
|
||||
} else {
|
||||
var res = []
|
||||
var that = this
|
||||
target.forEach(function(t){
|
||||
@ -78,14 +87,6 @@ function makeTagTogglerAction(tag){
|
||||
})
|
||||
res = res.length == 1 ? res[0] : res
|
||||
|
||||
// ?
|
||||
} else if(action == '?'){
|
||||
var res = this.data.toggleTag(tag, target, '?')
|
||||
res = res.length == 1 ? res[0] : res
|
||||
|
||||
// ??
|
||||
} else if(action == '?'){
|
||||
res = ['on', 'off']
|
||||
}
|
||||
|
||||
return res
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user