undefined places/events
This commit is contained in:
parent
8bab6a9c0c
commit
2ce6b0af9a
1 changed files with 9 additions and 9 deletions
|
@ -169,7 +169,7 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
// FIXME: should be select, not selectplace
|
// FIXME: should be select, not selectplace
|
||||||
selectplace: function(data) {
|
selectplace: function(data) {
|
||||||
if (!data.id && self.options.selected && Ox.getObjectById(self.options.items, self.options.selected).place) {
|
if (!data.id && self.options.selected && Ox.getObjectById(self.options.items, self.options.selected).place.defined) {
|
||||||
// only deselect annotation if the place deselect was not
|
// only deselect annotation if the place deselect was not
|
||||||
// caused by switching to an annotation without place
|
// caused by switching to an annotation without place
|
||||||
self.$annotations.options({selected: ''});
|
self.$annotations.options({selected: ''});
|
||||||
|
@ -335,7 +335,7 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
function getEvents() {
|
function getEvents() {
|
||||||
var events = [];
|
var events = [];
|
||||||
self.annotations.filter(function(item) {
|
self.annotations.filter(function(item) {
|
||||||
return !!(item.event && item.event.defined);
|
return !!item.event.defined;
|
||||||
}).forEach(function(item) {
|
}).forEach(function(item) {
|
||||||
var index = Ox.getIndexById(events, item.event.id);
|
var index = Ox.getIndexById(events, item.event.id);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
|
@ -352,7 +352,7 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
function getPlaces() {
|
function getPlaces() {
|
||||||
var places = [];
|
var places = [];
|
||||||
self.annotations.filter(function(item) {
|
self.annotations.filter(function(item) {
|
||||||
return !!(item.place && item.place.defined);
|
return !!item.place.defined;
|
||||||
}).forEach(function(item) {
|
}).forEach(function(item) {
|
||||||
var index = Ox.getIndexById(places, item.place.id);
|
var index = Ox.getIndexById(places, item.place.id);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
|
@ -379,7 +379,7 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
self.editing = false;
|
self.editing = false;
|
||||||
if (self.widget) {
|
if (self.widget) {
|
||||||
item = Ox.getObjectById(self.options.items, data.id);
|
item = Ox.getObjectById(self.options.items, data.id);
|
||||||
if (item[self.options.type]) {
|
if (item[self.options.type].defined) {
|
||||||
if (self.options.type == 'event') {
|
if (self.options.type == 'event') {
|
||||||
self.$calendar.removeEvent(data.id);
|
self.$calendar.removeEvent(data.id);
|
||||||
} else {
|
} else {
|
||||||
|
@ -398,12 +398,12 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
if (self.widget) {
|
if (self.widget) {
|
||||||
if (self.options.type == 'event') {
|
if (self.options.type == 'event') {
|
||||||
self.$calendar.options({
|
self.$calendar.options({
|
||||||
selected: item && item.event ? item.event.id : ''
|
selected: item && item.event.defined ? item.event.id : ''
|
||||||
})
|
})
|
||||||
.panToEvent();
|
.panToEvent();
|
||||||
} else {
|
} else {
|
||||||
self.$map.options({
|
self.$map.options({
|
||||||
selected: item && item.place ? item.place.id : ''
|
selected: item && item.place.defined ? item.place.id : ''
|
||||||
})
|
})
|
||||||
.panToPlace();
|
.panToPlace();
|
||||||
}
|
}
|
||||||
|
@ -423,9 +423,9 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
// which is an EditableElement without .data('id')
|
// which is an EditableElement without .data('id')
|
||||||
if (
|
if (
|
||||||
$element.data('id')
|
$element.data('id')
|
||||||
&& !(Ox.getObjectById(
|
&& !Ox.getObjectById(
|
||||||
self.options.items, $element.data('id')
|
self.options.items, $element.data('id')
|
||||||
)[self.options.type] || {}).defined
|
)[self.options.type].defined
|
||||||
) {
|
) {
|
||||||
$element.addClass('OxWarning');
|
$element.addClass('OxWarning');
|
||||||
}
|
}
|
||||||
|
@ -578,7 +578,7 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
});
|
});
|
||||||
self.options.selected = item.id;
|
self.options.selected = item.id;
|
||||||
self.$annotations.options({selected: self.options.selected});
|
self.$annotations.options({selected: self.options.selected});
|
||||||
if (self.widget && item[self.options.type]) {
|
if (self.widget && item[self.options.type].defined) {
|
||||||
// if updating has made the item match
|
// if updating has made the item match
|
||||||
// an event or place, then select it
|
// an event or place, then select it
|
||||||
self.$widget.options({selected: item[self.options.type].id});
|
self.$widget.options({selected: item[self.options.type].id});
|
||||||
|
|
Loading…
Reference in a new issue