Skip to content

Commit

Permalink
WCM-614: Add search filter for video type
Browse files Browse the repository at this point in the history
  • Loading branch information
wosc committed Jan 20, 2025
1 parent 98f4464 commit de0ac95
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/zeit/find/browser/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ Content-Type: text/json...
'ressorts': [{'ressort': 'Deutschland', 'ressort_name': 'Deutschland'},...
'series': [{'serie': '-', 'serie_title': '-'},...
'template_url': 'http://localhost/++skin++vivi/fanstatic/zeit.find/search_form.jsont',
'types': [{'title': 'Image Group', 'type': 'image-group'}]}
'types': [{'title': 'Image Group', 'type': 'image-group'}],
'video_type': [{'key': 'brightcove', 'value': 'Brightcove'},...]}


Favorites
Expand Down
9 changes: 9 additions & 0 deletions core/src/zeit/find/browser/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import zeit.cms.content.interfaces
import zeit.cms.interfaces
import zeit.content.audio.interfaces
import zeit.content.video.interfaces
import zeit.find.interfaces
import zeit.find.search

Expand Down Expand Up @@ -44,6 +45,7 @@ def json(self):
'series': self.series,
'audio_type': self.audio_types,
'podcasts': self.podcasts,
'video_type': self.video_types,
'types': self.types,
}

Expand Down Expand Up @@ -88,6 +90,11 @@ def audio_types(self):
types = zeit.content.audio.interfaces.AudioTypeSource().factory.values
return [{'key': key, 'value': value} for key, value in types.items()]

@property
def video_types(self):
types = zeit.content.video.interfaces.VideoTypeSource().factory.values
return [{'key': key, 'value': value} for key, value in types.items()]

CONTENT_TYPES = [
'advertisement',
'animation',
Expand Down Expand Up @@ -424,6 +431,7 @@ def g(name, default=None):
serie = g('serie', None)
audio_type = g('audio_type', None)
podcast = g('podcast', None)
video_type = g('video_type', None)
# four states: published, not-published, published-with-changes,
# don't care (None)
published = g('published', None)
Expand All @@ -448,6 +456,7 @@ def g(name, default=None):
'topic': topic,
'types': types,
'until': until,
'video_type': video_type,
'volume': volume,
'year': year,
}
Expand Down
9 changes: 9 additions & 0 deletions core/src/zeit/find/browser/resources/search_form.jsont
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@
{.end}
</select>
</fieldset>
<fieldset>
<label>Videotyp:</label>
<select name="video_type">
<option value=""></option>
{.repeated section video_type}
<option value="{key}">{value}</option>
{.end}
</select>
</fieldset>
<fieldset>
<label>Verfügbarkeit:</label>
<select name="access">
Expand Down
11 changes: 11 additions & 0 deletions core/src/zeit/find/browser/tests/test_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,14 @@ def test_audio_type_selection(self):
s.verifyValue('name=audio_type', 'tts')
s.select('name=audio_type', 'Podcast')
s.verifyValue('name=audio_type', 'podcast')

def test_video_type_selection(self):
s = self.selenium
s.verifyNotVisible('id=extended_search')
s.click('id=extended_search_button')
s.waitForVisible('id=extended_search')
s.verifyNotVisible('id=extended_search_info')
s.select('name=video_type', 'Brightcove')
s.verifyValue('name=video_type', 'brightcove')
s.select('name=video_type', 'Youtube')
s.verifyValue('name=video_type', 'youtube')
1 change: 1 addition & 0 deletions core/src/zeit/find/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def from_product_config():
'podcast': 'payload.audio.podcast',
'topic': 'payload.document.ressort',
'types': 'doc_type',
'video_type': 'payload.video.type',
'volume': 'payload.document.volume',
'year': 'payload.document.year',
}
Expand Down

0 comments on commit de0ac95

Please sign in to comment.