From a8212b0ad13961404493b05275f98d77693ea10e Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sun, 23 Jun 2019 10:07:59 +0200
Subject: [PATCH] Remove Comment opinions. Simplify comments templates.

---
 .../migrations/0005_auto_20190623_0954.py     |  37 ++++
 comments/models.py                            |  26 ---
 .../comments/_comment_card_content.html       |  12 +-
 .../_comment_card_extended_content.html       |   8 -
 .../_comment_card_extended_for_author.html    |  21 ++-
 .../comments/_comment_identifier.html         |  33 ++--
 .../comments/_comment_voting_form.html        |  21 ---
 .../templates/comments/_single_comment.html   |   4 -
 .../templates/comments/_vet_comment_form.html |   2 +-
 .../templates/comments/reply_to_comment.html  |   2 -
 comments/urls.py                              |   4 -
 comments/views.py                             |   8 -
 .../commands/add_groups_and_permissions.py    |   4 -
 .../templates/scipost/contributor_info.html   |   2 +-
 templates/search/search.html                  | 176 +++++++++---------
 15 files changed, 158 insertions(+), 202 deletions(-)
 create mode 100644 comments/migrations/0005_auto_20190623_0954.py
 delete mode 100644 comments/templates/comments/_comment_card_extended_content.html
 delete mode 100644 comments/templates/comments/_comment_voting_form.html

diff --git a/comments/migrations/0005_auto_20190623_0954.py b/comments/migrations/0005_auto_20190623_0954.py
new file mode 100644
index 000000000..af5e79717
--- /dev/null
+++ b/comments/migrations/0005_auto_20190623_0954.py
@@ -0,0 +1,37 @@
+# Generated by Django 2.1.8 on 2019-06-23 07:54
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('comments', '0004_auto_20180519_1313'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='comment',
+            name='in_agreement',
+        ),
+        migrations.RemoveField(
+            model_name='comment',
+            name='in_disagreement',
+        ),
+        migrations.RemoveField(
+            model_name='comment',
+            name='in_notsure',
+        ),
+        migrations.RemoveField(
+            model_name='comment',
+            name='nr_A',
+        ),
+        migrations.RemoveField(
+            model_name='comment',
+            name='nr_D',
+        ),
+        migrations.RemoveField(
+            model_name='comment',
+            name='nr_N',
+        ),
+    ]
diff --git a/comments/models.py b/comments/models.py
index 8e332f938..59572dc4e 100644
--- a/comments/models.py
+++ b/comments/models.py
@@ -69,17 +69,6 @@ class Comment(TimeStampedModel):
                                            verbose_name='optional remarks for the Editors only')
     date_submitted = models.DateTimeField('date submitted', default=timezone.now)
 
-    # Opinions
-    nr_A = models.PositiveIntegerField(default=0)
-    in_agreement = models.ManyToManyField('scipost.Contributor', related_name='in_agreement',
-                                          blank=True)
-    nr_N = models.PositiveIntegerField(default=0)
-    in_notsure = models.ManyToManyField('scipost.Contributor', related_name='in_notsure',
-                                        blank=True)
-    nr_D = models.PositiveIntegerField(default=0)
-    in_disagreement = models.ManyToManyField('scipost.Contributor', related_name='in_disagreement',
-                                             blank=True)
-
     needs_doi = models.NullBooleanField(default=None)
     doideposit_needs_updating = models.BooleanField(default=False)
     genericdoideposit = GenericRelation('journals.GenericDOIDeposit',
@@ -179,21 +168,6 @@ class Comment(TimeStampedModel):
             return '{} {}'.format(author.get_title_display(), author.user.last_name)
         return 'Anonymous'
 
-    def update_opinions(self, contributor_id, opinion):
-        contributor = get_object_or_404(Contributor, pk=contributor_id)
-        self.in_agreement.remove(contributor)
-        self.in_notsure.remove(contributor)
-        self.in_disagreement.remove(contributor)
-        if opinion == 'A':
-            self.in_agreement.add(contributor)
-        elif opinion == 'N':
-            self.in_notsure.add(contributor)
-        elif opinion == 'D':
-            self.in_disagreement.add(contributor)
-        self.nr_A = self.in_agreement.count()
-        self.nr_N = self.in_notsure.count()
-        self.nr_D = self.in_disagreement.count()
-        self.save()
 
     @property
     def relation_to_published(self):
diff --git a/comments/templates/comments/_comment_card_content.html b/comments/templates/comments/_comment_card_content.html
index 62f8633e5..2d7a3e45d 100644
--- a/comments/templates/comments/_comment_card_content.html
+++ b/comments/templates/comments/_comment_card_content.html
@@ -1,23 +1,17 @@
 <div class="card-body card-comment">
-  {% block card_block_header %}{% endblock %}
   <p class="card-text">
     {% if comment.anonymous %}
       Anonymous:
     {% else %}
       <a href="{{ comment.author.get_absolute_url }}">{{ comment.get_author_str }}</a>:
     {% endif %}
+    <a href="{{ comment.get_absolute_url }}">"{{ comment.comment_text|slice:'30' }}{% if comment.comment_text|length > 30 %}...{% endif %}"</a>
+  </p>
 
-    <a href="{{ comment.get_absolute_url }}">
-      "{{ comment.comment_text|slice:'30' }}{% if comment.comment_text|length > 30 %}...{% endif %}"
-    </a>
-  </p><p class="card-text pl-md-3">
+  <p class="card-text pl-md-3">
     in {{ comment.content_type|capfirst }} on <a href="{{ comment.content_object.get_absolute_url }}" class="pubtitleli">{{ comment.title }}</a>
 
     {% if comment.content_object.author_list %}
-      {% comment %}
-      Using 'by xxx' on non-submission comments here would be ambigious. Does the `by xxx` apply to the
-      other object (eg. Report), or the Submission, the Comment, etc?
-      {% endcomment %}
       <span class="text-muted">by {{ comment.content_object.author_list }}</span>
     {% endif %}
   </p>
diff --git a/comments/templates/comments/_comment_card_extended_content.html b/comments/templates/comments/_comment_card_extended_content.html
deleted file mode 100644
index 6717f0b2c..000000000
--- a/comments/templates/comments/_comment_card_extended_content.html
+++ /dev/null
@@ -1,8 +0,0 @@
-{% extends 'comments/_comment_card_content.html' %}
-
-{% block card_block_header %}
-  <div class="mb-2">
-    <div class="d-inline-block mr-1">Nr {{comment.id}}</div>
-    {% include 'comments/_comment_voting_summary.html' with comment=comment class='small' %}
-  </div>
-{% endblock %}
diff --git a/comments/templates/comments/_comment_card_extended_for_author.html b/comments/templates/comments/_comment_card_extended_for_author.html
index 3cea105ab..b6d33e641 100644
--- a/comments/templates/comments/_comment_card_extended_for_author.html
+++ b/comments/templates/comments/_comment_card_extended_for_author.html
@@ -3,20 +3,25 @@
 <div class="card-body card-comment">
   <div class="mb-4 mt-2">
     <div class="d-inline-block mr-1">Nr {{ comment.id }}</div>
-    {% include 'comments/_comment_voting_summary.html' with comment=comment class='small' %}
   </div>
 
   <p>{{ comment.comment_text|automarkup }}</p>
   {% if comment.anonymous %}
-    <p class="card-text">by Anonymous in {{ comment.content_type|capfirst }} on <a href="{{ comment.content_object.get_absolute_url }}" class="pubtitleli">{{ comment.title }}</a> {% if comment.content_object.author_list %} <span class="text-muted">by {{ comment.content_object.author_list }}</span>{% endif %}</p>
+    <p class="card-text">by Anonymous in {{ comment.content_type|capfirst }} on
+      <a href="{{ comment.content_object.get_absolute_url }}" class="pubtitleli">{{ comment.title }}</a> {% if comment.content_object.author_list %} <span class="text-muted">by {{ comment.content_object.author_list }}</span>{% endif %}</p>
   {% else %}
-    <p class="card-text">by <a href="{{ comment.author.get_absolute_url }}">{{ comment.author.user.first_name }} {{ comment.author.user.last_name }}</a> in {{ comment.content_type|capfirst }} on <a href="{{ comment.content_object.get_absolute_url }}" class="pubtitleli">{{ comment.title }}</a> {% if comment.content_object.author_list %} <span class="text-muted">by {{ comment.content_object.author_list }}</span>{% endif %}</p>
+    <p class="card-text">
+      by <a href="{{ comment.author.get_absolute_url }}">{{ comment.author.user.first_name }} {{ comment.author.user.last_name }}</a>
+      in {{ comment.content_type|capfirst }} on
+      <a href="{{ comment.content_object.get_absolute_url }}" class="pubtitleli">{{ comment.title }}</a>
+      {% if comment.content_object.author_list %}
+	<span class="text-muted">by {{ comment.content_object.author_list }}</span>
+      {% endif %}
+    </p>
   {% endif %}
 
-  {% comment %}
-  Using 'by xxx' on non-submission comments here would be ambigious. Does the `by xxx` apply to the
-  other object (eg. Report), or the Submission, the Comment, etc?
-  {% endcomment %}
   <p class="card-text text-muted">Comment submitted {{ comment.date_submitted }}</p>
-  <p class="card-text">Status: <span class="{% if comment.status == 1 %} text-success{% elif comment.status == 0 %} text-danger{% endif %}">{{ comment.get_status_display }}</span></p>
+  <p class="card-text">
+    Status: <span class="{% if comment.status == 1 %} text-success{% elif comment.status == 0 %} text-danger{% endif %}">{{ comment.get_status_display }}</span>
+  </p>
 </div>
diff --git a/comments/templates/comments/_comment_identifier.html b/comments/templates/comments/_comment_identifier.html
index 2fa8da1b4..7dec5e831 100644
--- a/comments/templates/comments/_comment_identifier.html
+++ b/comments/templates/comments/_comment_identifier.html
@@ -9,19 +9,19 @@
 
   {% if request.user.contributor and request.user.contributor == comment.core_content_object.editor_in_charge or is_edcol_admin %}
     {% if request.user|is_possible_author_of_submission:comment.core_content_object %}
-      <h3>Anonymous on {{comment.date_submitted|date:'Y-m-d'}}</h3>
+      <h3>Anonymous on {{ comment.date_submitted|date:'Y-m-d' }}</h3>
     {% else %}
       <a href="{{ comment.author.get_absolute_url }}">{{ comment.author.user.first_name }} {{ comment.author.user.last_name }}</a>
       on {{ comment.date_submitted|date:'Y-m-d' }}
-      <br>
-      {% if comment.anonymous %}<small class="text-danger py-2">Chose public anonymity</small>{% endif %}
+      {% if comment.anonymous %}
+	<small class="text-danger py-2">Chose public anonymity</small>{% endif %}
     {% endif %}
   {% elif comment.anonymous %}
-    Anonymous on {{comment.date_submitted|date:'Y-m-d'}}
+    Anonymous on {{ comment.date_submitted|date:'Y-m-d' }}
   {% else %}
-    {% if comment.is_author_reply %}Author{% endif %}
-    <a href="{{comment.author.get_absolute_url}}">{{comment.author.user.first_name}} {{comment.author.user.last_name}}</a>
-    on {{comment.date_submitted|date:'Y-m-d'}}
+    {% if comment.is_author_reply %}Author {% endif %}
+    <a href="{{ comment.author.get_absolute_url }}">{{ comment.author.user.first_name }} {{ comment.author.user.last_name }}</a>
+    on {{ comment.date_submitted|date:'Y-m-d' }}
   {% endif %}
   {% if comment.doi_string %}&nbsp; <small>{{ comment|citation }}</small>{% endif %}
 
@@ -30,16 +30,15 @@
       {% include 'helpdesk/_ticket_for_object_link.html' with type_id=type_id id=comment.id model="Comment" %}
     {% endwith %}
   {% endif %}
-      </h3>
 
+  {% if comment|is_reply_to_comment %}
+    <br>
+    (in reply to <a href="{{ comment.content_object.get_absolute_url }}">{% if comment.content_object.anonymous %}Anonymous Comment{% else %}{{ comment.content_object.author.user.first_name }} {{ comment.content_object.author.user.last_name }}{% endif %}</a> on {{ comment.content_object.date_submitted|date:'Y-m-d' }})
+  {% elif comment|is_reply_to_report %}
+    <br>
+    (in reply to
+    <a href="{{ comment.content_object.get_absolute_url }}">Report {{ comment.content_object.report_nr }}{% if not comment.content_object.anonymous %} by {{ comment.content_object.author.user.first_name }} {{ comment.content_object.author.user.last_name }}{% endif %}</a>
 
-      {% if comment|is_reply_to_comment %}
-        (in reply to <a href="{{comment.content_object.get_absolute_url}}">{% if comment.content_object.anonymous %}Anonymous Comment{% else %}{{comment.content_object.author.user.first_name}} {{comment.content_object.author.user.last_name}}{% endif %}</a> on {{comment.content_object.date_submitted|date:'Y-m-d'}})
-      {% elif comment|is_reply_to_report %}
-        (in reply to
-
-        <a href="{{comment.content_object.get_absolute_url}}">Report {{comment.content_object.report_nr}}{% if not comment.content_object.anonymous %} by {{comment.content_object.author.user.first_name}} {{comment.content_object.author.user.last_name}}{% endif %}</a>
-
-        on {{comment.content_object.date_submitted|date:'Y-m-d'}})
-      {% endif %}
+    on {{ comment.content_object.date_submitted|date:'Y-m-d' }})
+  {% endif %}
 </div>
diff --git a/comments/templates/comments/_comment_voting_form.html b/comments/templates/comments/_comment_voting_form.html
deleted file mode 100644
index ffa757f3c..000000000
--- a/comments/templates/comments/_comment_voting_form.html
+++ /dev/null
@@ -1,21 +0,0 @@
-
-{% if user.is_authenticated and perms.scipost.can_express_opinion_on_comments %}
-  {% if user.contributor != comment.author %}
-    <div class="voting-group d-inline-block {{class}}">
-      <form action="{% url 'comments:express_opinion' comment_id=comment.id opinion='A' %}" method="post">
-        {% csrf_token %}
-        <input type="submit" class="btn btn-sm agree" value="Agree {{ comment.nr_A }}"/>
-      </form>
-      <form action="{% url 'comments:express_opinion' comment_id=comment.id opinion='N' %}" method="post">
-        {% csrf_token %}
-        <input type="submit" class="btn btn-sm neutral" value="Not sure {{ comment.nr_N }}"/>
-      </form>
-      <form action="{% url 'comments:express_opinion' comment_id=comment.id opinion='D'%}" method="post">
-        {% csrf_token %}
-        <input type="submit" class="btn btn-sm disagree" value="Disagree {{ comment.nr_D }}"/>
-      </form>
-    </div>
-  {% else %}
-    {% include 'comments/_comment_voting_summary.html' with comment=comment %}
-  {% endif %}
-{% endif %}
diff --git a/comments/templates/comments/_single_comment.html b/comments/templates/comments/_single_comment.html
index 2ed914086..4810e60f0 100644
--- a/comments/templates/comments/_single_comment.html
+++ b/comments/templates/comments/_single_comment.html
@@ -12,10 +12,6 @@
 
   {% include 'comments/_comment_categories.html' with comment=comment %}
 
-  {% if not hide_votes %}
-    {% include 'comments/_comment_voting_form.html' with comment=comment perms=perms user=user %}
-  {% endif %}
-
   <p class="my-2 pb-1">
     {{ comment.comment_text|automarkup }}
   </p>
diff --git a/comments/templates/comments/_vet_comment_form.html b/comments/templates/comments/_vet_comment_form.html
index 076f3bebc..c1f9a4be1 100644
--- a/comments/templates/comments/_vet_comment_form.html
+++ b/comments/templates/comments/_vet_comment_form.html
@@ -17,7 +17,7 @@
 
   <div class="row">
     <div class="col-md-6">
-      {% include 'comments/_single_comment.html' with comment=comment hide_votes=1 %}
+      {% include 'comments/_single_comment.html' with comment=comment %}
     </div>
 
     <div class="col-md-6">
diff --git a/comments/templates/comments/reply_to_comment.html b/comments/templates/comments/reply_to_comment.html
index 9a12df828..18184ce36 100644
--- a/comments/templates/comments/reply_to_comment.html
+++ b/comments/templates/comments/reply_to_comment.html
@@ -33,8 +33,6 @@
 
           {% include 'comments/_comment_categories.html' with comment=comment class='mr-2' %}
 
-          {% include 'comments/_comment_voting_summary.html' with comment=comment %}
-
           <p>{{ comment.comment_text|automarkup }}</p>
         </div>
       </div>
diff --git a/comments/urls.py b/comments/urls.py
index 9e7f8cdb8..43403fc1a 100644
--- a/comments/urls.py
+++ b/comments/urls.py
@@ -18,8 +18,4 @@ urlpatterns = [
     url(r'^(?P<comment_id>[0-9]+)/reply$', views.reply_to_comment, name='reply_to_comment'),
     url(r'^(?P<comment_id>[0-9]+)/vet$', views.vet_submitted_comment,
         name='vet_submitted_comment'),
-    url(r'^(?P<comment_id>[0-9]+)/express_opinion$', views.express_opinion,
-        name='express_opinion'),
-    url(r'^(?P<comment_id>[0-9]+)/express_opinion/(?P<opinion>[AND])$', views.express_opinion,
-        name='express_opinion'),
 ]
diff --git a/comments/views.py b/comments/views.py
index b12faca8c..859fe0f53 100644
--- a/comments/views.py
+++ b/comments/views.py
@@ -249,14 +249,6 @@ def reply_to_report(request, report_id):
     return render(request, 'comments/reply_to_report.html', context)
 
 
-@permission_required('scipost.can_express_opinion_on_comments', raise_exception=True)
-def express_opinion(request, comment_id, opinion):
-    # A contributor has expressed an opinion on a comment
-    comment = get_object_or_404(Comment, pk=comment_id)
-    comment.update_opinions(request.user.contributor.id, opinion)
-    return redirect(comment.get_absolute_url())
-
-
 def attachment(request, comment_id):
     """
     Open/read attachment of Comment if available.
diff --git a/scipost/management/commands/add_groups_and_permissions.py b/scipost/management/commands/add_groups_and_permissions.py
index 0d54ab481..3398db3a2 100644
--- a/scipost/management/commands/add_groups_and_permissions.py
+++ b/scipost/management/commands/add_groups_and_permissions.py
@@ -129,10 +129,6 @@ class Command(BaseCommand):
             codename='can_submit_comments',
             name='Can submit Comments',
             content_type=content_type)
-        can_express_opinion_on_comments, created = Permission.objects.get_or_create(
-            codename='can_express_opinion_on_comments',
-            name='Can express opinion on Comments',
-            content_type=content_type)
         can_request_commentary_pages, created = Permission.objects.get_or_create(
             codename='can_request_commentary_pages',
             name='Can request opening of Commentara Pages',
diff --git a/scipost/templates/scipost/contributor_info.html b/scipost/templates/scipost/contributor_info.html
index f544bf47d..d89cdc728 100644
--- a/scipost/templates/scipost/contributor_info.html
+++ b/scipost/templates/scipost/contributor_info.html
@@ -127,7 +127,7 @@
         <ul class="list-group list-group-flush">
           {% for reply in contributor_authorreplies %}
             <li class="list-group-item">
-              {% include 'comments/_comment_card_extended_content.html' with comment=reply %}
+              {% include 'comments/_comment_card_content.html' with comment=reply %}
             </li>
           {% endfor %}
         </ul>
diff --git a/templates/search/search.html b/templates/search/search.html
index 15ba545b1..d0a3f0c84 100644
--- a/templates/search/search.html
+++ b/templates/search/search.html
@@ -5,102 +5,100 @@
 
 {% block pagetitle %} search{% if form.q.value %}: {{ form.q.value }}{% endif %}{% endblock pagetitle %}
 
-
 {% block breadcrumb %}
-    <nav class="breadcrumb-container">
-        <div class="container">
-            <ol class="breadcrumb">
-                <li class="breadcrumb-item"><a href="{% url 'scipost:index' %}" >Home</a></li>
-                <li class="breadcrumb-item active" aria-current="page">Search</span>
-            </ol>
-        </div>
-    </nav>
+  <nav class="breadcrumb-container">
+    <div class="container">
+      <ol class="breadcrumb">
+        <li class="breadcrumb-item"><a href="{% url 'scipost:index' %}" >Home</a></li>
+        <li class="breadcrumb-item active" aria-current="page">Search</span>
+      </ol>
+    </div>
+  </nav>
 {% endblock %}
 
-
 {% block content %}
 
-
 <div class="row">
-    <div class="col-md-4">
-        <h1>Filter</h1>
-        <form method="get">
-            <div class="form-group">
-                <label for="{{form.q.auto_id}}">{{form.q.label}}</label>
-                <input type="text" name="{{form.q.name}}" class="form-control form-control-lg" id="{{form.q.auto_id}}" aria-describedby="search_help" placeholder="Search term" value="{{form.q.value|default:''}}" required="required">
-                <small id="search_help" class="form-text text-muted">{{form.q.help_text}}</small>
-            </div>
-
-            <div class="form-group">
-                <label>Type</label>
-            </div>
-            <div class="form-group checkboxes auto-submit">
-                {{form.models|checkboxes_as_btn}}
-            </div>
-
-            <label>Date from</label>
-            <div class="form-row">
-                    {{form.start}}
-            </div>
-
-            <label>Date until</label>
-            <div class="form-row">
-                    {{form.end}}
-            </div>
-
-            <div class="form-group pt-2">
-
-                <input type="submit" class="btn btn-primary" value="Search">
-                <a href="{% url 'scipost:search' %}" class="btn btn-outline-danger ml-2">Reset</a>
-            </div>
-        </form>
-    </div>
-    <div class="col-md-8">
-        <h1 class="my-3 mt-md-0">Search results{% if results_count and query %} ({{results_count}} found){% endif %}</h1>
-
-        {# without this logic, an request without GET parameters would return *all* objects indexed by Haystack #}
-        {% if query %}
-            <ul class="list-group list-group-flush">
-                {% for result in object_list %}
-                    <li class="list-group-item{% if result.content_type == 'journals.publication' %} border-0{% endif %}">
-                        {% if result.content_type == 'submissions.submission' %}
-                            {% include 'partials/submissions/search_card.html' with submission=result.object %}
-                        {% elif result.content_type == 'commentaries.commentary' %}
-                            {% include 'partials/commentaries/search_card.html' with commentary=result.object %}
-                        {% elif result.content_type == 'theses.thesislink' %}
-                            {% include 'partials/theses/search_card.html' with thesislink=result.object %}
-                        {% elif result.content_type == 'comments.comment' %}
-                            <div class="py-2">
-                                {% include 'partials/comments/search_card.html' with comment=result.object %}
-                            </div>
-                        {% elif result.content_type == 'journals.publication' %}
-                            <div class="card card-publication">
-                                {% include 'partials/journals/search_card.html' with publication=result.object %}
-                            </div>
-                        {% else %}
-                            <a href="{{ result.object.get_absolute_url }}">{{ result.object.title }}</a>
-                        {% endif %}
-                    </li>
-                {% empty %}
-                    <p>Your search query did not return any result.</p>
-                {% endfor %}
-
-                {% if is_paginated %}
-                    <p>
-                      {% if page_obj.has_previous %}
-                        <a href="?q={{ query }}&amp;page={{ page_obj.previous_page_number }}">Previous</a>
-                      {% endif %}
-                      Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
-                      {% if page_obj.has_next %}
-                        <a href="?q={{ query }}&amp;page={{ page_obj.next_page_number }}">Next</a>
-                      {% endif %}
-                    </p>
-                {% endif %}
-            </ul>
-        {% else %}
-            <p>Your search query did not return any result.</p>
+  <div class="col-md-4">
+    <h1>Filter</h1>
+    <form method="get">
+      <div class="form-group">
+        <label for="{{ form.q.auto_id }}">{{ form.q.label }}</label>
+        <input type="text" name="{{ form.q.name }}" class="form-control form-control-lg" id="{{ form.q.auto_id }}" aria-describedby="search_help" placeholder="Search term" value="{{ form.q.value|default:'' }}" required="required">
+        <small id="search_help" class="form-text text-muted">{{ form.q.help_text }}</small>
+      </div>
+
+      <div class="form-group">
+        <label>Type</label>
+      </div>
+      <div class="form-group checkboxes auto-submit">
+        {{ form.models|checkboxes_as_btn }}
+      </div>
+
+      <label>Date from</label>
+      <div class="form-row">
+        {{ form.start }}
+      </div>
+
+      <label>Date until</label>
+      <div class="form-row">
+        {{ form.end }}
+      </div>
+
+      <div class="form-group pt-2">
+
+        <input type="submit" class="btn btn-primary" value="Search">
+        <a href="{% url 'scipost:search' %}" class="btn btn-outline-danger ml-2">Reset</a>
+      </div>
+    </form>
+  </div>
+
+  <div class="col-md-8">
+    <h1 class="my-3 mt-md-0">Search results{% if results_count and query %} ({{ results_count }} found){% endif %}</h1>
+
+    {# without this logic, an request without GET parameters would return *all* objects indexed by Haystack #}
+    {% if query %}
+      <ul class="list-group list-group-flush">
+        {% for result in object_list %}
+          <li class="list-group-item{% if result.content_type == 'journals.publication' %} border-0{% endif %}">
+            {% if result.content_type == 'submissions.submission' %}
+              {% include 'partials/submissions/search_card.html' with submission=result.object %}
+            {% elif result.content_type == 'commentaries.commentary' %}
+              {% include 'partials/commentaries/search_card.html' with commentary=result.object %}
+            {% elif result.content_type == 'theses.thesislink' %}
+              {% include 'partials/theses/search_card.html' with thesislink=result.object %}
+            {% elif result.content_type == 'comments.comment' %}
+              <div class="py-2">
+                {% include 'partials/comments/search_card.html' with comment=result.object %}
+              </div>
+            {% elif result.content_type == 'journals.publication' %}
+              <div class="card card-publication">
+                {% include 'partials/journals/search_card.html' with publication=result.object %}
+              </div>
+            {% else %}
+              <a href="{{ result.object.get_absolute_url }}">{{ result.object.title }}</a>
+            {% endif %}
+          </li>
+        {% empty %}
+          <p>Your search query did not return any result.</p>
+        {% endfor %}
+
+        {% if is_paginated %}
+          <p>
+            {% if page_obj.has_previous %}
+              <a href="?q={{ query }}&amp;page={{ page_obj.previous_page_number }}">Previous</a>
+            {% endif %}
+            Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
+            {% if page_obj.has_next %}
+              <a href="?q={{ query }}&amp;page={{ page_obj.next_page_number }}">Next</a>
+            {% endif %}
+          </p>
         {% endif %}
-    </div>
+      </ul>
+    {% else %}
+      <p>Your search query did not return any result.</p>
+    {% endif %}
+  </div>
 </div>
 
 {% endblock content %}
-- 
GitLab