]> git.parisson.com Git - mezzo.git/commitdiff
Search : creating page, video, audio, event subtemplate
authorEmilie <zawadzki@ircam.fr>
Thu, 13 Oct 2016 10:19:09 +0000 (12:19 +0200)
committerEmilie <zawadzki@ircam.fr>
Thu, 13 Oct 2016 10:19:09 +0000 (12:19 +0200)
12 files changed:
app/organization/agenda/migrations/0009_auto_20161013_1216.py [new file with mode: 0644]
app/organization/magazine/migrations/0011_auto_20161012_1755.py [new file with mode: 0644]
app/organization/magazine/migrations/0012_auto_20161013_1216.py [new file with mode: 0644]
app/organization/media/migrations/0006_auto_20161013_1216.py [new file with mode: 0644]
app/organization/network/migrations/0038_auto_20161013_1216.py [new file with mode: 0644]
app/organization/pages/migrations/0008_auto_20161013_1216.py [new file with mode: 0644]
app/organization/projects/migrations/0020_auto_20161013_1216.py [new file with mode: 0644]
app/templates/agenda/includes/event_search.html [new file with mode: 0644]
app/templates/media/audio/inc/audio_search.html [new file with mode: 0644]
app/templates/media/video/inc/video_search.html [new file with mode: 0644]
app/templates/pages/includes/page_search.html [new file with mode: 0644]
app/templates/search_results.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 (file)
index 0000000..e42f714
--- /dev/null
@@ -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 (file)
index 0000000..c3b9758
--- /dev/null
@@ -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 (file)
index 0000000..6d785ef
--- /dev/null
@@ -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 (file)
index 0000000..772f50b
--- /dev/null
@@ -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 (file)
index 0000000..360dbb1
--- /dev/null
@@ -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 (file)
index 0000000..ee042e9
--- /dev/null
@@ -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 (file)
index 0000000..f50d248
--- /dev/null
@@ -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 (file)
index 0000000..e8199f6
--- /dev/null
@@ -0,0 +1,67 @@
+{% load i18n future mezzanine_tags event_tags keyword_tags disqus_tags organization_tags %}
+
+<div class="row event-line-box">
+
+    <div class="col-sm-2 col-md-3 col-lg-3 event-line-box__month">
+
+        {% ifchanged event.start.month %}
+            {{ event.start|date:'F' }}
+        {% endifchanged %}
+
+    </div>
+
+    <div class="col-sm-10 col-md-9 col-lg-9 event-line-box__content">
+
+        <div class="row">
+
+            <div class="col-xs-3">
+                {% with True as unit_booking %}
+                    {% include 'agenda/includes/event_metainfo_line.html' %}
+                {% endwith %}
+            </div>
+            <div class="col-xs-3">
+                {% with event.images.all|get_type:'card' as images %}
+                    {% if images %}
+                        <a href="{{ event.get_absolute_url }}">
+                            <img class="event-line-box__image" src="{{ MEDIA_URL }}{% thumbnail images.0.file 203 140 %}" width="203" height="140">
+                        </a>
+                    {% else %}
+                        {% with event.parent.images.all|get_type:'card' as images %}
+                            {% if images %}
+                                <a href="{{ event.get_absolute_url }}">
+                                    <img class="event-line-box__image" src="{{ MEDIA_URL }}{% thumbnail images.0.file 203 140 %}" width="203" height="140">
+                                </a>
+                            {% endif %}
+                        {% endwith %}
+                    {% endif %}
+                {% endwith %}
+            </div>
+            <div class="col-xs-6">
+                {% keywords_for event as tags %}
+                {% if event.departments.all.0 or tags %}
+                    <div class="event-line-box__tags">
+                        {% if event.departments.all.0 %}
+                            <div class="tag tag--small dashed">
+                              {{ event.departments.all.0.department.name }}
+                            </div>
+                        {% endif %}
+                        {% if event.category %}
+                            <div class="tag tag--small tag--category">
+                                {{ event.category }}
+                            </div>
+                        {% endif %}
+                    </div>
+                {% endif %}
+                <h2 class="event-line-box__title">
+                    <a href="{{ event.get_absolute_url }}">{{ event.title }}</a>
+                </h2>
+                <div class="event-line-box__desc">
+                    {{ event.description|slice:":100" }}
+                </div>
+            </div>
+
+        </div>
+
+    </div>
+
+</div>
diff --git a/app/templates/media/audio/inc/audio_search.html b/app/templates/media/audio/inc/audio_search.html
new file mode 100644 (file)
index 0000000..b206356
--- /dev/null
@@ -0,0 +1,23 @@
+{% load i18n mezzanine_tags organization_tags %}
+{% with audio.get_absolute_url as audio_url %}
+    {% if audio.poster_url %}
+        <!-- url of the media is distant. We can't generate back side thumbnail. Do it with css pliz -->
+        <img src="{{ audio.poster_urlĀ }}" width="200" height="150">
+    {% else %}
+        <!--placeholder picture-->
+    {% endif %}
+    <h5>
+        {% if audio_url %}
+            <a href="{{ audio_url }}">{{ audio }}</a>
+        {% else %}
+            {{ audio }}
+        {% endif %}
+    </h5>
+    {% if audio.description != audio|stringformat:"s" %}
+        <p>{{ audio.description|truncatewords_html:200|safe }}</p>
+    {% endif %}
+    {% if audio_url %}
+        <a href="{{ audio_url }}">{% trans "read more" %}</a>
+    {% endif %}
+    <br>
+{% 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 (file)
index 0000000..5c81dfc
--- /dev/null
@@ -0,0 +1,23 @@
+{% load i18n mezzanine_tags organization_tags %}
+{% with video.get_absolute_url as video_url %}
+    {% if video.poster_url %}
+        <!-- url of the media is distant. We can't generate back side thumbnail. Do it with css pliz -->
+        <img src="{{ video.poster_urlĀ }}" width="200" height="150">
+    {% else %}
+        <!--placeholder picture-->
+    {% endif %}
+    <h5>
+        {% if video_url %}
+            <a href="{{ video_url }}">{{ video }}</a>
+        {% else %}
+            {{ video }}
+        {% endif %}
+    </h5>
+    {% if video.description != video|stringformat:"s" %}
+        <p>{{ video.description|truncatewords_html:200|safe }}</p>
+    {% endif %}
+    {% if video_url %}
+        <a href="{{ video_url }}">{% trans "read more" %}</a>
+    {% endif %}
+    <br>
+{% endwith %}
diff --git a/app/templates/pages/includes/page_search.html b/app/templates/pages/includes/page_search.html
new file mode 100644 (file)
index 0000000..38e03f1
--- /dev/null
@@ -0,0 +1,16 @@
+{% load i18n mezzanine_tags organization_tags %}
+{% with page.get_absolute_url as page_url %}
+    <h5>
+        {% if page_url %}
+            <a href="{{ page_url }}">{{ result }}</a>
+        {% else %}
+            {{ result }}
+        {% endif %}
+    </h5>
+    {% if result.description != result|stringformat:"s" %}
+        <p>{{ result.description|truncatewords_html:200|safe }}</p>
+    {% endif %}
+    {% if page_url %}
+        <a href="{{ page_url }}">{% trans "read more" %}</a>
+    {% endif %}
+{% endwith %}
index a6c1167348367a8df3da3da1a6071f2516f935f8..b211c49048b465f86db7b3100e8d2a361c4f6832 100644 (file)
             {% endif %}
         </p>
         {% for result in results.object_list %}
-        {% with result.get_absolute_url as result_url %}
-            {{ result.periods.date_from }}{{ result.periods.date_to }}
-            <h5>
-                {% if result_url %}
-                    <a href="{{ result_url }}">{{ result }}</a>
-                {% else %}
-                    {{ result }}
-                {% endif %}
-            </h5>
-            {% if result.description != result|stringformat:"s" %}
-                <p>{{ result.description|truncatewords_html:200|safe }}</p>
-            {% endif %}
-            {% if result_url %}
-                <a href="{{ result_url }}">{% trans "read more" %}</a>
+            {% 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 %}