From bb563c1d82d8e1be9ddb804ee2e47a609ad588b0 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 13 Nov 2018 12:06:24 +0000 Subject: [PATCH 1/3] dereference annotation --- pandora/edit/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandora/edit/views.py b/pandora/edit/views.py index 12d623c0..57abed30 100644 --- a/pandora/edit/views.py +++ b/pandora/edit/views.py @@ -118,6 +118,12 @@ def editClip(request, data): clip.item = clip.annotation.item clip.annotation = None setattr(clip, {'in': 'start', 'out': 'end'}.get(key), float(data[key])) + if 'annotation' in data and not data['annotation']: + if clip.annotation: + clip.start = clip.annotation.start + clip.end = clip.annotation.end + clip.item = clip.annotation.item + clip.annotation = None if 'volume' in data: clip.volume = float(data['volume']) if not clip.annotation: From bfb1f95bd5c8d6ed0f7ba733aa0d3c338539e4fa Mon Sep 17 00:00:00 2001 From: j Date: Tue, 13 Nov 2018 15:26:24 +0000 Subject: [PATCH 2/3] autocomplete keywords --- pandora/config.pandora.jsonc | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora/config.pandora.jsonc b/pandora/config.pandora.jsonc index 5b1b6434..90e97086 100644 --- a/pandora/config.pandora.jsonc +++ b/pandora/config.pandora.jsonc @@ -594,6 +594,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution. "id": "keywords", "title": "Keywords", "type": "layer", + "autocomplete": true, "filter": true, "find": true }, From 475a784da55200eba89dd48aaf256c85a1676942 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 13 Nov 2018 15:29:15 +0000 Subject: [PATCH 3/3] use autocomplete in filter form --- static/js/filterForm.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/static/js/filterForm.js b/static/js/filterForm.js index 7d145473..483b82c8 100644 --- a/static/js/filterForm.js +++ b/static/js/filterForm.js @@ -29,6 +29,7 @@ pandora.ui.filterForm = function(options) { if (key.format && key.format.type == 'ColorPercent') { key.format.type = 'percent'; } + key.autocomplete = autocompleteFunction(key) return key; }).concat([{ id: 'list', @@ -70,6 +71,24 @@ pandora.ui.filterForm = function(options) { that.getList = that.$filter.getList; that.value = that.$filter.value; }); + function autocompleteFunction(key) { + return key.autocomplete ? function(value, callback) { + pandora.api.autocomplete({ + key: key.id, + query: { + conditions: [], + operator: '&' + }, + range: [0, 100], + sort: key.autocompleteSort, + value: value + }, function(result) { + callback(result.data.items.map(function(item) { + return Ox.decodeHTMLEntities(item); + })); + }); + } : null; + } that.updateResults = function() { if (mode == 'list') { Ox.Request.clearCache(list.id);