From e1ad736ace551ab15e59b930bc69cdd97bea16a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-S=C3=A9bastien=20Caux?= <git@jscaux.org>
Date: Mon, 31 Jan 2022 21:39:04 +0100
Subject: [PATCH] Remove version 2 of portal, 2p2 -> 2

---
 .../header_with_acad_field_and_spec.html      |  52 ++++--
 .../header_with_acad_field_and_spec2p2.html   |  41 -----
 .../scipost/templates/scipost/navbar2.html    |  55 +++---
 .../scipost/templates/scipost/navbar4.html    |   3 -
 .../templates/scipost/portal/portal.html      | 132 ++++++++-------
 .../templates/scipost/portal/portal2p2.html   | 158 ------------------
 scipost_django/scipost/urls.py                |   5 -
 scipost_django/scipost/views.py               |  12 --
 8 files changed, 135 insertions(+), 323 deletions(-)
 delete mode 100644 scipost_django/scipost/templates/scipost/header_with_acad_field_and_spec2p2.html
 delete mode 100644 scipost_django/scipost/templates/scipost/portal/portal2p2.html

diff --git a/scipost_django/scipost/templates/scipost/header_with_acad_field_and_spec.html b/scipost_django/scipost/templates/scipost/header_with_acad_field_and_spec.html
index 5fb64bac0..eecdf7c7c 100644
--- a/scipost_django/scipost/templates/scipost/header_with_acad_field_and_spec.html
+++ b/scipost_django/scipost/templates/scipost/header_with_acad_field_and_spec.html
@@ -1,23 +1,41 @@
-{% extends 'scipost/header.html' %}
+{% load static %}
 {% load crispy_forms_tags %}
 
-{% block header_sup %}
-  <div class="d-md-flex justify-content-center mb-2">
-    <div class="my-4 my-md-auto">
-      <form id="session_acad_field_form"
-	    hx-get="{% url 'ontology:set_session_acad_field' %}"
-	    hx-trigger="change"
-	    hx-swap="outerHTML"
+<header>
+
+    <div class="d-lg-flex justify-content-between p-4 w-100">
+
+      <div class="me-2 my-4 my-md-auto" style="flex: 200px">
+        <a href="{% url 'scipost:index' %}"><img src="{% static 'scipost/images/logo_scipost_RGB_HTML_groot.png' %}" class="m-0 p-0" alt="SciPost logo" style="max-width: unset;" width="180" /></a>
+      </div>
+
+      <div class="mx-2 my-4 my-lg-auto">
+	<form id="session_acad_field_form"
+	      hx-get="{% url 'ontology:set_session_acad_field' %}"
+	      hx-trigger="change"
+	      hx-swap="outerHTML"
+	>
+	  {% crispy session_acad_field_form %}
+	</form>
+      </div>
+      <div class="mx-2 my-4 my-lg-auto"
+	   hx-get="{% url 'ontology:_hx_session_specialty_form' %}"
+	   hx-trigger="load, session-acad-field-set from:body"
       >
-	{% crispy session_acad_field_form %}
-      </form>
-    </div>
-    <div class="ms-md-2 my-4 my-md-auto"
-	 hx-get="{% url 'ontology:_hx_session_specialty_form' %}"
-	 hx-trigger="load, session-acad-field-set from:body"
-    >
+      </div>
+
+      <div class="ms-2 my-4 my-lg-auto">
+	<form id="header-search-form" method="get" action="{% url 'scipost:search' %}">
+          <div class="form-floating">
+            <input type="text" id="headerSearchInput" class="form-control" name="q" placeholder="Search" value="{{ request.GET.q }}">
+	    <label for="headerSearchInput" class="text-white">
+	      Quick search&emsp;{% include 'bi/search.html' %}
+	    </label>
+	  </div>
+	</form>
+      </div>
     </div>
 
-  </div>
 
-{% endblock header_sup %}
+
+</header>
diff --git a/scipost_django/scipost/templates/scipost/header_with_acad_field_and_spec2p2.html b/scipost_django/scipost/templates/scipost/header_with_acad_field_and_spec2p2.html
deleted file mode 100644
index eecdf7c7c..000000000
--- a/scipost_django/scipost/templates/scipost/header_with_acad_field_and_spec2p2.html
+++ /dev/null
@@ -1,41 +0,0 @@
-{% load static %}
-{% load crispy_forms_tags %}
-
-<header>
-
-    <div class="d-lg-flex justify-content-between p-4 w-100">
-
-      <div class="me-2 my-4 my-md-auto" style="flex: 200px">
-        <a href="{% url 'scipost:index' %}"><img src="{% static 'scipost/images/logo_scipost_RGB_HTML_groot.png' %}" class="m-0 p-0" alt="SciPost logo" style="max-width: unset;" width="180" /></a>
-      </div>
-
-      <div class="mx-2 my-4 my-lg-auto">
-	<form id="session_acad_field_form"
-	      hx-get="{% url 'ontology:set_session_acad_field' %}"
-	      hx-trigger="change"
-	      hx-swap="outerHTML"
-	>
-	  {% crispy session_acad_field_form %}
-	</form>
-      </div>
-      <div class="mx-2 my-4 my-lg-auto"
-	   hx-get="{% url 'ontology:_hx_session_specialty_form' %}"
-	   hx-trigger="load, session-acad-field-set from:body"
-      >
-      </div>
-
-      <div class="ms-2 my-4 my-lg-auto">
-	<form id="header-search-form" method="get" action="{% url 'scipost:search' %}">
-          <div class="form-floating">
-            <input type="text" id="headerSearchInput" class="form-control" name="q" placeholder="Search" value="{{ request.GET.q }}">
-	    <label for="headerSearchInput" class="text-white">
-	      Quick search&emsp;{% include 'bi/search.html' %}
-	    </label>
-	  </div>
-	</form>
-      </div>
-    </div>
-
-
-
-</header>
diff --git a/scipost_django/scipost/templates/scipost/navbar2.html b/scipost_django/scipost/templates/scipost/navbar2.html
index be4a1f476..1da72a435 100644
--- a/scipost_django/scipost/templates/scipost/navbar2.html
+++ b/scipost_django/scipost/templates/scipost/navbar2.html
@@ -15,35 +15,6 @@
     <div class="collapse navbar-collapse mt-lg-0 mt-3" id="main-navbar">
       <ul class="navbar-nav me-auto">
 
-	{% if perms.scipost.can_preview_new_features %}
-	  <li class="nav-item dropdown border border-warning">
-            <a class="nav-link dropdown-toggle" href="#" id="HomepagesDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"  data-trigger="hover">
-              <span class="d-none d-lg-inline-block text-warning" aria-hidden="true" style="min-width: 16px;">{% include 'bi/house-fill.html' %}</span>
-              <span class="d-lg-none d-inline-block text-warning">Homepages</span>
-	    </a>
-	    <div class="dropdown-menu" aria-labelledby="HomepagesDropdown">
-	      <div class="dropdown-item">
-		<a href="{% url 'scipost:index' %}">Current homepage</a>
-	      </div>
-	      <div class="dropdown-item">
-		<a href="{% url 'scipost:index2' %}">2: home + portal</a>
-	      </div>
-	      <div class="dropdown-item">
-		<a href="{% url 'scipost:portal2p2' %}">2.2: ----> portal2p2</a>
-	      </div>
-	      <div class="dropdown-item">
-		<a href="{% url 'scipost:index3' %}">3: homepage, restyled</a>
-	      </div>
-	      <div class="dropdown-item">
-		<a href="{% url 'scipost:index4' %}">4: home + portal, into one</a>
-	      </div>
-	      <div class="dropdown-item">
-		<a href="{% url 'scipost:index5' %}">5: hybrid 3/4</a>
-	      </div>
-	    </div>
-	  </li>
-	{% endif %}
-
         <li class="nav-item{% if request.path == '/home2' %} active{% endif %}">
           <a href="{% url 'scipost:index2' %}" class="nav-link" aria-label="SciPost Home">
             <span class="d-none d-lg-inline-block" aria-hidden="true" style="min-width: 16px;">{% include 'bi/house-fill.html' %}</span>
@@ -116,6 +87,32 @@
           </div>
         </li>
 
+	{% if perms.scipost.can_preview_new_features %}
+	  <li class="nav-item dropdown border border-warning">
+            <a class="nav-link dropdown-toggle" href="#" id="HomepagesDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"  data-trigger="hover">
+              <span class="d-none d-lg-inline-block text-warning" aria-hidden="true" style="min-width: 16px;">{% include 'bi/house-fill.html' %}</span>
+              <span class="d-lg-none d-inline-block text-warning">Homepages</span>
+	    </a>
+	    <div class="dropdown-menu" aria-labelledby="HomepagesDropdown">
+	      <div class="dropdown-item">
+		<a href="{% url 'scipost:index' %}">Current homepage</a>
+	      </div>
+	      <div class="dropdown-item">
+		<a href="{% url 'scipost:index2' %}">2: home + portal</a>
+	      </div>
+	      <div class="dropdown-item">
+		<a href="{% url 'scipost:index3' %}">3: homepage, restyled</a>
+	      </div>
+	      <div class="dropdown-item">
+		<a href="{% url 'scipost:index4' %}">4: home + portal, into one</a>
+	      </div>
+	      <div class="dropdown-item">
+		<a href="{% url 'scipost:index5' %}">5: hybrid 3/4</a>
+	      </div>
+	    </div>
+	  </li>
+	{% endif %}
+
       </ul>
 
       <hr class="lg d-lg-none">
diff --git a/scipost_django/scipost/templates/scipost/navbar4.html b/scipost_django/scipost/templates/scipost/navbar4.html
index ef24c3244..7c971a6f9 100644
--- a/scipost_django/scipost/templates/scipost/navbar4.html
+++ b/scipost_django/scipost/templates/scipost/navbar4.html
@@ -28,9 +28,6 @@
 	      <div class="dropdown-item">
 		<a href="{% url 'scipost:index2' %}">2: home + portal</a>
 	      </div>
-	      <div class="dropdown-item">
-		<a href="{% url 'scipost:portal2p2' %}">2.2: ----> portal2p2</a>
-	      </div>
 	      <div class="dropdown-item">
 		<a href="{% url 'scipost:index3' %}">3: homepage, restyled</a>
 	      </div>
diff --git a/scipost_django/scipost/templates/scipost/portal/portal.html b/scipost_django/scipost/templates/scipost/portal/portal.html
index 99d6d3e53..63181f518 100644
--- a/scipost_django/scipost/templates/scipost/portal/portal.html
+++ b/scipost_django/scipost/templates/scipost/portal/portal.html
@@ -20,64 +20,80 @@
 
 {% block content %}
 
-  <ul class="nav nav-pills flex-wrap flex-sm-row mb-3 justify-content-center"
-      role="tablist">
-
-    <li class="nav-item" role="presentation">
-      <button class="nav-link" id="journals-tab"
-	      data-bs-toggle="tab" data-bs-target="#journals"
-	      type="button" role="tab"
-	      aria-controls="journals" aria-selected="true">
-	Journals
-      </button>
-    </li>
-
-    <li class="nav-item" role="presentation">
-      <button class="nav-link active" id="publications-tab"
-	      data-bs-toggle="tab" data-bs-target="#publications"
-	      type="button" role="tab"
-	      aria-controls="publications" aria-selected="true">
-	Publications
-      </button>
-    </li>
-
-    <li class="nav-item" role="presentation">
-      <button class="nav-link" id="submissions-tab"
-	      data-bs-toggle="tab" data-bs-target="#submissions"
-	      type="button" role="tab"
-	      aria-controls="submissions" aria-selected="true">
-	Submissions
-      </button>
-    </li>
-
-    <li class="nav-item" role="presentation">
-      <button class="nav-link border border-warning" id="reports-needed-tab"
-	      data-bs-toggle="tab" data-bs-target="#reports-needed"
-	      type="button" role="tab"
-	      aria-controls="reports-needed" aria-selected="true">
-	Reports needed&nbsp;<span class="text-warning">{% include 'bi/exclamation-square-fill.html' %}</span>
-      </button>
-    </li>
-
-    <li class="nav-item" role="presentation">
-      <button class="nav-link" id="reports-tab"
-	      data-bs-toggle="tab" data-bs-target="#reports"
-	      type="button" role="tab"
-	      aria-controls="reports" aria-selected="true">
-	Reports
-      </button>
-    </li>
-
-    <li class="nav-item" role="presentation">
-      <button class="nav-link" id="comments-tab"
-	      data-bs-toggle="tab" data-bs-target="#comments"
-	      type="button" role="tab"
-	      aria-controls="comments" aria-selected="true">
-	Comments
-      </button>
-    </li>
-
-  </ul>
+
+  <div class="row">
+    <div class="col-lg-3">
+      <ul class="list list-unstyled list-horizontal text-center">
+	<li class="list-item">
+	  <a class="btn btn-outline-success border-2"
+	     href="{% url 'submissions:submit_manuscript' %}">
+	    <strong>Submit a paper</strong>
+	  </a>
+	</li>
+      </ul>
+    </div>
+
+    <div class="col-lg-9">
+      <ul class="nav nav-pills flex-wrap flex-sm-row mb-3 justify-content-center"
+	  role="tablist">
+
+	<li class="nav-item" role="presentation">
+	  <button class="nav-link" id="journals-tab"
+		  data-bs-toggle="tab" data-bs-target="#journals"
+		  type="button" role="tab"
+		  aria-controls="journals" aria-selected="true">
+	    Journals
+	  </button>
+	</li>
+
+	<li class="nav-item" role="presentation">
+	  <button class="nav-link active" id="publications-tab"
+		  data-bs-toggle="tab" data-bs-target="#publications"
+		  type="button" role="tab"
+		  aria-controls="publications" aria-selected="true">
+	    Publications
+	  </button>
+	</li>
+
+	<li class="nav-item" role="presentation">
+	  <button class="nav-link" id="submissions-tab"
+		  data-bs-toggle="tab" data-bs-target="#submissions"
+		  type="button" role="tab"
+		  aria-controls="submissions" aria-selected="true">
+	    Submissions
+	  </button>
+	</li>
+
+	<li class="nav-item" role="presentation">
+	  <button class="nav-link border border-warning" id="reports-needed-tab"
+		  data-bs-toggle="tab" data-bs-target="#reports-needed"
+		  type="button" role="tab"
+		  aria-controls="reports-needed" aria-selected="true">
+	    Reports needed&nbsp;<span class="text-warning">{% include 'bi/exclamation-square-fill.html' %}</span>
+	  </button>
+	</li>
+
+	<li class="nav-item" role="presentation">
+	  <button class="nav-link" id="reports-tab"
+		  data-bs-toggle="tab" data-bs-target="#reports"
+		  type="button" role="tab"
+		  aria-controls="reports" aria-selected="true">
+	    Reports
+	  </button>
+	</li>
+
+	<li class="nav-item" role="presentation">
+	  <button class="nav-link" id="comments-tab"
+		  data-bs-toggle="tab" data-bs-target="#comments"
+		  type="button" role="tab"
+		  aria-controls="comments" aria-selected="true">
+	    Comments
+	  </button>
+	</li>
+
+      </ul>
+    </div>
+  </div>
 
   <hr>
 
diff --git a/scipost_django/scipost/templates/scipost/portal/portal2p2.html b/scipost_django/scipost/templates/scipost/portal/portal2p2.html
deleted file mode 100644
index ec538dadf..000000000
--- a/scipost_django/scipost/templates/scipost/portal/portal2p2.html
+++ /dev/null
@@ -1,158 +0,0 @@
-{% extends 'scipost/base.html' %}
-{% load static %}
-
-{% load render_bundle from webpack_loader %}
-{% load static %}
-
-{% block navbar %}
-  {% include 'scipost/navbar2.html' %}
-{% endblock %}
-
-{% block body_class %}{{ block.super }} homepage{% endblock %}
-
-{% block meta_description %}{{ block.super }} homepage{% endblock meta_description %}
-{% block pagetitle %}Homepage{% endblock pagetitle %}
-
-{% block header %}
-  {% include 'scipost/header_with_acad_field_and_spec2p2.html' %}
-{% endblock %}
-
-
-{% block content %}
-
-
-  <div class="row">
-    <div class="col-lg-3">
-      <ul class="list list-unstyled list-horizontal text-center">
-	<li class="list-item">
-	  <a class="btn text-white" style="background-color: #338844;"
-	     href="{% url 'submissions:submit_manuscript' %}">
-	    Submit a paper
-	  </a>
-	</li>
-      </ul>
-    </div>
-
-    <div class="col-lg-9">
-      <ul class="nav nav-pills flex-wrap flex-sm-row mb-3 justify-content-center"
-	  role="tablist">
-
-	<li class="nav-item" role="presentation">
-	  <button class="nav-link" id="journals-tab"
-		  data-bs-toggle="tab" data-bs-target="#journals"
-		  type="button" role="tab"
-		  aria-controls="journals" aria-selected="true">
-	    Journals
-	  </button>
-	</li>
-
-	<li class="nav-item" role="presentation">
-	  <button class="nav-link active" id="publications-tab"
-		  data-bs-toggle="tab" data-bs-target="#publications"
-		  type="button" role="tab"
-		  aria-controls="publications" aria-selected="true">
-	    Publications
-	  </button>
-	</li>
-
-	<li class="nav-item" role="presentation">
-	  <button class="nav-link" id="submissions-tab"
-		  data-bs-toggle="tab" data-bs-target="#submissions"
-		  type="button" role="tab"
-		  aria-controls="submissions" aria-selected="true">
-	    Submissions
-	  </button>
-	</li>
-
-	<li class="nav-item" role="presentation">
-	  <button class="nav-link border border-warning" id="reports-needed-tab"
-		  data-bs-toggle="tab" data-bs-target="#reports-needed"
-		  type="button" role="tab"
-		  aria-controls="reports-needed" aria-selected="true">
-	    Reports needed&nbsp;<span class="text-warning">{% include 'bi/exclamation-square-fill.html' %}</span>
-	  </button>
-	</li>
-
-	<li class="nav-item" role="presentation">
-	  <button class="nav-link" id="reports-tab"
-		  data-bs-toggle="tab" data-bs-target="#reports"
-		  type="button" role="tab"
-		  aria-controls="reports" aria-selected="true">
-	    Reports
-	  </button>
-	</li>
-
-	<li class="nav-item" role="presentation">
-	  <button class="nav-link" id="comments-tab"
-		  data-bs-toggle="tab" data-bs-target="#comments"
-		  type="button" role="tab"
-		  aria-controls="comments" aria-selected="true">
-	    Comments
-	  </button>
-	</li>
-
-      </ul>
-    </div>
-  </div>
-
-  <hr>
-
-  <div class="tab-content mt-4" id="portalTabContent">
-
-    <div class="tab-pane portal-tab fade" id="journals"
-	 role="tabpanel" aria-labelledby="journals-tab">
-      <div hx-get="{% url 'scipost:portal_hx_journals' %}"
-	   hx-trigger="click delay:200ms from:#journals-tab, session-acad-field-set from:body"
-      >
-      </div>
-    </div>
-
-    <div class="tab-pane portal-tab fade show active" id="publications"
-	 role="tabpanel" aria-labelledby="publications-tab">
-      <div hx-get="{% url 'scipost:portal_hx_publications' %}"
-	   hx-trigger="load, click delay:200ms from:#publications-tab, session-acad-field-set from:body, session-specialty-set from:body"
-      >
-      </div>
-    </div>
-
-    <div class="tab-pane portal-tab fade" id="submissions"
-	 role="tabpanel" aria-labelledby="submissions-tab">
-      <div hx-get="{% url 'scipost:portal_hx_submissions' %}"
-	   hx-trigger="click delay:200ms from:#submissions-tab, session-acad-field-set from:body, session-specialty-set from:body"
-      >
-      </div>
-    </div>
-
-    <div class="tab-pane portal-tab fade" id="reports-needed"
-	 role="tabpanel" aria-labelledby="reports-needed-tab">
-      <div hx-get="{% url 'scipost:portal_hx_submissions' %}?reports_needed=1"
-	   hx-trigger="click delay:200ms from:#reports-needed-tab, session-acad-field-set from:body, session-specialty-set from:body"
-      >
-      </div>
-    </div>
-
-    <div class="tab-pane portal-tab fade" id="reports"
-	 role="tabpanel" aria-labelledby="reports-tab">
-      <div hx-get="{% url 'scipost:portal_hx_reports' %}"
-	   hx-trigger="click delay:200ms from:#reports-tab, session-acad-field-set from:body, session-specialty-set from:body"
-      >
-      </div>
-    </div>
-
-    <div class="tab-pane portal-tab fade" id="comments"
-	 role="tabpanel" aria-labelledby="comments-tab">
-      <div hx-get="{% url 'scipost:portal_hx_comments' %}"
-	   hx-trigger="click delay:200ms from:#comments-tab, session-acad-field-set from:body, session-specialty-set from:body"
-      >
-      </div>
-    </div>
-
-  </div>
-
-{% endblock %}
-
-{% block footer_script %}
-  {{ block.super }}
-  <script nonce="{{ request.csp_nonce }}" src="{% static 'scipost/toggle-proceedings.js' %}">
-  </script>
-{% endblock footer_script %}
diff --git a/scipost_django/scipost/urls.py b/scipost_django/scipost/urls.py
index b1c87b5ec..ec0eb88a3 100644
--- a/scipost_django/scipost/urls.py
+++ b/scipost_django/scipost/urls.py
@@ -96,11 +96,6 @@ urlpatterns = [
         views.portal,
         name='portal'
     ),
-    path(
-        'portal2p2',
-        views.portal2p2,
-        name='portal2p2'
-    ),
 
     # HTMX-delivered fragments
     path(
diff --git a/scipost_django/scipost/views.py b/scipost_django/scipost/views.py
index 348aefd3d..e62b72fc4 100644
--- a/scipost_django/scipost/views.py
+++ b/scipost_django/scipost/views.py
@@ -155,7 +155,6 @@ def index(request):
         'news_items': NewsItem.objects.homepage().order_by('-date')[:4],
         'latest_newsitem': NewsItem.objects.homepage().order_by('-date').first(),
         'submissions': Submission.objects.public().order_by('-submission_date')[:3],
-        # 'journals': Journal.objects.order_by('name'),
         'publications': Publication.objects.published().order_by('-publication_date',
                                                                  '-paper_nr')[:3],
         'current_sponsors': Organization.objects.current_sponsors().order_by('?')[:2]
@@ -221,17 +220,6 @@ def portal(request):
     return render(request, 'scipost/portal/portal.html')
 
 
-@permission_required('scipost.can_preview_new_features', return_403=True)
-def portal2p2(request):
-    """
-    Academic portal entryway.
-    """
-    if request.GET.get('field', None):
-        request.session['session_acad_field_slug'] = request.GET.get('field', None)
-    request.session['session_specialty_slug'] = ''
-    return render(request, 'scipost/portal/portal2p2.html')
-
-
 def portal_hx_home(request):
     """Homepage view of SciPost."""
     if NewsItem.objects.homepage().exists():
-- 
GitLab