From: Jérémy Fabre Date: Tue, 18 Oct 2016 15:16:24 +0000 (+0200) Subject: Search results first implementation X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=80d4232b906cb40b2c0e340baceb05fc516c1c88;p=mezzo.git Search results first implementation --- diff --git a/app/static/src/sass/modules/_all.scss b/app/static/src/sass/modules/_all.scss index 1b8917a7..e5aee2ab 100755 --- a/app/static/src/sass/modules/_all.scss +++ b/app/static/src/sass/modules/_all.scss @@ -16,6 +16,7 @@ @import 'boxes/event-line-box'; @import 'boxes/job-line-box'; @import 'boxes/product-box'; +@import 'boxes/search-box'; // Sliders @import 'sliders/slider-page'; diff --git a/app/static/src/sass/modules/_search.scss b/app/static/src/sass/modules/_search.scss index ac838e7d..eed67beb 100644 --- a/app/static/src/sass/modules/_search.scss +++ b/app/static/src/sass/modules/_search.scss @@ -55,6 +55,10 @@ $module: ".search"; } +} + +.search-form { + input[type="text"] { border: 0; diff --git a/app/static/src/sass/modules/boxes/_search-box.scss b/app/static/src/sass/modules/boxes/_search-box.scss new file mode 100644 index 00000000..2b997881 --- /dev/null +++ b/app/static/src/sass/modules/boxes/_search-box.scss @@ -0,0 +1,42 @@ +$module: ".search-box"; + +#{$module} { + + position: relative; + @include margin-bottom(2); + + &__title { + @include margin(0 0 1 0); + font-weight: weight(bold); + text-transform: uppercase; + + i { + display: inline-block; + @include margin-left(.5); + font-size: 0.75em; + position: relative; + top: -5px; + } + } + + &__subtitle { + + @include font-size(m); + @include line-height(1); + @include typeface(sans-serif); + + @include margin-top(-.5); + @include margin-bottom(1); + + } + + &__content { + + @include font-size(s); + @include line-height(1); + @include typeface(serif); + font-weight: weight(light); + + } + +} diff --git a/app/templates/agenda/includes/event_search.html b/app/templates/agenda/includes/event_search.html index e8199f67..0acf5357 100644 --- a/app/templates/agenda/includes/event_search.html +++ b/app/templates/agenda/includes/event_search.html @@ -1,67 +1,35 @@ +{% extends "core/inc/search_card.html" %} {% load i18n future mezzanine_tags event_tags keyword_tags disqus_tags organization_tags %} -
+{% block title %} + {{ event.title }} +{% endblock %} -
- - {% ifchanged event.start.month %} - {{ event.start|date:'F' }} - {% endifchanged %} +{% block icon %}calendar-o{% endblock %} +{% block subtitle %} +
+ {% include 'agenda/includes/event_date_line.html' %}
- -
- -
- -
- {% 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" }} +{% endblock %} + +{% block tags %} + {% keywords_for event as tags %} + {% if event.departments.all.0 or tags %} + {% if event.departments.all.0 %} +
+
+ {{ event.departments.all.0.department.name }}
+ {% endif %} + {% endif %} +{% endblock %} -
- -
+{% block url %} + {{ event.get_absolute_url }} +{% endblock %} -
+{% block content %} + {{ event.description|slice:":100" }} +{% endblock %} diff --git a/app/templates/core/inc/generic_card_variable_height.html b/app/templates/core/inc/generic_card_variable_height.html deleted file mode 100644 index e9253312..00000000 --- a/app/templates/core/inc/generic_card_variable_height.html +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "core/inc/generic_card.html" %} -{% load i18n pages_tags mezzanine_tags media_tags organization_tags %} - -{% block image %} - -{% endblock %} diff --git a/app/templates/core/inc/search_card.html b/app/templates/core/inc/search_card.html new file mode 100644 index 00000000..4ff100a5 --- /dev/null +++ b/app/templates/core/inc/search_card.html @@ -0,0 +1,23 @@ + diff --git a/app/templates/includes/search_form.html b/app/templates/includes/search_form.html index 47d109ee..8dceb004 100644 --- a/app/templates/includes/search_form.html +++ b/app/templates/includes/search_form.html @@ -8,8 +8,8 @@
-
- + + diff --git a/app/templates/media/inc/playlist_search.html b/app/templates/media/inc/playlist_search.html index 0ab4d8f3..5720973e 100644 --- a/app/templates/media/inc/playlist_search.html +++ b/app/templates/media/inc/playlist_search.html @@ -1,4 +1,30 @@ +{% extends "core/inc/search_card.html" %} {% load i18n mezzanine_tags organization_tags %} + +{% block title %} + {{ result }} +{% endblock %} + +{% block icon %}file-{{playlist.type}}-o{% endblock %} + +{% block tags %} +
+
+ {{playlist.type}} +
+
+{% endblock %} + +{% block url %} + {{ playlist.get_absolute_url }} +{% endblock %} + +{% block content %} + {% if playlist.description != playlist|stringformat:"s" %} + {{ playlist.description|truncatewords_html:200|safe }} + {% endif %} +{% endblock %} + {% with playlist.get_absolute_url as playlist_url %} {% if playlist.medias.first.media.poster_url %} diff --git a/app/templates/pages/includes/page_search.html b/app/templates/pages/includes/page_search.html index 38e03f14..e578d787 100644 --- a/app/templates/pages/includes/page_search.html +++ b/app/templates/pages/includes/page_search.html @@ -1,16 +1,42 @@ +{% extends "core/inc/search_card.html" %} {% load i18n mezzanine_tags organization_tags %} -{% with page.get_absolute_url as page_url %} -
- {% if page_url %} - {{ result }} + +{% block title %} + {{ result }} +{% endblock %} + +{% block icon %}files-o{% endblock %} + +{% block tags %} + {% with page.get_ascendants|last as top_level_parent %} + {% if top_level_parent.get_content_model.title %} +
+
+ {{ top_level_parent.get_content_model.title }} +
+
+ {% elif page.departmentpage %} +
+
+ {{ page.departmentpage.title }} +
+
{% else %} - {{ result }} +
+
+ {% trans "Link" %} +
+
{% endif %} -
+ {% endwith %} +{% endblock %} + +{% block url %} + {{ page.get_absolute_url }} +{% endblock %} + +{% block content %} {% if result.description != result|stringformat:"s" %} -

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

+ {{ result.description|truncatewords_html:200|safe }} {% endif %} - {% if page_url %} - {% trans "read more" %} - {% endif %} -{% endwith %} +{% endblock %} diff --git a/app/templates/search_results.html b/app/templates/search_results.html index 8603cf68..7e8a0e75 100644 --- a/app/templates/search_results.html +++ b/app/templates/search_results.html @@ -9,62 +9,94 @@ {% endblock %} {% block breadcrumb_menu %} - - + + {% endblock %} {% block main %} -
-
-

{% trans "Search Results" %}

-
-
- -
-
-

- {% if results.paginator.count == 0 %} - {% blocktrans %} - No results were found in {{ search_type }} matching your query: {{ query }} - {% endblocktrans %} - {% else %} - {% blocktrans with start=results.start_index end=results.end_index total=results.paginator.count %} - Showing {{ start }} to {{ end }} of {{ total }} results in {{ search_type }} matching your query: {{ query }} - {% endblocktrans %} - {% endif %} -

- -

-

Filter:

- {% for key,value in filter_dict.items %} - {{ value.verbose_name }} {{ value.count }}
- {% endfor %} - {% if cancel_filter_url %} - Cancel filter - {% endif %} -

- {% for result in results.object_list %} - {{ result|classname }} - {% if result|classname == 'Event' %} - {% with result as event %} - {% include 'agenda/includes/event_search.html' %} - {% endwith %} - {% elif result|classname == 'Playlist' %} - {% with result as playlist %} - {% include 'media/inc/playlist_search.html' %} - {% endwith %} - {% else %} - {% with result as page %} - {% include 'pages/includes/page_search.html' %} - {% endwith %} - {% endif %} - {% endfor %} +
+
+ +
+
+ + + + + + +
+

+ {% if results.paginator.count == 0 %} + {% blocktrans %} + No results were found in {{ search_type }} matching your query: {{ query }} + {% endblocktrans %} + {% else %} + {% blocktrans with start=results.start_index end=results.end_index total=results.paginator.count %} + Showing {{ start }} to {{ end }} of {{ total }} results in {{ search_type }} matching your query: {{ query }} + {% endblocktrans %} + {% endif %} +

+
+ +
+
+ +
+ +
+ +
+ +
+ + +
+ +
+ + {% for result in results.object_list %} + {# result|classname #} + {% if result|classname == 'Event' %} + {% with result as event %} + {% include 'agenda/includes/event_search.html' %} + {% endwith %} + {% elif result|classname == 'Playlist' %} + {% with result as playlist %} + {% include 'media/inc/playlist_search.html' %} + {% endwith %} + {% else %} + {% with result as page %} + {% include 'pages/includes/page_search.html' %} + {% endwith %} + {% endif %} + {% endfor %} + +
+
+ +
{% pagination_for results %} +
-
{% endblock %}