diff --git a/scipost_django/scipost/static/scipost/assets/css/_list_group.scss b/scipost_django/scipost/static/scipost/assets/css/_list_group.scss index c7044c28b28524d7361d746dc55b1c35a0d5372f..86c6255bb6a954247494870bc8e4d86c6bec4d0c 100644 --- a/scipost_django/scipost/static/scipost/assets/css/_list_group.scss +++ b/scipost_django/scipost/static/scipost/assets/css/_list_group.scss @@ -107,6 +107,44 @@ li, } +ul.news-list { + list-style: none; + margin: 0; + padding: 0; + + h3 { + margin: 0.25rem 0; + + a { + color: $scipost-darkblue; + } + } + + li { + margin-right: 0.5rem; + padding: 0.35rem 0; + border-top: 1px solid #bbb; + + &:first-child { + border-top: 0; + } + + p { + max-height: 0; + overflow: hidden; + padding: 0; + margin: 0.5rem 0; + transition: max-height 0.3s ease-in-out; + } + + &:first-child p, + &:hover p { + max-height: 1000px; + } + } +} + + ul.communications { list-style: none; padding: 0; diff --git a/scipost_django/scipost/templates/scipost/index.html b/scipost_django/scipost/templates/scipost/index.html index fe4a349877a9870aa7e7c11b2f98c1bf63b1b4f0..c660c10fb46d806c98aed1baf86cd286bff1858c 100644 --- a/scipost_django/scipost/templates/scipost/index.html +++ b/scipost_django/scipost/templates/scipost/index.html @@ -3,178 +3,94 @@ {% load render_bundle from webpack_loader %} {% load static %} - -{% block headsup %} - {{ block.super }} - <style> - .sp-swap.htmx-added { - opacity: 0; - } - .sp-swap.htmx-swapping { - opacity: 0; - } - .sp-swap { - opacity: 1; - transition: opacity 1s; - } - </style> -{% endblock %} - {% block body_class %}{{ block.super }} homepage{% endblock %} {% block meta_description %}{{ block.super }} homepage{% endblock meta_description %} {% block pagetitle %}Homepage{% endblock pagetitle %} {% block content %} + <div class="row"> + <div class="col-md-4"> + <!-- Latest publications --> + <div class="card card-publications bg-light px-1 mb-2 scipost-bar"> + <div class="card-body pb-0"> + <h2 class="title mb-3">Latest Publications</h2> + <hr class="sm mb-0 mt-2"> + </div> + <ul class="list-group list-group-flush px-3 mb-3"> + {% for publication in publications %} + <li class="list-group-item py-2"> + {% include 'journals/_publication_li_content.html' with publication=publication %} + </li> + {% endfor %} + </ul> + <p class="mb-3 px-3"><a href="{% url 'journals:publications' %}">View all Publications</a></p> + </div><!-- End latest publications --> + </div> - <div class="row gx-4"> - <div class="col-md-8"> - <div class="card"> - <div class="card-header"> - <h1>The Home of Genuine Open Publishing</h1> - </div> - <div class="card-body"> - <p>SciPost is a complete publishing infrastructure serving professional scientists worldwide.</p> - <div class="row g-2"> - <div class="col-lg-6"> - <div class="card"> - <div class="card-header"> - <h3>We implement<br><a href="{% url 'scipost:about' %}#GOA">Genuine Open Access</a></h3> - </div> - <div class="card-body"> - <ul class="list list-unstyled"> - <li>{% include 'bi/check-square.html' %} Community Ownership</li> - <li>{% include 'bi/check-square.html' %} Open Infrastructure</li> - <li>{% include 'bi/check-square.html' %} Copyright to Authors</li> - <li>{% include 'bi/check-square.html' %} Open Access</li> - <li>{% include 'bi/check-square.html' %} Open Citations</li> - <li>{% include 'bi/check-square.html' %} Fee Free</li> - <li>{% include 'bi/check-square.html' %} Non Profit</li> - <li>{% include 'bi/check-square.html' %} Open Finances</li> - <li>{% include 'bi/check-square.html' %} Academic Editing</li> - </ul> - </div> - </div> - </div> - <div class="col-lg-6"> - <div class="card mb-2"> - <div class="card-header"> - <h3>Info</h3> - </div> - <div class="card-body"> - <ul class="list list-unstyled"> - <li>{% include 'bi/arrow-right.html' %} - <a href="{% url 'scipost:about' %}">About SciPost</a></li> - <li>{% include 'bi/arrow-right.html' %} - <a href="{% url 'scipost:foundation' %}">The Foundation</a></li> - <li>{% include 'bi/arrow-right.html' %} - <a href="{% url 'scipost:FAQ' %}">FAQ</a></li> - <li>{% include 'bi/arrow-right.html' %} - <a href="{% url 'scipost:contact' %}">Contact us</a></li> - <li>{% include 'bi/arrow-right.html' %} - <a href="{% url 'careers:jobopenings' %}">Careers@SciPost</a></li> - <li>{% include 'bi/arrow-right.html' %} - <a href="https://disc.{{ request.get_host }}" target="_blank" rel="noopener">{% include 'bi/chat-right-text.html' %} Community</a></li> - <li>{% include 'bi/arrow-right.html' %} - <a href="https://git.{{ request.get_host }}" target="_blank" rel="noopener">{% include 'bi/code-square.html' %} git.{{ request.get_host }}</a></li> - </ul> - </div> - </div> - - {% if not user.is_authenticated %} - <!-- Register --> - <div class="card border border-danger"> - <div class="card-header"> - <h3>Register</h3> - </div> - <div class="card-body"> - <p class="mb-1">Professional scientists (PhD students and above) can become Contributors to SciPost by filling the <a href="{% url 'scipost:register' %}">registration form</a>.</p> - </div><!-- End Register --> - </div> - {% endif %} - </div> - </div> - </div> - </div> + <div class="col-md-4"> + <!-- Latest submissions --> + <div class="card card-submissions bg-light px-1 mb-2 scipost-bar"> + <div class="card-body pb-0"> + <h2 class="title mb-3">Latest Submissions</h2> + <hr class="sm mb-0 mt-2"> + </div> + <ul class="list-group list-group-flush px-3 mb-3"> + {% for submission in submissions %} + <li class="list-group-item py-2"> + {% include 'submissions/_submission_card_content_homepage.html' with submission=submission %} + </li> + {% endfor %} + </ul> + <p class="mb-3 px-3"><a href="{% url 'submissions:submissions' %}">View all Submissions</a></p> + </div><!-- End latest submissions --> </div> + <div class="col-md-4"> - <h2 class="highlight text-center mt-0">Portals</h2> - <div class="d-flex justify-content-center"> - <div class="btn-group-vertical w-100" role="group"> - {% for branch in branches %} - {% if branch.name != 'Multidisciplinary' and branch.journals.all|length > 0 %} - {% for acad_field in branch.academic_fields.all %} - {% if acad_field.journals.active.all|length > 0 %} - <a type="button" class="btn-primary w-100 m-1 p-2 text-center" href={% url 'scipost:portal' %}?field={{ acad_field.slug }}><strong>{{ acad_field.name }}</strong></a> - {% endif %} - {% endfor %} - {% endif %} + {% if not user.is_authenticated %} + <!-- Register --> + <div id="register"> + <h2>Register</h2> + <p class="mb-1">Professional scientists (PhD students and above) can become Contributors to SciPost by filling the <a href="{% url 'scipost:register' %}">registration form</a>.</p> + </div><!-- End Register --> + + <hr class="lg"> + {% endif %} + + <!-- News --> + <div id="news"> + <h2 class="title"> + News + <button class="btn btn-link btn-sm m-0 mb-1" href="{% url 'scipost:feeds' %}" aria-label="RSS feeds">{% include 'bi/rss-fill.html' %}</button> + </h2> + <ul class="news-list"> + {% for news in news_items %} + <li> + <h3><a href="{% url 'news:news' %}#news_{{ news.id }}">{{ news.headline }}</a></h3> + <div class="text-muted">{{ news.date|date:'j F Y' }}</div> + <p> + {{ news.blurb_short }} + <br> + <br> + <a href="{% url 'news:news' %}#news_{{ news.id }}" class="my-1">Read more →</a> + </p> + </li> {% endfor %} - </div> - </div> + </ul> + <a href="{% url 'news:news' %}" class="my-1">See complete News list</a> + </div><!-- End news --> + </div> </div> - {% endblock %} {% block content_footer %} - - <div class="container-fluid text-start secondary pt-4 mt-5 border-top border-primary"> - <div class="row"> - <div class="col"> - <h1 class="title"> - News - <button class="btn btn-link btn-sm m-0 mb-1" href="{% url 'scipost:feeds' %}" aria-label="RSS feeds">{% include 'bi/rss-fill.html' %}</button> - </h1> - </div> - <div class="col"> - <a href="{% url 'news:news' %}" class="my-1 float-right">See complete News list</a> - </div> - </div> - - <div class="row g-2"> - <div class="col-md-6"> - <div class="card"> - <div class="card-header"> - <h3>Latest</h3> - </div> - <div class="card-body"> - <h3><a href="{% url 'news:news' %}#news_{{ latest_newsitem.id }}">{{ latest_newsitem.headline }}</a></h3> - <div class="text-muted">{{ latest_newsitem.date|date:'j F Y' }}</div> - <p> - {{ latest_newsitem.blurb_short }} - <br> - <br> - <a href="{% url 'news:news' %}#news_{{ latest_newsitem.id }}" class="my-1">Read more →</a> - </p> - </div> - </div> - </div> - - <div class="col-md-6"> - <div class="card"> - <div class="card-header"> - <h3>Further news</h3> - </div> - <div class="card-body"> - <div id="further-news" class="sp-swap" - hx-get="{% url 'scipost:_hx_news' %}" - hx-trigger="load" - hx-swap="outerHTML swap:1s" - > - </div> - </div> - </div> - </div> - </div> - </div> - <div class="container-fluid text-start secondary pt-4 mt-5 border-top border-primary"> <div class="row"> <div class="col-md-8"> - <h1>Sponsors</h1> + <h1>Sponsors</h1> <p> SciPost guarantees free online access to all publications in all its Journals and does not charge any article processing fees for publishing. Sponsors provide operating funds to SciPost through a cost-slashing consortial model. </p> @@ -186,23 +102,31 @@ </p> </div> <div class="col-md-4"> - <a href="{% url 'sponsors:sponsors' %}">See all sponsors</a> + <a href="{% url 'sponsors:sponsors' %}">See all sponsors</a> <br> - <div id="sponsor-logos" class="sp-swap" - hx-get="{% url 'scipost:_hx_sponsors' %}" - hx-trigger="load" - hx-swap="outerHTML swap:1s" - > - </div> + <ul class="list list-unstyled"> + {% for sponsor in current_sponsors %} + {% if sponsor.logo %} + <li class="p-2"><img class="rounded" src="{{ sponsor.logo.url }}" alt="{{ sponsor.name }} logo"></li> + {% endif %} + {% endfor %} + </ul> </div> </div> <hr> - <div hx-get="{% url 'scipost:_hx_participates_in' %}" - hx-trigger="load" - > + <div class="row"> + <div class="col-md-4"> + <h1>SciPost participates in</h1> + </div> + <div class="col-md-8 logos"> + <a href="//www.crossref.org" target="_blank" rel="noopener"><img src="//assets.crossref.org/logo/crossref-logo-200.svg" width="100" alt="Crossref logo"></a> + <a href="//www.doaj.org" target="_blank" rel="noopener"><img src="{% static 'scipost/images/doaj_logo_200.jpg' %}" width="90" alt="DOAJ logo"></a> + <a href="//www.clockss.org" target="_blank" rel="noopener"><img src="{% static 'scipost/images/clockss_original_logo_boxed_ai-cropped-90.png' %}" width="80" alt="Clockss logo"></a> + <a href="//i4oc.org/" target="_blank" rel="noopener"><img width="100" src="{% static 'scipost/images/I4OC.png' %}" alt="I4OC logo"></a> + <a href="//freejournals.org" target="_blank" rel="noopener"><img width="100" src="{% static 'scipost/images/FJN-logo-long.png' %}" alt="FJN logo"></a> + </div> </div> - </div> {% endblock %} diff --git a/scipost_django/scipost/urls.py b/scipost_django/scipost/urls.py index 851806ea3f78a194a3565fee6dfcd665fbf11926..78d9f2c25aee15b553b585a290021348dda1f908 100644 --- a/scipost_django/scipost/urls.py +++ b/scipost_django/scipost/urls.py @@ -74,6 +74,12 @@ urlpatterns = [ name='index' ), + path( + 'home2', + views.index2, + name='index2' + ), + # Portal path( 'portal', diff --git a/scipost_django/scipost/views.py b/scipost_django/scipost/views.py index e6fab9adedf6fa9d54cee884ff6c362448609521..557c03c77a070b750f06643c69ac25f4d36e0df8 100644 --- a/scipost_django/scipost/views.py +++ b/scipost_django/scipost/views.py @@ -163,11 +163,25 @@ class SearchView(SearchView): def index(request): """Homepage view of SciPost.""" context = { + '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] } return render(request, 'scipost/index.html', context) +def index2(request): + """Homepage view of SciPost.""" + context = { + 'latest_newsitem': NewsItem.objects.homepage().order_by('-date').first(), + } + return render(request, 'scipost/index2.html', context) + + def portal(request): """ Academic portal entryway.