diff --git a/pandora/clip/managers.py b/pandora/clip/managers.py index eb7c6ca92..45e492b75 100644 --- a/pandora/clip/managers.py +++ b/pandora/clip/managers.py @@ -17,6 +17,7 @@ keymap = { 'place': 'annotations__places__id', 'text': 'findvalue', 'annotations': 'findvalue', + 'layer': 'annotations__layer', 'user': 'annotations__user__username', } case_insensitive_keys = ('annotations__user__username', ) diff --git a/pandora/clip/models.py b/pandora/clip/models.py index d9c141433..406f13dff 100644 --- a/pandora/clip/models.py +++ b/pandora/clip/models.py @@ -115,8 +115,7 @@ class MetaClip(object): del j[key] #needed here to make item find with clips work if 'annotations' in keys: - #annotations = self.annotations.filter(layer__in=settings.CONFIG['clipLayers']) - annotations = self.annotations.all() + annotations = self.annotations.all().exclude(value='') if qs: for q in qs: annotations = annotations.filter(q) diff --git a/pandora/config.pandora.jsonc b/pandora/config.pandora.jsonc index aaf7c4fa0..ac7f02434 100644 --- a/pandora/config.pandora.jsonc +++ b/pandora/config.pandora.jsonc @@ -102,8 +102,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution. ], /* "clipLayers" is the ordered list of public layers that will appear as the - text of clips (in grid view, below the icon). Excluding a layer from this - list means it will not be included in find annotations. + text of clips (in grid view, below the icon). */ "clipLayers": ["publicnotes", "keywords", "subtitles"], /* diff --git a/static/js/clipList.js b/static/js/clipList.js index 21b5af805..c623de09d 100644 --- a/static/js/clipList.js +++ b/static/js/clipList.js @@ -76,7 +76,14 @@ pandora.ui.clipList = function(videoRatio) { var itemsQuery, query; if (!ui.item) { itemsQuery = ui.find; - query = {conditions: [], operator: itemsQuery.operator}; + query = { + conditions: [{ + key: "layer", + operator: "&", + value: pandora.site.clipLayers + }], + operator: itemsQuery.operator + }; // if the item query contains a layer condition, // then this condition is added to the clip query addConditions(query, itemsQuery.conditions); @@ -99,13 +106,20 @@ pandora.ui.clipList = function(videoRatio) { operator: '&' }; query = { - conditions: ui.itemFind === '' ? [] : [{ - key: 'annotations', - value: ui.itemFind, - operator: '=' + conditions: [{ + key: "layer", + operator: "&", + value: pandora.site.clipLayers }], operator: '&' }; + if(ui.itemFind) { + query.conditions.push({ + key: 'annotations', + value: ui.itemFind, + operator: '=' + }) + } findClips(); } diff --git a/static/js/utils.js b/static/js/utils.js index 8f0286321..7bf3fa5e0 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -1265,6 +1265,25 @@ pandora.getClipsQuery = function(callback) { }; addClipsConditions(pandora.user.ui.find.conditions); clipsQuery.operator = clipsQuery.conditions.length ? '|' : '&'; + if (clipsQuery.conditions.length) { + clipsQuery.conditions = [ + { + key: "layer", + operator: "&", + value: pandora.site.clipLayers + }, { + conditions: clipsQuery.conditions, + operator: '|' + } + ] + clipsQuery.operator = '&' + } else { + clipsQuery.conditions.push({ + "key": "layer", + "operator": "&", + "value":pandora.site.clipLayers + }) + } if (callback) { if (pandora.user.ui._list) { pandora.api.getList({id: pandora.user.ui._list}, function(result) {