only show clipLayer clips in clips view

This commit is contained in:
j 2024-05-17 14:01:16 +02:00
parent 8e32737776
commit cf0ad718f7
5 changed files with 41 additions and 9 deletions

View file

@ -17,6 +17,7 @@ keymap = {
'place': 'annotations__places__id', 'place': 'annotations__places__id',
'text': 'findvalue', 'text': 'findvalue',
'annotations': 'findvalue', 'annotations': 'findvalue',
'layer': 'annotations__layer',
'user': 'annotations__user__username', 'user': 'annotations__user__username',
} }
case_insensitive_keys = ('annotations__user__username', ) case_insensitive_keys = ('annotations__user__username', )

View file

@ -115,8 +115,7 @@ class MetaClip(object):
del j[key] del j[key]
#needed here to make item find with clips work #needed here to make item find with clips work
if 'annotations' in keys: if 'annotations' in keys:
#annotations = self.annotations.filter(layer__in=settings.CONFIG['clipLayers']) annotations = self.annotations.all().exclude(value='')
annotations = self.annotations.all()
if qs: if qs:
for q in qs: for q in qs:
annotations = annotations.filter(q) annotations = annotations.filter(q)

View file

@ -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 "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 text of clips (in grid view, below the icon).
list means it will not be included in find annotations.
*/ */
"clipLayers": ["publicnotes", "keywords", "subtitles"], "clipLayers": ["publicnotes", "keywords", "subtitles"],
/* /*

View file

@ -76,7 +76,14 @@ pandora.ui.clipList = function(videoRatio) {
var itemsQuery, query; var itemsQuery, query;
if (!ui.item) { if (!ui.item) {
itemsQuery = ui.find; 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, // if the item query contains a layer condition,
// then this condition is added to the clip query // then this condition is added to the clip query
addConditions(query, itemsQuery.conditions); addConditions(query, itemsQuery.conditions);
@ -99,13 +106,20 @@ pandora.ui.clipList = function(videoRatio) {
operator: '&' operator: '&'
}; };
query = { query = {
conditions: ui.itemFind === '' ? [] : [{ conditions: [{
key: 'annotations', key: "layer",
value: ui.itemFind, operator: "&",
operator: '=' value: pandora.site.clipLayers
}], }],
operator: '&' operator: '&'
}; };
if(ui.itemFind) {
query.conditions.push({
key: 'annotations',
value: ui.itemFind,
operator: '='
})
}
findClips(); findClips();
} }

View file

@ -1265,6 +1265,25 @@ pandora.getClipsQuery = function(callback) {
}; };
addClipsConditions(pandora.user.ui.find.conditions); addClipsConditions(pandora.user.ui.find.conditions);
clipsQuery.operator = clipsQuery.conditions.length ? '|' : '&'; 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 (callback) {
if (pandora.user.ui._list) { if (pandora.user.ui._list) {
pandora.api.getList({id: pandora.user.ui._list}, function(result) { pandora.api.getList({id: pandora.user.ui._list}, function(result) {