fix annotations sort

This commit is contained in:
j 2019-03-05 18:31:21 +01:00
parent 349383ff39
commit 111ea307a9
2 changed files with 9 additions and 16 deletions

View file

@ -64,17 +64,6 @@ oml.ui.annotationPanel = function(options, self) {
// borderColor: 'transparent', // borderColor: 'transparent',
float: 'right' float: 'right'
}).bindEvent({ }).bindEvent({
change: function(data) {
if (data.id == 'showAnnotationUsers') {
var value = data.checked[0].id;
oml.UI.set('showAnnotationUsers', value);
oml.$ui.viewer.renderAnnotations();
} else if (data.id == 'sortAnnotations') {
var value = data.checked[0].id;
oml.UI.set('sortAnnotations', value);
oml.$ui.viewer.renderAnnotations();
}
},
click: function(data) { click: function(data) {
var id = data.id; var id = data.id;
if (id == 'exportAnnotations') { if (id == 'exportAnnotations') {
@ -98,8 +87,14 @@ oml.ui.annotationPanel = function(options, self) {
}, },
change: function(data) { change: function(data) {
var id = data.id; var id = data.id;
console.log('change', data) if (data.id == 'showAnnotationUsers') {
if (id == 'show') { var value = data.checked[0].id;
oml.UI.set('showAnnotationUsers', value);
oml.$ui.viewer.renderAnnotations();
} else if (data.id == 'sortAnnotations') {
var value = data.checked[0].id;
oml.UI.set('sortAnnotations', value);
} else if (id == 'show') {
console.log('show', data) console.log('show', data)
oml.UI.set({annotationsShow: data.checked[0].id}); oml.UI.set({annotationsShow: data.checked[0].id});
} else if (id == 'sort') { } else if (id == 'sort') {

View file

@ -206,9 +206,6 @@ oml.ui.viewer = function() {
if (sortKey == 'date') { if (sortKey == 'date') {
sortKey = 'created' sortKey = 'created'
} }
if (sortKey == 'date') {
sortKey = 'created'
}
if (sortKey == 'quote') { if (sortKey == 'quote') {
sortKey = 'text' sortKey = 'text'
} }
@ -216,6 +213,7 @@ oml.ui.viewer = function() {
loadAnnotations(function() { loadAnnotations(function() {
that.renderAnnotations() that.renderAnnotations()
}) })
return
} }
annotations = Ox.sortBy(annotations, sortKey) annotations = Ox.sortBy(annotations, sortKey)
oml.$ui.annotationFolder.empty(); oml.$ui.annotationFolder.empty();