diff --git a/source/Ox.UI/js/Form/Ox.ArrayEditable.js b/source/Ox.UI/js/Form/Ox.ArrayEditable.js index d312764b..cb854050 100644 --- a/source/Ox.UI/js/Form/Ox.ArrayEditable.js +++ b/source/Ox.UI/js/Form/Ox.ArrayEditable.js @@ -11,6 +11,7 @@ Ox.ArrayEditable = function(options, self) { tooltip: 'Doubleclick to add ' + (options.itemName || 'item') }, self) .defaults({ + clickLink: null, editable: true, itemName: 'item', items: [], @@ -118,6 +119,7 @@ Ox.ArrayEditable = function(options, self) { that.empty(); if (self.options.items.length == 0) { Ox.Editable({ + clickLink: self.options.clickLink, editable: false, type: 'text', value: self.options.placeholder @@ -135,6 +137,7 @@ Ox.ArrayEditable = function(options, self) { } self.$items[i] = Ox.Editable({ blurred: self.editing && i == self.selected ? blur : false, + clickLink: self.options.clickLink, editable: self.options.editable && item.editable, editing: self.editing && i == self.selected, /* diff --git a/source/Ox.UI/js/Form/Ox.Editable.js b/source/Ox.UI/js/Form/Ox.Editable.js index feef4c3b..fe568f69 100644 --- a/source/Ox.UI/js/Form/Ox.Editable.js +++ b/source/Ox.UI/js/Form/Ox.Editable.js @@ -43,11 +43,18 @@ Ox.Editable = function(options, self) { .bindEvent({ doubleclick: edit, singleclick: function(e) { - if ($(e.target).is('a')) { + var $target = $(e.target), + $parent = $target.parent(); + while(!$target.is('a') && !$parent.is('.OxEditableElement')) { + $target = $parent; + $parent = $target.parent(); + } + if($target.is('a')) { if (self.options.clickLink) { + e.target = $target[0]; self.options.clickLink(e); } else { - document.location.href = $(e.target).attr('href'); + document.location.href = $target.attr('href'); } } } diff --git a/source/Ox.UI/js/Video/Ox.AnnotationFolder.js b/source/Ox.UI/js/Video/Ox.AnnotationFolder.js index d33a6601..9107e751 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationFolder.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationFolder.js @@ -22,6 +22,7 @@ Ox.AnnotationFolder = function(options, self) { self = self || {}; var that = Ox.Element({}, self) .defaults({ + clickLink: null, collapsed: false, editable: false, id: '', @@ -127,7 +128,8 @@ Ox.AnnotationFolder = function(options, self) { }) .bindEvent({ select: function(data) { - if (!data.id && Ox.getObjectById(self.options.items, self.options.selected).event) { + Ox.print('SELECT >>> ', data) + if (!data.id && self.options.selected && Ox.getObjectById(self.options.items, self.options.selected).event) { // only deselect annotation if the event deselect was not // caused by switching to an annotation without event self.$annotations.options({selected: ''}); @@ -154,7 +156,7 @@ Ox.AnnotationFolder = function(options, self) { .bindEvent({ // FIXME: should be select, not selectplace selectplace: function(data) { - if (!data.id && Ox.getObjectById(self.options.items, self.options.selected).place) { + if (!data.id && self.options.selected && Ox.getObjectById(self.options.items, self.options.selected).place) { // only deselect annotation if the place deselect was not // caused by switching to an annotation without place self.$annotations.options({selected: ''}); @@ -189,6 +191,7 @@ Ox.AnnotationFolder = function(options, self) { } self.$annotations = Ox.ArrayEditable({ + clickLink: self.options.clickLink, editable: self.options.editable, items: self.annotations, placeholder: 'No ' + self.options.title, diff --git a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js index 3abf74ab..e29c428a 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js @@ -10,6 +10,7 @@ Ox.AnnotationPanel = function(options, self) { var that = Ox.Element({}, self) .defaults({ calendarSize: 256, + clickLink: null, editable: false, font: 'small', layers: [], @@ -149,6 +150,7 @@ Ox.AnnotationPanel = function(options, self) { selected = item ? item.id : ''; self.$folder[i] = Ox.AnnotationFolder( Ox.extend({ + clickLink: self.options.clickLink, collapsed: !self.options.showLayers[layer.id], editable: self.options.editable, font: self.options.font, diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index 565d16b6..102c97dc 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -25,6 +25,7 @@ Ox.VideoEditor = function(options, self) { annotationsSize: 256, annotationsSort: 'position', censored: [], + clickLink: null, cuts: [], duration: 0, enableSubtitles: false, @@ -595,6 +596,7 @@ Ox.VideoEditor = function(options, self) { self.$annotationPanel = Ox.AnnotationPanel({ calendarSize: self.options.annotationsCalendarSize, + clickLink: self.options.clickLink, editable: true, font: self.options.annotationsFont, 'in': self.options['in'], diff --git a/source/Ox.UI/js/Video/Ox.VideoPanel.js b/source/Ox.UI/js/Video/Ox.VideoPanel.js index 751fb689..3da086e8 100644 --- a/source/Ox.UI/js/Video/Ox.VideoPanel.js +++ b/source/Ox.UI/js/Video/Ox.VideoPanel.js @@ -21,6 +21,7 @@ Ox.VideoPanel = function(options, self) { annotationsSize: 256, annotationsSort: 'position', censored: [], + clickLink: null, cuts: [], duration: 0, enableSubtitles: false, @@ -168,6 +169,7 @@ Ox.VideoPanel = function(options, self) { self.$annotationPanel = Ox.AnnotationPanel({ calendarSize: self.options.annotationsCalendarSize, + clickLink: self.options.clickLink, editable: false, font: self.options.annotationsFont, 'in': self.options['in'],