clenup and tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-03-26 04:01:13 +03:00
parent a3988a95fb
commit 06e009b72c
2 changed files with 31 additions and 8 deletions

View File

@ -21,6 +21,7 @@ define(function(require){ var module = {}
var util = require('lib/util') var util = require('lib/util')
var toggler = require('lib/toggler') var toggler = require('lib/toggler')
var tasks = require('lib/tasks') var tasks = require('lib/tasks')
var keyboard = require('lib/keyboard')
var actions = require('lib/actions') var actions = require('lib/actions')
var core = require('features/core') var core = require('features/core')
@ -337,6 +338,7 @@ var MetadataUIActions = actions.Actions({
]) ])
} }
// fields that expect that image data is available... // fields that expect that image data is available...
var info = ['---']
if(img){ if(img){
// XXX should these be here??? // XXX should these be here???
var _normalize = typeof(path) != 'undefined' ? var _normalize = typeof(path) != 'undefined' ?
@ -357,8 +359,14 @@ var MetadataUIActions = actions.Actions({
['Full Path: ', ['Full Path: ',
_normalize((img.base_path || '.') +'/'+ img.path)], _normalize((img.base_path || '.') +'/'+ img.path)],
]) ])
// comment and tags...
info.push(['Comment',
function(){ return img.comment || '' }])
} }
info.push(['Tags',
function(){ return that.data.getTags().join(', ') || '' }])
// build fields... // build fields...
var fields = [] var fields = []
@ -387,13 +395,15 @@ var MetadataUIActions = actions.Actions({
fields.sort(_cmp) fields.sort(_cmp)
// add separator to base... // add separator to base...
fields.length > 0 && base.push('---') fields.length > 0 && info.push('---')
// XXX might be a good idea to directly bind ctrl-c to copy value... // XXX might be a good idea to directly bind ctrl-c to copy value...
var o = overlay.Overlay(this.ribbons.viewer, var o = overlay.Overlay(this.ribbons.viewer,
browse.makeList( browse.makeList(
null, null,
base.concat(fields), base
.concat(info)
.concat(fields),
{ {
showDisabled: false, showDisabled: false,
}) })
@ -421,12 +431,22 @@ var MetadataUIActions = actions.Actions({
elem elem
.prop('contenteditable', true) .prop('contenteditable', true)
.focus() .focus()
/* .keydown(function(){
.one('blur', function(){ event.stopPropagation()
$(this)
.prop('contenteditable', false) var n = keyboard.toKeyName(event.keyCode)
// reset to original value...
if(n == 'Esc'){
// XXX
// save value...
} else if(n == 'Enter' && event.ctrlKey){
event.preventDefault()
// XXX
}
}) })
*/
} }
})) }))
.close(function(){ .close(function(){

View File

@ -721,6 +721,8 @@ var BrowserPrototype = {
// If an item is a function it is called // If an item is a function it is called
// and the returned value is treated as // and the returned value is treated as
// the text. // the text.
// NOTE: empty strings will get replaced
// with &nbsp;
// - DOM/jQuery - an element to be used as an item // - DOM/jQuery - an element to be used as an item
// //
// Both traversable and disabled are optional and can take bool // Both traversable and disabled are optional and can take bool
@ -894,7 +896,8 @@ var BrowserPrototype = {
p = $(p.map(function(t){ p = $(p.map(function(t){
return $('<span>') return $('<span>')
.addClass('text') .addClass('text')
.text(t)[0] // here we also replace empty strings with &nbsp;...
[t ? 'text' : 'html'](t || '&nbsp;')[0]
})) }))
// jQuery or dom... // jQuery or dom...