From c1bd4128c351b343258105e1eb99603ba5f9cb05 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Thu, 3 Oct 2024 14:59:40 +0200
Subject: [PATCH] add prominent support options and donate button

---
 .../scipost/portal/_home_donate_prompt.html   | 52 +++++++++++++++++++
 .../scipost/portal/_home_register_prompt.html |  2 +-
 .../templates/scipost/portal/_hx_home.html    | 18 +++++--
 scipost_django/scipost/views.py               |  2 +-
 4 files changed, 68 insertions(+), 6 deletions(-)
 create mode 100644 scipost_django/scipost/templates/scipost/portal/_home_donate_prompt.html

diff --git a/scipost_django/scipost/templates/scipost/portal/_home_donate_prompt.html b/scipost_django/scipost/templates/scipost/portal/_home_donate_prompt.html
new file mode 100644
index 000000000..0effdb688
--- /dev/null
+++ b/scipost_django/scipost/templates/scipost/portal/_home_donate_prompt.html
@@ -0,0 +1,52 @@
+{% load static %}
+
+<div class="card border border-2 rounded border-warning mb-3">
+  <div class="card-header bg-warning d-flex flex-row justify-content-between align-items-center">
+    <h2 class="mb-0 card-title text-white">We need your URGENT support</h2>
+    <span class="fs-2 text-white">{% include "bi/exclamation-triangle-fill.html" %}</span>
+  </div>
+
+  <div class="card-body">
+    <p>
+      SciPost guarantees free online access to all publications in all its Journals and does not charge any article processing fees for publishing. <a href="{% url "organizations:organizations" %}">Supporting organizations</a> provide <a href="{% url "finances:subsidies" %}">operating funds</a> to SciPost through a cost-slashing consortial model.
+    </p>
+    <p class="mb-0">
+      Scientists, please help us out: if it is not listed on our organization page, please encourage your institution (through a librarian, Open Access officer, director, ...) to join by personally emailing them directly.
+    </p>
+
+    <div class="d-flex flex-column gap-2 my-3">
+
+      <a href="mailto:?subject=Petition to support SciPost&body={% autoescape on %}{% include 'petitions/petition_email.html' %}{% endautoescape %}&cc=sponsors@scipost.org"
+         class="btn bg-primary text-white">Contact your institution
+        <span class="ms-2">{% include "bi/envelope-fill.html" %}</span>
+      </a>
+
+    </div>
+ 
+    <p>
+      Direct contributions from research budgets earmarked for open-access publishing are welcome.
+      Please use the buttons below to obtain a personalised invoice, or donate directly.
+    </p>
+
+    <div class="d-flex flex-column gap-2">
+      <a href="mailto:sponsors@scipost.org?subject=Direct donation to SciPost"
+         class="btn border border-2 border-primary">Direct contribution via invoice
+        <span class="ms-2">{% include "bi/envelope-fill.html" %}</span>
+      </a>
+
+      <form action="https://www.paypal.com/cgi-bin/webscr"
+            class="btn border border-2 border-primary p-0"
+            method="post"
+            target="_top">
+        <input type="hidden" name="cmd" value="_s-xclick" />
+        <input type="hidden" name="hosted_button_id" value="L58JMPWAXGUTW" />
+        <button class="btn w-100 d-flex flex-row gap-3 align-items-center justify-content-center">
+          Donate via
+          <img src="https://www.paypalobjects.com/webstatic/mktg/Logo/pp-logo-100px.png"
+               alt="PayPal - The safer, easier way to pay online!" />
+        </button>
+      </form>
+    </div>
+ 
+  </div>
+</div>
diff --git a/scipost_django/scipost/templates/scipost/portal/_home_register_prompt.html b/scipost_django/scipost/templates/scipost/portal/_home_register_prompt.html
index 23cf8f508..b1ad594a1 100644
--- a/scipost_django/scipost/templates/scipost/portal/_home_register_prompt.html
+++ b/scipost_django/scipost/templates/scipost/portal/_home_register_prompt.html
@@ -1,6 +1,6 @@
 {% if not user.is_authenticated %}
   <!-- Register -->
-  <div class="card border border-danger mb-3">
+  <div class="card border mb-3">
     <div class="card-header">
       <h2 class="fs-2">Register</h2>
     </div>
diff --git a/scipost_django/scipost/templates/scipost/portal/_hx_home.html b/scipost_django/scipost/templates/scipost/portal/_hx_home.html
index 6381d8e7c..1d326f0f2 100644
--- a/scipost_django/scipost/templates/scipost/portal/_hx_home.html
+++ b/scipost_django/scipost/templates/scipost/portal/_hx_home.html
@@ -5,7 +5,9 @@
 
     {% include 'scipost/portal/_home_scipost_intro.html' %}
 
-    <div class="d-block d-md-none">{% include 'scipost/portal/_home_register_prompt.html' %}</div>
+    <div class="d-block d-md-none">
+      {% include 'scipost/portal/_home_register_prompt.html' %}
+    </div>
 
     <div hx-trigger="load once"
          hx-swap="outerHTML"
@@ -28,12 +30,18 @@
 
   <div class="col-md-4">
 
-    <div class="d-none d-md-block">{% include 'scipost/portal/_home_register_prompt.html' %}</div>
+    <div class="d-none d-md-block">
+      {% include 'scipost/portal/_home_donate_prompt.html' %}
+    </div>
+
+    <div class="d-none d-md-block">
+      {% include 'scipost/portal/_home_register_prompt.html' %}
+    </div>
 
     <!-- News -->
     <div class="news">
       <h2 class="highlight mt-0">
-        <a href="{% url "news:news" %}" class="text-body fs-2">News</a>
+        <a href="{% url "news:news" %}" class="text-body fs-2">Latest News</a>
       </h2>
       <ul>
 
@@ -136,7 +144,9 @@
         <p>
           Regarding our operations, we run them in the most efficient way possible, with <strong>complete transparency</strong>, for the benefit not only of scientists worldwide, but also of their supporting Organizations (and anybody else interested in science).
         </p>
-        <p>More information about our business model can be found <a href="{% url "finances:business_model" %}">here</a>.</p>
+        <p>
+          More information about our business model can be found <a href="{% url "finances:business_model" %}">here</a>.
+        </p>
       </div>
     </div>
 
diff --git a/scipost_django/scipost/views.py b/scipost_django/scipost/views.py
index c3520b09e..00410a85b 100644
--- a/scipost_django/scipost/views.py
+++ b/scipost_django/scipost/views.py
@@ -213,7 +213,7 @@ def portal(request):
 def portal_hx_home(request):
     """Homepage view of SciPost."""
     if NewsItem.objects.homepage().exists():
-        news_items = NewsItem.objects.homepage().order_by("-date")[:3]
+        news_items = NewsItem.objects.homepage().order_by("-date")[:1]
     else:
         news_items = NewsItem.objects.none()
     latest_blogpost = BlogPost.objects.published().first()
-- 
GitLab