honor layer showInfo flag and display creator as part of tooltip (fixes #332)

This commit is contained in:
rlx 2012-02-05 11:08:56 +00:00
parent ed150f21f5
commit 89a3a119da
4 changed files with 33 additions and 27 deletions

View file

@ -21,6 +21,7 @@ Ox.ArrayEditable = function(options, self) {
separator: ',', separator: ',',
sort: [], sort: [],
submitOnBlur: true, submitOnBlur: true,
tooltip: '',
type: 'input', type: 'input',
width: 256 width: 256
}) })
@ -117,8 +118,14 @@ Ox.ArrayEditable = function(options, self) {
highlight: self.options.highlight, highlight: self.options.highlight,
maxHeight: self.options.maxHeight, maxHeight: self.options.maxHeight,
submitOnBlur: self.options.submitOnBlur, submitOnBlur: self.options.submitOnBlur,
tooltip: 'Click to select' + ( tooltip: (
item.editable ? ', doubleclick to edit' : '' self.options.tooltipText
? Ox.formatString(self.options.tooltipText, item) + '<br>'
: ''
) + 'Click to select' + (
item.editable
? ', doubleclick to edit'
: ''
), ),
type: self.options.type, type: self.options.type,
value: item.value, value: item.value,

View file

@ -34,6 +34,7 @@ Ox.AnnotationFolder = function(options, self) {
position: 0, position: 0,
range: 'all', range: 'all',
selected: '', selected: '',
showInfo: false,
showWidget: false, showWidget: false,
sort: 'position', sort: 'position',
title: '', title: '',
@ -225,6 +226,7 @@ Ox.AnnotationFolder = function(options, self) {
separator: ';', separator: ';',
sort: self.sort, sort: self.sort,
submitOnBlur: false, submitOnBlur: false,
tooltipText: self.options.showInfo ? '<b>{user}</b>, {modified}' : '',
width: self.options.width, width: self.options.width,
maxHeight: self.options.type == 'text' ? Infinity : void 0, maxHeight: self.options.type == 'text' ? Infinity : void 0,
type: self.options.type == 'text' ? 'textarea' : 'input' type: self.options.type == 'text' ? 'textarea' : 'input'
@ -327,7 +329,7 @@ Ox.AnnotationFolder = function(options, self) {
} }
function getAnnotations() { function getAnnotations() {
return self.options.items.filter(function(item) { return Ox.map(self.options.items, function(item) {
return self.editing && item.id == self.options.selected || ( return self.editing && item.id == self.options.selected || (
( (
self.options.range == 'all' || ( self.options.range == 'all' || (
@ -343,7 +345,9 @@ Ox.AnnotationFolder = function(options, self) {
self.options.users == 'all' self.options.users == 'all'
|| self.options.users.indexOf(item.user) > -1 || self.options.users.indexOf(item.user) > -1
) )
); ) ? Ox.extend({
date: Ox.formatDate(item.modified.substr(0, 10), '%B %e, %Y')
}, item) : null;
}); });
} }

View file

@ -261,7 +261,6 @@ Ox.AnnotationPanel = function(options, self) {
} }
function scrollToSelected(type) { function scrollToSelected(type) {
//try {
var $item = that.find('.OxEditableElement.OxSelected'), var $item = that.find('.OxEditableElement.OxSelected'),
itemHeight = $item.height() + (type == 'text' ? 8 : 0), itemHeight = $item.height() + (type == 'text' ? 8 : 0),
itemTop = $item.offset().top, itemTop = $item.offset().top,
@ -279,9 +278,6 @@ Ox.AnnotationPanel = function(options, self) {
scrollTop: scrollTop + 'px' scrollTop: scrollTop + 'px'
}, 0); }, 0);
} }
//} catch(e) {
// Ox.print('THIS SHOULD NOT HAPPEN');
//}
} }
function selectAnnotation(data, index) { function selectAnnotation(data, index) {

View file

@ -181,9 +181,8 @@ Ox.VideoEditor = function(options, self) {
} }
}); });
Ox.loop(1, self.options.layers.length + 1, function(i) { self.options.layers.forEach(function(layer, i) {
that.bindEvent('key_' + i, function() { that.bindEvent('key_' + (i + 1), function() {
var layer = self.options.layers[i - 1];
layer.editable layer.editable
? addAnnotation(layer.id) ? addAnnotation(layer.id)
: that.triggerEvent('info', {layer: layer.id}); : that.triggerEvent('info', {layer: layer.id});