now updating gids will also update marks, bookmarks and tagss...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-02-03 07:37:42 +04:00
parent 5fcc0be02a
commit 285c40ff06
4 changed files with 28 additions and 5 deletions

View File

@ -178,6 +178,13 @@ function setupBookmarks(viewer){
bookmarksUpdated() bookmarksUpdated()
} }
}) })
.on('updatedImageGID', function(evt, was, is){
var i = BOOKMARKS.indexOf(was)
if(i >= 0){
BOOKMARKS[i] = is
bookmarksUpdated()
}
})
} }
SETUP_BINDINGS.push(setupBookmarks) SETUP_BINDINGS.push(setupBookmarks)

View File

@ -1158,11 +1158,6 @@ function readImagesDatesQ(images){
} }
// XXX deleting images is not sported, we need to explicitly re-save...
// XXX need to reload the viewer...
// XXX not tested...
// XXX need to also replace in MARKED, BOOKMARKS, ...
// ...and make it systematic...
function updateImageGID(gid, images, data){ function updateImageGID(gid, images, data){
gid = gid == null ? getImageGID() : gid gid = gid == null ? getImageGID() : gid
images = images == null ? IMAGES : images images = images == null ? IMAGES : images
@ -1204,6 +1199,8 @@ function updateImageGID(gid, images, data){
if(i.length > 0){ if(i.length > 0){
updateImage(i, gid) updateImage(i, gid)
} }
$('.viewer').trigger('updatedImageGID', [key, gid])
}) })
} }
function updateImagesGIDs(images, data){ function updateImagesGIDs(images, data){

View File

@ -804,6 +804,13 @@ function setupMarks(viewer){
marksUpdated() marksUpdated()
} }
}) })
.on('updatedImageGID', function(evt, was, is){
var i = MARKED.indexOf(was)
if(i >= 0){
MARKED[i] = is
marksUpdated()
}
})
} }
SETUP_BINDINGS.push(setupMarks) SETUP_BINDINGS.push(setupMarks)

View File

@ -558,6 +558,18 @@ function setupUnsortedTagHandler(viewer){
tagsUpdated() tagsUpdated()
} }
}) })
.on('updatedImageGID', function(evt, was, is){
var updated = false
for(var tag in TAGS){
var i = TAGS[tag].indexOf(was)
if(i >= 0){
TAGS[tag][i] = is
}
}
if(updated){
tagsUpdated()
}
})
} }
SETUP_BINDINGS.push(setupUnsortedTagHandler) SETUP_BINDINGS.push(setupUnsortedTagHandler)