From 680905822c494c0f1df8d0e829f4864d3cf9177a Mon Sep 17 00:00:00 2001 From: Emilie Date: Thu, 13 Oct 2016 12:19:09 +0200 Subject: [PATCH] Search : creating page, video, audio, event subtemplate --- .../migrations/0009_auto_20161013_1216.py | 23 +++++++ .../migrations/0011_auto_20161012_1755.py | 19 ++++++ .../migrations/0012_auto_20161013_1216.py | 23 +++++++ .../migrations/0006_auto_20161013_1216.py | 23 +++++++ .../migrations/0038_auto_20161013_1216.py | 31 +++++++++ .../migrations/0008_auto_20161013_1216.py | 23 +++++++ .../migrations/0020_auto_20161013_1216.py | 23 +++++++ .../agenda/includes/event_search.html | 67 +++++++++++++++++++ .../media/audio/inc/audio_search.html | 23 +++++++ .../media/video/inc/video_search.html | 23 +++++++ app/templates/pages/includes/page_search.html | 16 +++++ app/templates/search_results.html | 31 ++++----- 12 files changed, 310 insertions(+), 15 deletions(-) create mode 100644 app/organization/agenda/migrations/0009_auto_20161013_1216.py create mode 100644 app/organization/magazine/migrations/0011_auto_20161012_1755.py create mode 100644 app/organization/magazine/migrations/0012_auto_20161013_1216.py create mode 100644 app/organization/media/migrations/0006_auto_20161013_1216.py create mode 100644 app/organization/network/migrations/0038_auto_20161013_1216.py create mode 100644 app/organization/pages/migrations/0008_auto_20161013_1216.py create mode 100644 app/organization/projects/migrations/0020_auto_20161013_1216.py create mode 100644 app/templates/agenda/includes/event_search.html create mode 100644 app/templates/media/audio/inc/audio_search.html create mode 100644 app/templates/media/video/inc/video_search.html create mode 100644 app/templates/pages/includes/page_search.html diff --git a/app/organization/agenda/migrations/0009_auto_20161013_1216.py b/app/organization/agenda/migrations/0009_auto_20161013_1216.py new file mode 100644 index 00000000..e42f7140 --- /dev/null +++ b/app/organization/agenda/migrations/0009_auto_20161013_1216.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.10 on 2016-10-13 10:16 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('organization-agenda', '0008_auto_20161005_1455'), + ] + + operations = [ + migrations.AlterModelOptions( + name='eventaudio', + options={'verbose_name': 'Audio', 'verbose_name_plural': 'Audios'}, + ), + migrations.AlterModelOptions( + name='eventvideo', + options={'verbose_name': 'Video', 'verbose_name_plural': 'Videos'}, + ), + ] diff --git a/app/organization/magazine/migrations/0011_auto_20161012_1755.py b/app/organization/magazine/migrations/0011_auto_20161012_1755.py new file mode 100644 index 00000000..c3b97585 --- /dev/null +++ b/app/organization/magazine/migrations/0011_auto_20161012_1755.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.10 on 2016-10-12 15:55 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('organization-magazine', '0010_articleaudio_articlevideo'), + ] + + operations = [ + migrations.AlterModelOptions( + name='articleaudio', + options={'verbose_name': 'audio'}, + ), + ] diff --git a/app/organization/magazine/migrations/0012_auto_20161013_1216.py b/app/organization/magazine/migrations/0012_auto_20161013_1216.py new file mode 100644 index 00000000..6d785eff --- /dev/null +++ b/app/organization/magazine/migrations/0012_auto_20161013_1216.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.10 on 2016-10-13 10:16 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('organization-magazine', '0011_auto_20161012_1755'), + ] + + operations = [ + migrations.AlterModelOptions( + name='articleaudio', + options={'verbose_name': 'Audio', 'verbose_name_plural': 'Audios'}, + ), + migrations.AlterModelOptions( + name='articlevideo', + options={'verbose_name': 'Video', 'verbose_name_plural': 'Videos'}, + ), + ] diff --git a/app/organization/media/migrations/0006_auto_20161013_1216.py b/app/organization/media/migrations/0006_auto_20161013_1216.py new file mode 100644 index 00000000..772f50b1 --- /dev/null +++ b/app/organization/media/migrations/0006_auto_20161013_1216.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.10 on 2016-10-13 10:16 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('organization-media', '0005_auto_20160930_1849'), + ] + + operations = [ + migrations.AlterModelOptions( + name='audio', + options={'ordering': ('-created_at',), 'verbose_name': 'Audio', 'verbose_name_plural': 'Audios'}, + ), + migrations.AlterModelOptions( + name='video', + options={'ordering': ('-created_at',), 'verbose_name': 'Video', 'verbose_name_plural': 'Videos'}, + ), + ] diff --git a/app/organization/network/migrations/0038_auto_20161013_1216.py b/app/organization/network/migrations/0038_auto_20161013_1216.py new file mode 100644 index 00000000..360dbb11 --- /dev/null +++ b/app/organization/network/migrations/0038_auto_20161013_1216.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.10 on 2016-10-13 10:16 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('organization-network', '0037_organizationtype_css_class'), + ] + + operations = [ + migrations.AlterModelOptions( + name='organizationaudio', + options={'verbose_name': 'Audio', 'verbose_name_plural': 'Audios'}, + ), + migrations.AlterModelOptions( + name='organizationvideo', + options={'verbose_name': 'Video', 'verbose_name_plural': 'Videos'}, + ), + migrations.AlterModelOptions( + name='personaudio', + options={'verbose_name': 'Audio', 'verbose_name_plural': 'Audios'}, + ), + migrations.AlterModelOptions( + name='personvideo', + options={'verbose_name': 'Video', 'verbose_name_plural': 'Videos'}, + ), + ] diff --git a/app/organization/pages/migrations/0008_auto_20161013_1216.py b/app/organization/pages/migrations/0008_auto_20161013_1216.py new file mode 100644 index 00000000..ee042e97 --- /dev/null +++ b/app/organization/pages/migrations/0008_auto_20161013_1216.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.10 on 2016-10-13 10:16 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('organization-pages', '0007_auto_20161007_1852'), + ] + + operations = [ + migrations.AlterModelOptions( + name='pageaudio', + options={'verbose_name': 'Audio', 'verbose_name_plural': 'Audios'}, + ), + migrations.AlterModelOptions( + name='pagevideo', + options={'verbose_name': 'Video', 'verbose_name_plural': 'Videos'}, + ), + ] diff --git a/app/organization/projects/migrations/0020_auto_20161013_1216.py b/app/organization/projects/migrations/0020_auto_20161013_1216.py new file mode 100644 index 00000000..f50d2485 --- /dev/null +++ b/app/organization/projects/migrations/0020_auto_20161013_1216.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.10 on 2016-10-13 10:16 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('organization-projects', '0019_auto_20161007_1045'), + ] + + operations = [ + migrations.AlterModelOptions( + name='projectaudio', + options={'verbose_name': 'Audio', 'verbose_name_plural': 'Audios'}, + ), + migrations.AlterModelOptions( + name='projectvideo', + options={'verbose_name': 'Video', 'verbose_name_plural': 'Videos'}, + ), + ] diff --git a/app/templates/agenda/includes/event_search.html b/app/templates/agenda/includes/event_search.html new file mode 100644 index 00000000..e8199f67 --- /dev/null +++ b/app/templates/agenda/includes/event_search.html @@ -0,0 +1,67 @@ +{% load i18n future mezzanine_tags event_tags keyword_tags disqus_tags organization_tags %} + +
+ +
+ + {% ifchanged event.start.month %} + {{ event.start|date:'F' }} + {% endifchanged %} + +
+ +
+ +
+ +
+ {% with True as unit_booking %} + {% include 'agenda/includes/event_metainfo_line.html' %} + {% endwith %} +
+
+ {% with event.images.all|get_type:'card' as images %} + {% if images %} + + + + {% else %} + {% with event.parent.images.all|get_type:'card' as images %} + {% if images %} + + + + {% endif %} + {% endwith %} + {% endif %} + {% endwith %} +
+
+ {% keywords_for event as tags %} + {% if event.departments.all.0 or tags %} +
+ {% if event.departments.all.0 %} +
+ {{ event.departments.all.0.department.name }} +
+ {% endif %} + {% if event.category %} +
+ {{ event.category }} +
+ {% endif %} +
+ {% endif %} +

+ {{ event.title }} +

+
+ {{ event.description|slice:":100" }} +
+
+ +
+ +
+ +
diff --git a/app/templates/media/audio/inc/audio_search.html b/app/templates/media/audio/inc/audio_search.html new file mode 100644 index 00000000..b206356e --- /dev/null +++ b/app/templates/media/audio/inc/audio_search.html @@ -0,0 +1,23 @@ +{% load i18n mezzanine_tags organization_tags %} +{% with audio.get_absolute_url as audio_url %} + {% if audio.poster_url %} + + + {% else %} + + {% endif %} +
+ {% if audio_url %} + {{ audio }} + {% else %} + {{ audio }} + {% endif %} +
+ {% if audio.description != audio|stringformat:"s" %} +

{{ audio.description|truncatewords_html:200|safe }}

+ {% endif %} + {% if audio_url %} + {% trans "read more" %} + {% endif %} +
+{% endwith %} diff --git a/app/templates/media/video/inc/video_search.html b/app/templates/media/video/inc/video_search.html new file mode 100644 index 00000000..5c81dfcf --- /dev/null +++ b/app/templates/media/video/inc/video_search.html @@ -0,0 +1,23 @@ +{% load i18n mezzanine_tags organization_tags %} +{% with video.get_absolute_url as video_url %} + {% if video.poster_url %} + + + {% else %} + + {% endif %} +
+ {% if video_url %} + {{ video }} + {% else %} + {{ video }} + {% endif %} +
+ {% if video.description != video|stringformat:"s" %} +

{{ video.description|truncatewords_html:200|safe }}

+ {% endif %} + {% if video_url %} + {% trans "read more" %} + {% endif %} +
+{% endwith %} diff --git a/app/templates/pages/includes/page_search.html b/app/templates/pages/includes/page_search.html new file mode 100644 index 00000000..38e03f14 --- /dev/null +++ b/app/templates/pages/includes/page_search.html @@ -0,0 +1,16 @@ +{% load i18n mezzanine_tags organization_tags %} +{% with page.get_absolute_url as page_url %} +
+ {% if page_url %} + {{ result }} + {% else %} + {{ result }} + {% endif %} +
+ {% if result.description != result|stringformat:"s" %} +

{{ result.description|truncatewords_html:200|safe }}

+ {% endif %} + {% if page_url %} + {% trans "read more" %} + {% endif %} +{% endwith %} diff --git a/app/templates/search_results.html b/app/templates/search_results.html index a6c11673..b211c490 100644 --- a/app/templates/search_results.html +++ b/app/templates/search_results.html @@ -47,22 +47,23 @@ {% endif %}

{% for result in results.object_list %} - {% with result.get_absolute_url as result_url %} - {{ result.periods.date_from }}{{ result.periods.date_to }} -
- {% if result_url %} - {{ result }} - {% else %} - {{ result }} - {% endif %} -
- {% if result.description != result|stringformat:"s" %} -

{{ result.description|truncatewords_html:200|safe }}

- {% endif %} - {% if result_url %} - {% trans "read more" %} + {% if result|classname == 'Event' %} + {% with result as event %} + {% include 'agenda/includes/event_search.html' %} + {% endwith %} + {% elif result|classname == 'Audio' %} + {% with result as audio %} + {% include 'media/audio/inc/audio_search.html' %} + {% endwith %} + {% elif result|classname == 'Video' %} + {% with result as video %} + {% include 'media/video/inc/video_search.html' %} + {% endwith %} + {% else %} + {% with result as page %} + {% include 'pages/includes/page_search.html' %} + {% endwith %} {% endif %} - {% endwith %} {% endfor %} {% pagination_for results %} -- 2.39.5