Browse Source

fix annotations sort

j 2 weeks ago
parent
commit
111ea307a9
2 changed files with 9 additions and 16 deletions
  1. 8
    13
      static/js/annotationPanel.js
  2. 1
    3
      static/js/viewer.js

+ 8
- 13
static/js/annotationPanel.js View File

@@ -64,17 +64,6 @@ oml.ui.annotationPanel = function(options, self) {
64 64
         // borderColor: 'transparent',
65 65
         float: 'right'
66 66
     }).bindEvent({
67
-        change: function(data) {
68
-            if (data.id == 'showAnnotationUsers') {
69
-                var value = data.checked[0].id;
70
-                oml.UI.set('showAnnotationUsers', value);
71
-                oml.$ui.viewer.renderAnnotations();
72
-            } else if (data.id == 'sortAnnotations') {
73
-                var value = data.checked[0].id;
74
-                oml.UI.set('sortAnnotations', value);
75
-                oml.$ui.viewer.renderAnnotations();
76
-            }
77
-        },
78 67
         click: function(data) {
79 68
             var id = data.id;
80 69
             if (id == 'exportAnnotations') {
@@ -98,8 +87,14 @@ oml.ui.annotationPanel = function(options, self) {
98 87
         },
99 88
         change: function(data) {
100 89
             var id = data.id;
101
-            console.log('change', data)
102
-            if (id == 'show') {
90
+            if (data.id == 'showAnnotationUsers') {
91
+                var value = data.checked[0].id;
92
+                oml.UI.set('showAnnotationUsers', value);
93
+                oml.$ui.viewer.renderAnnotations();
94
+            } else if (data.id == 'sortAnnotations') {
95
+                var value = data.checked[0].id;
96
+                oml.UI.set('sortAnnotations', value);
97
+            } else if (id == 'show') {
103 98
                 console.log('show', data)
104 99
                 oml.UI.set({annotationsShow: data.checked[0].id});
105 100
             } else if (id == 'sort') {

+ 1
- 3
static/js/viewer.js View File

@@ -206,9 +206,6 @@ oml.ui.viewer = function() {
206 206
         if (sortKey == 'date') {
207 207
             sortKey = 'created'
208 208
         }
209
-        if (sortKey == 'date') {
210
-            sortKey = 'created'
211
-        }
212 209
         if (sortKey == 'quote') {
213 210
             sortKey = 'text'
214 211
         }
@@ -216,6 +213,7 @@ oml.ui.viewer = function() {
216 213
             loadAnnotations(function() {
217 214
                 that.renderAnnotations()
218 215
             })
216
+            return
219 217
         }
220 218
         annotations = Ox.sortBy(annotations, sortKey)
221 219
         oml.$ui.annotationFolder.empty();