added experimental image commenting, still not full implemented...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-09-09 15:56:39 +04:00
parent 3fbb161de6
commit d020318fe7
2 changed files with 32 additions and 0 deletions

View File

@ -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() }),

View File

@ -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('<div>'+
'<h2>"'+ name +'"</h2>'+
@ -984,11 +988,37 @@ function showImageInfo(){
'<tr><td>Position (ribbon): </td><td>'+ (DATA.ribbons[r].indexOf(gid)+1) +
'/'+ DATA.ribbons[r].length +'</td></tr>'+
'<tr><td>Position (global): </td><td>'+ (order+1) +'/'+ DATA.order.length +'</td></tr>'+
'<tr><td colspan="2"><hr></td></tr>'+
'<tr><td>Comment: </td><td class="comment">'+ comment +'</td></tr>'+
'</table>'+
'</div>')
}
// 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 : */