diff --git a/ui/keybindings.js b/ui/keybindings.js index 051f99e7..fdb6f4fc 100755 --- a/ui/keybindings.js +++ b/ui/keybindings.js @@ -616,6 +616,8 @@ var KEYBOARD_CONFIG = { // marking... ctrl: 'invert-marks', }, + // XXX this is not permanent... + C: doc('Edit image comment', imageCommentDialog), P: { default: doc('Show options', function(){ toggleOptionsUI() }), diff --git a/ui/ui.js b/ui/ui.js index 26c77c58..b2984037 100755 --- a/ui/ui.js +++ b/ui/ui.js @@ -382,6 +382,7 @@ var FIELD_TYPES = { // format: // string // XXX add datalist option... + // XXX make this textarea compatible... text: { type: 'text', text: null, @@ -962,6 +963,7 @@ function sortImagesDialog(message){ } +// XXX get EXIF... function showImageInfo(){ var gid = getImageGID(getImage()) var r = getRibbonIndex(getRibbon()) @@ -972,6 +974,8 @@ function showImageInfo(){ flipped = flipped == null ? '' : ', flipped '+flipped+'ly' var order = DATA.order.indexOf(gid) var name = data.path.split('/').pop() + var comment = data.comment + comment = comment == null ? '' : comment alert('
'+ '

"'+ name +'"

'+ @@ -984,11 +988,37 @@ function showImageInfo(){ 'Position (ribbon): '+ (DATA.ribbons[r].indexOf(gid)+1) + '/'+ DATA.ribbons[r].length +''+ 'Position (global): '+ (order+1) +'/'+ DATA.order.length +''+ + '
'+ + 'Comment: '+ comment +''+ ''+ '
') } +// XXX use a text area instead of a text field... +function imageCommentDialog(){ + var gid = getImageGID() + var data = IMAGES[gid] + var name = data.path.split('/').pop().split('.')[0] + var comment = data.comment + comment = comment == null ? '' : comment + + return formDialog(null, name +' Comment:', + {'': comment}, + 'Save', + 'imageCommentDialog') + .done(function(res){ + comment = res[''] + if(comment.trim() == ''){ + delete data.comment + } else { + data.comment = comment + } + IMAGES_UPDATED.push(gid) + }) +} + + /********************************************************************** * vim:set ts=4 sw=4 nowrap : */