mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +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
|
var that = this
|
||||||
|
|
||||||
if(method == 'reverse'){
|
if(method == 'reverse'){
|
||||||
method = []
|
method = 'update'
|
||||||
reverse = true
|
reverse = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,6 +703,11 @@ module.SortActions = actions.Actions({
|
|||||||
i = method.indexOf('reverse')
|
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...
|
// build the compare routine...
|
||||||
method = method
|
method = method
|
||||||
// remove duplicate methods...
|
// remove duplicate methods...
|
||||||
@ -714,6 +719,9 @@ module.SortActions = actions.Actions({
|
|||||||
|| (function(){
|
|| (function(){
|
||||||
var p = m.split(/\./g)
|
var p = m.split(/\./g)
|
||||||
var _get = function(obj){
|
var _get = function(obj){
|
||||||
|
if(obj == null){
|
||||||
|
return null
|
||||||
|
}
|
||||||
for(var i=0; i<p.length; i++){
|
for(var i=0; i<p.length; i++){
|
||||||
obj = obj[p[i]]
|
obj = obj[p[i]]
|
||||||
if(obj === undefined){
|
if(obj === undefined){
|
||||||
@ -777,8 +785,9 @@ module.SortActions = actions.Actions({
|
|||||||
.concat(this.data.manual_order ? ['Manual'] : [])},
|
.concat(this.data.manual_order ? ['Manual'] : [])},
|
||||||
// prevent setting 'none' as mode...
|
// prevent setting 'none' as mode...
|
||||||
function(mode){
|
function(mode){
|
||||||
return mode != 'none'
|
return !!this.images
|
||||||
|| (mode == 'Manual' && this.data.manual_order) },
|
&& (mode != 'none'
|
||||||
|
|| (mode == 'Manual' && this.data.manual_order)) },
|
||||||
function(mode){
|
function(mode){
|
||||||
// save manual order...
|
// save manual order...
|
||||||
if(this.data.sort_method == 'Manual'){
|
if(this.data.sort_method == 'Manual'){
|
||||||
|
|||||||
@ -72,7 +72,7 @@ module.Demo = core.ImageGridFeatures.Feature({
|
|||||||
function(){
|
function(){
|
||||||
this.load({
|
this.load({
|
||||||
data: data.Data(demo_data),
|
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...
|
// NOTE: of no data is defined this will not have any effect...
|
||||||
function makeTagTogglerAction(tag){
|
function makeTagTogglerAction(tag){
|
||||||
var t = function(target, action){
|
var t = function(target, action){
|
||||||
if(target == '?' || target == 'on' || target == 'off'){
|
if(target == '?' || target == '??'|| target == 'on' || target == 'off'){
|
||||||
var x = action
|
var x = action
|
||||||
action = target
|
action = target
|
||||||
target = x
|
target = x
|
||||||
@ -63,8 +63,17 @@ function makeTagTogglerAction(tag){
|
|||||||
this.untag(tag, target)
|
this.untag(tag, target)
|
||||||
var res = 'off'
|
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...
|
// next...
|
||||||
} else if(action != '?'){
|
} else {
|
||||||
var res = []
|
var res = []
|
||||||
var that = this
|
var that = this
|
||||||
target.forEach(function(t){
|
target.forEach(function(t){
|
||||||
@ -78,14 +87,6 @@ function makeTagTogglerAction(tag){
|
|||||||
})
|
})
|
||||||
res = res.length == 1 ? res[0] : res
|
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
|
return res
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user