fix view with clips
This commit is contained in:
parent
289e47fa5b
commit
b4cc3621ff
4 changed files with 17 additions and 11 deletions
|
@ -567,11 +567,13 @@ class Item(models.Model):
|
|||
elif i == 'filename':
|
||||
save(i,
|
||||
'\n'.join([f.path for f in self.files.all()]))
|
||||
elif key['id'] == 'annotations':
|
||||
qs = Annotation.objects.filter(item=self)
|
||||
qs = qs.filter(layer__in=Annotation.public_layers())
|
||||
qs = qs.order_by('start')
|
||||
save(i, u'\n'.join([l.findvalue for l in qs]))
|
||||
elif key['type'] == 'layer':
|
||||
qs = Annotation.objects.filter(item=self)
|
||||
if i == 'annotations':
|
||||
qs = qs.filter(layer__in=Annotation.public_layers())
|
||||
else:
|
||||
qs = qs.filter(layer=i)
|
||||
qs = qs.order_by('start')
|
||||
save(i, u'\n'.join([l.findvalue for l in qs]))
|
||||
|
|
|
@ -91,12 +91,11 @@ def parse_query(data, user):
|
|||
if key in data:
|
||||
query[key] = data[key]
|
||||
query['qs'] = models.Item.objects.find(data, user)
|
||||
|
||||
if 'clips' in data:
|
||||
query['clip_qs'] = Clip.objects.find({'query': data['clips']['query']},
|
||||
user).order_by('start')
|
||||
query['clip_filter'] = Clip.objects.find({'query': data['clips']['query']},
|
||||
user)
|
||||
conditions = {'query': data['clips']['query']}
|
||||
query['clip_qs'] = Clip.objects.find(conditions, user).order_by('start')
|
||||
conditions = {'query': data['query']}
|
||||
query['clip_filter'] = models.Clip.objects.filter_annotations(conditions, user)
|
||||
query['clip_items'] = data['clips'].get('items', 5)
|
||||
query['clip_keys'] = data['clips'].get('keys')
|
||||
if not query['clip_keys']:
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
pandora.ui.itemClips = function(options) {
|
||||
|
||||
var self = {},
|
||||
textKey = pandora.getClipTextKey(),
|
||||
that = Ox.Element()
|
||||
.css({
|
||||
height: '192px',
|
||||
|
@ -28,7 +29,10 @@ pandora.ui.itemClips = function(options) {
|
|||
Ox.Log('', 'CLIP', clip)
|
||||
var id = self.options.id + '/' + clip['in'],
|
||||
title = Ox.map(clip.annotations, function(annotation) {
|
||||
return annotation.layer == 'subtitles' ? annotation.value : 0
|
||||
if(textKey == 'subtitles') {
|
||||
return annotation.layer == 'subtitles' ? annotation.value : 0;
|
||||
}
|
||||
return annotation.value;
|
||||
}),
|
||||
url = '/' + self.options.id + '/' + self.height + 'p' + clip['in'] + '.jpg',
|
||||
$item = Ox.IconItem({
|
||||
|
|
|
@ -480,7 +480,8 @@ pandora.getClipsQuery = function() {
|
|||
if (condition.conditions) {
|
||||
addClipsConditions(condition.conditions);
|
||||
} else if (
|
||||
Ox.getIndexById(pandora.site.layers, condition.key) > -1
|
||||
(condition.key == 'annotations'
|
||||
||Ox.getIndexById(pandora.site.layers, condition.key) > -1)
|
||||
&& condition.operator == '='
|
||||
) {
|
||||
clipsQuery.conditions.push(condition);
|
||||
|
|
Loading…
Reference in a new issue