diff --git a/scipost_django/scipost/static/scipost/assets/css/_homepage.scss b/scipost_django/scipost/static/scipost/assets/css/_homepage.scss index 76941d407e736c2ca3a5064b9a353525f9842477..937f9a57b719c0d0f16e7eba47681d0d95479dc3 100644 --- a/scipost_django/scipost/static/scipost/assets/css/_homepage.scss +++ b/scipost_django/scipost/static/scipost/assets/css/_homepage.scss @@ -294,7 +294,7 @@ } -#portal-tablist-home3 { +#portal-tablist { background-color: $scipost-blue50; list-style: none; diff --git a/scipost_django/scipost/templates/scipost/header.html b/scipost_django/scipost/templates/scipost/header.html index ce6481d0f38b44b5c0118643be6045d2530c182e..19967d75bd4233e9bc60345c4f3e48794fee8d0d 100644 --- a/scipost_django/scipost/templates/scipost/header.html +++ b/scipost_django/scipost/templates/scipost/header.html @@ -1,14 +1,30 @@ {% load static %} {% load crispy_forms_tags %} -<header class="py-2"> - <div class="container"> - <div class="d-md-flex justify-content-between"> - <div class="logobox"> - <a href="{% url 'scipost:index' %}"><img src="{% static 'scipost/images/logo_scipost_RGB_HTML_groot.png' %}" alt="SciPost logo" width="180" /></a> +<header> + + <div class="d-lg-flex justify-content-between p-4 pb-0 pb-lg-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="ms-auto me-0 my-4 my-md-auto"> + <div class="mx-2 my-4 my-lg-auto"> + <form id="session_acad_field_form" style="display: none;" + 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="hide.bs.tab from:#home-tab, session-acad-field-set from:body" + > + </div> + + <div class="ms-2 mt-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 }}"> @@ -20,8 +36,6 @@ </div> </div> - {% block header_sup %} - {% endblock header_sup %} - </div> + </header> diff --git a/scipost_django/scipost/templates/scipost/header_with_acad_field_and_spec3.html b/scipost_django/scipost/templates/scipost/header_with_acad_field_and_spec3.html deleted file mode 100644 index 19967d75bd4233e9bc60345c4f3e48794fee8d0d..0000000000000000000000000000000000000000 --- a/scipost_django/scipost/templates/scipost/header_with_acad_field_and_spec3.html +++ /dev/null @@ -1,41 +0,0 @@ -{% load static %} -{% load crispy_forms_tags %} - -<header> - - <div class="d-lg-flex justify-content-between p-4 pb-0 pb-lg-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" style="display: none;" - 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="hide.bs.tab from:#home-tab, session-acad-field-set from:body" - > - </div> - - <div class="ms-2 mt-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 {% include 'bi/search.html' %} - </label> - </div> - </form> - </div> - </div> - - - -</header> diff --git a/scipost_django/scipost/templates/scipost/navbar.html b/scipost_django/scipost/templates/scipost/navbar.html index a825a9c7bbcddd69da544fb39301b7db648504b4..31d1b0748a5b98806047505de0e5ab51c55376a3 100644 --- a/scipost_django/scipost/templates/scipost/navbar.html +++ b/scipost_django/scipost/templates/scipost/navbar.html @@ -7,198 +7,101 @@ {% is_active_fellow request.user as is_active_fellow %} - - -<nav class="navbar navbar-expand-lg main-nav"> +<!-- <nav class="navbar navbar-expand-sm main-nav"> + <div class="container"> + <button class="navbar-toggler p-0 border-0" type="button" data-bs-toggle="collapse" data-bs-target="#main-navbar" aria-label="Navbar toggler"> + <span class="navbar-toggler-icon">{% include 'bi/list.html' %}</span> + </button> + <div class="collapse navbar-collapse mt-3" id="main-navbar"> --> + +<nav class="navbar main-nav p-2"> <div class="container"> - <button class="navbar-toggler p-0 border-0" type="button" data-bs-toggle="collapse" data-bs-target="#main-navbar" aria-label="Navbar toggler"> - <span class="navbar-toggler-icon">{% include 'bi/list.html' %}</span> - </button> - <div class="collapse navbar-collapse mt-lg-0 mt-3" id="main-navbar"> - <ul class="navbar-nav me-auto"> - - <li class="nav-item{% if request.path == '/' %} active{% endif %}"> - <a href="{% url 'scipost:index' %}" 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> - <span class="d-lg-none d-inline-block">Home</span> - </a> - </li> - - <li class="nav-item dropdown"> - <a class="nav-link dropdown-toggle" href="#" id="JournalsDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Journals</a> - <div class="dropdown-menu mega-menu mega-menu-2" aria-labelledby="JournalsDropdown"> - <div class="row"> - <div class="col-md-6"> - <div class="dropdown-item"><a href="{% url 'journals:journals' %}">Journals homepage</a></div> - </div> - <div class="col-md-6"> - <div class="dropdown-item"><a href="{% url 'journals:publications' %}">View all publications</a></div> - </div> - </div> - <div class="dropdown-divider"></div> - - <table class="table table-bordered table-secondary"> - <thead class="table-dark"> - <tr> - <th class="px-2 py-1"><small>Branch of Science</small></th> - <th class="px-2 py-1"><small>Fields <em>(click to see field-specific detailed list)</em></small></th> - </tr> - </thead> - <tbody> - {% for branch in branches %} - {% if branch.journals.all|length > 0 %} - <tr> - <td class="align-middle"> - <small>{{ branch.name }}</small> - </td> - <td> - {% for acad_field in branch.academic_fields.all %} - {% if acad_field.journals.active.all|length > 0 %} - <a href={% url 'journals:journals' %}?field={{ acad_field.slug }} class="btn btn-primary btn-sm"><small>{{ acad_field.name }}</small></a> - {% endif %} - {% endfor %} - </td> - </tr> - {% endif %} - {% endfor %} - </tbody> - </table> - - </div> - </li> - - - - - <li class="nav-item{% if '/submissions/' in request.path %} active{% endif %} dropdown"> - <!-- <a class="nav-link" href="{% url 'submissions:submissions' %}">Submissions</a> --> - <a class="nav-link dropdown-toggle" href="#" id="SubmissionsDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-trigger="hover">Submissions</a> - <div class="dropdown-menu mega-menu mega-menu-2" aria-labelledby="SubmissionsDropdown"> - <div class="row"> - <div class="col-md-6"> - <div class="dropdown-item"><a href="{% url 'submissions:submissions' %}">View all Submissions</a></div> - </div> - <div class="col-md-6"> - <div class="dropdown-item"><a href="{% url 'submissions:submit_manuscript' %}">Submit a manuscript</a></div> - <div class="dropdown-item"><a href="{% url 'submissions:author_guidelines' %}">Author guidelines</a></div> - <div class="dropdown-item"><a href="{% url 'submissions:referee_guidelines' %}">Referee guidelines</a></div> - <div class="dropdown-item"><a href="{% url 'colleges:colleges' %}">Editorial Colleges</a></div> - </div> - </div> - <div class="dropdown-divider"></div> - <table class="table table-bordered table-secondary"> - <thead class="table-dark"> - <tr> - <th class="px-2 py-1"><small>Branch of Science</small></th> - <th class="px-2 py-1"><small>Fields <em>(click to see field-specific detailed list)</em></small></th> - </tr> - </thead> - <tbody> - {% for branch in branches %} - {% if branch.submissions.all|length > 0 %} - <tr> - <td class="align-middle"> - <small>{{ branch.name }}</small> - </td> - <td> - {% for acad_field in branch.academic_fields.all %} - {% if acad_field.submissions.all|length > 0 %} - <a href={% url 'submissions:submissions' %}?field={{ acad_field.slug }} class="btn btn-primary btn-sm"><small>{{ acad_field.name }}</small></a> - {% endif %} - {% endfor %} - </td> - </tr> - {% endif %} - {% endfor %} - </tbody> - </table> - </div> - </li> - - <li class="nav-item dropdown"> - <a class="nav-link dropdown-toggle" href="#" id="MoreDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-trigger="hover">More</a> - <div class="dropdown-menu" aria-labelledby="MoreDropdown"> - <div class="dropdown-item"> - <a href="{% url 'comments:comments' %}">Comments</a> - </div> - <div class="dropdown-item"> - <a href="{% url 'commentaries:commentaries' %}">Commentaries</a> - </div> - <div class="dropdown-item"> - <a href="{% url 'theses:theses' %}">Theses</a> - </div> - </div> - </li> - - <li class="nav-item dropdown"> - <a class="nav-link dropdown-toggle" href="#" id="AboutDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-trigger="hover">About SciPost</a> - <div class="dropdown-menu" aria-labelledby="AboutDropdown"> - <div class="dropdown-item"> - <a href="{% url 'scipost:contact' %}">Contact us</a> - </div> - <div class="dropdown-item"> - <a href="{% url 'scipost:about' %}">About SciPost</a> - </div> - - <div class="dropdown-item"> - <a href="{% url 'scipost:foundation' %}">The Foundation</a> - </div> - - <div class="dropdown-item"> - <a href="{% url 'careers:jobopenings' %}">Careers@SciPost</a> - </div> - - <div class="dropdown-divider"></div> - - <div class="dropdown-item"> - <a href="{% url 'scipost:FAQ' %}">FAQ</a> - </div> - - <div class="dropdown-item"> - <a href="{% url 'news:news' %}">News</a> - </div> - - <div class="dropdown-item"> - <a href="{% url 'scipost:feeds' %}">Feeds</a> - </div> - - <div class="dropdown-divider"></div> - - <div class="dropdown-item"> - <a href="{% url 'finances:business_model' %}">Our Business Model</a> - </div> - - <div class="dropdown-item"> - <a href="{% url 'organizations:organizations' %}">Organizations<br/><span class="small">benefitting from our activities</span></a> - </div> - - <div class="dropdown-item"> - <a href="{% url 'sponsors:sponsors' %}">Sponsors</a> - </div> + <div class="flex-fill" id="main-navbar"> + <ul class="nav nav-pills flex-wrap flex-sm-row mb-0 justify-content-center" + id="portal-tablist" + role="tablist"> + + <li class="nav-item" role="presentation"> + <button class="nav-link active" id="home-tab" + data-bs-toggle="tab" data-bs-target="#home" + type="button" role="tab" + aria-controls="home" aria-selected="true"> + Home + </button> + </li> + + <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" 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-2 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 <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> --> + + <li class="nav-item" role="presentation"> + <a class="btn btn-outline-success border-2 border-success ms-2" + href="{% url 'submissions:submit_manuscript' %}"> + {% include 'bi/arrow-right.html' %}<strong>Submit</strong> + </a> + </li> - <div class="dropdown-item"> - <a href="{% url 'finances:finances' %}">Finances</a> - </div> - - </div> - </li> - - </ul> - - <hr class="lg d-lg-none"> - - <ul class="navbar-nav me-0"> {% if user.is_authenticated %} - <li class="nav-item dropdown"> + <li class="nav-item dropdown me-lg-2 ms-lg-auto"> <a class="nav-link dropdown-toggle" href="#" id="PersonalDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-trigger="hover"> - Logged in as {% if user.last_name %}{% if user.contributor %}{{ user.contributor.profile.get_title_display }} {% endif %}{{ user.first_name }} {{ user.last_name }}{% else %}{{ user.username }}{% endif %}</a> + Logged in as {% if user.last_name %}{% if user.contributor %}{{ user.contributor.profile.get_title_display }} {% endif %}{{ user.first_name }} {{ user.last_name }}{% else %}{{ user.username }}{% endif %}</a> {% if request.user.contributor and not request.user.contributor.is_currently_available %} - <button type="button" class="btn btn-link p-0 text-warning" data-bs-toggle="tooltip" data-bs-title="You are currently unavailable.<br>Check your availability on your Personal Page if this should not be the case." data-bs-html="true">{% include 'bi/exclamation-triangle-fill.html' %}</button> - + <button type="button" class="btn btn-link p-0 text-warning" data-bs-toggle="tooltip" data-bs-title="You are currently unavailable.<br>Check your availability on your Personal Page if this should not be the case." data-bs-html="true">{% include 'bi/exclamation-triangle-fill.html' %}</button> + {% endif %} <div class="dropdown-menu dropdown-menu-right" aria-labelledby="PersonalDropdown"> - {% if user.contributor %} + {% if user.contributor %} <div class="dropdown-item"> <a href="{% url 'scipost:personal_page' %}">Personal Page</a> </div> @@ -207,38 +110,35 @@ <a href="{% url 'submissions:pool' %}">Submissions Pool</a> </div> {% endif %} - {% endif %} - {% if perms.scipost.can_view_production %} + {% endif %} + {% if perms.scipost.can_view_production %} <div class="dropdown-item"> <a href="{% url 'production:production' %}">Production</a> </div> - {% endif %} - {% if perms.scipost.can_manage_organizations or user.org_contact %} + {% endif %} + {% if perms.scipost.can_manage_organizations or user.org_contact %} <div class="dropdown-item"> <a href="{% url 'organizations:dashboard' %}">Orgs dashboard</a> </div> - {% endif %} + {% endif %} <div class="dropdown-divider"></div> <div class="dropdown-item"> <a href="{% url 'forums:forums' %}">Forums and Meetings</a> </div> - <div class="dropdown-divider"></div> + <div class="dropdown-divider"></div> <div class="dropdown-item"> <a href="{% url 'helpdesk:helpdesk' %}">Helpdesk</a> </div> - <div class="dropdown-divider"></div> - <div class="dropdown-item"> + <div class="dropdown-divider"></div> + <div class="dropdown-item"> <a href="{% url 'scipost:logout' %}?next={{ request.path }}">Logout</a> - </div> + </div> </div> - </li> - <li class="nav-item"> -  <a href="{% url 'helpdesk:ticket_create' %}" target="_blank" class="nav-link"><span style="font-size: 80%;" data-bs-toggle="tooltip" data-bs-html="true" title="Notice something wrong?<br/>Open a support ticket">{% include 'bi/sticky-fill.html' %}</span></a> + <a href="{% url 'helpdesk:ticket_create' %}" target="_blank" class="nav-link"><span style="font-size: 80%;" data-bs-toggle="tooltip" data-bs-html="true" title="Notice something wrong?<br/>Open a support ticket">{% include 'bi/sticky-fill.html' %}</span></a> </li> - {% else %} - <li class="nav-item{% if request.path == '/login/' %} active{% endif %}"> + <li class="me-lg-2 ms-lg-auto nav-item{% if request.path == '/login/' %} active{% endif %}"> <a class="nav-link" href="{% url 'scipost:login' %}?next={{request.path}}">Login or register</a> </li> {% endif %} diff --git a/scipost_django/scipost/templates/scipost/portal/_hx_home3.html b/scipost_django/scipost/templates/scipost/portal/_hx_home.html similarity index 100% rename from scipost_django/scipost/templates/scipost/portal/_hx_home3.html rename to scipost_django/scipost/templates/scipost/portal/_hx_home.html diff --git a/scipost_django/scipost/templates/scipost/portal/navbar.html b/scipost_django/scipost/templates/scipost/portal/navbar.html index 69f7c3c3d3884e2ab92154aee9dd301dc7250223..31d1b0748a5b98806047505de0e5ab51c55376a3 100644 --- a/scipost_django/scipost/templates/scipost/portal/navbar.html +++ b/scipost_django/scipost/templates/scipost/portal/navbar.html @@ -18,7 +18,7 @@ <div class="container"> <div class="flex-fill" id="main-navbar"> <ul class="nav nav-pills flex-wrap flex-sm-row mb-0 justify-content-center" - id="portal-tablist-home3" + id="portal-tablist" role="tablist"> <li class="nav-item" role="presentation"> diff --git a/scipost_django/scipost/templates/scipost/portal/portal3.html b/scipost_django/scipost/templates/scipost/portal/portal.html similarity index 93% rename from scipost_django/scipost/templates/scipost/portal/portal3.html rename to scipost_django/scipost/templates/scipost/portal/portal.html index 2579651146801ca4cd549874dfbe68adad67ce81..b2201e25534cda2f2d0995ac97e6c415a43ede3b 100644 --- a/scipost_django/scipost/templates/scipost/portal/portal3.html +++ b/scipost_django/scipost/templates/scipost/portal/portal.html @@ -10,19 +10,11 @@ {% load render_bundle from webpack_loader %} {% load static %} -{% block navbar %} - {% include 'scipost/portal/navbar.html' %} -{% endblock %} - {% block body_class %}{{ block.super }} homepage home-alt{% endblock %} {% block meta_description %}{{ block.super }} homepage{% endblock meta_description %} {% block pagetitle %}Homepage{% endblock pagetitle %} -{% block header %} - {% include 'scipost/header_with_acad_field_and_spec3.html' %} -{% endblock %} - {% block content %} @@ -30,7 +22,7 @@ <div class="tab-pane portal-tab fade show active" id="home" role="tabpanel" aria-labelledby="home-tab"> - <div hx-get="{% url 'scipost:portal_hx_home3' %}" + <div hx-get="{% url 'scipost:portal_hx_home' %}" hx-trigger="load, click delay:200ms from:#home-tab" > </div> diff --git a/scipost_django/scipost/urls.py b/scipost_django/scipost/urls.py index 1a4f5ce2ee9755e16be40cfe9bd56ae9dedc6683..3ca680c257bec9881f81286dfc3f6c90d202ce7c 100644 --- a/scipost_django/scipost/urls.py +++ b/scipost_django/scipost/urls.py @@ -64,21 +64,21 @@ urlpatterns = [ # Homepage path( - '', + 'index_pre202202', views.index, - name='index' + name='index_pre202202' ), path( - 'home3', - views.index3, - name='index3' + '', + views.index, + name='index' ), # HTMX-delivered fragments path( - 'portal/_hx_home3', - views.portal_hx_home3, - name='portal_hx_home3' + 'portal/_hx_home', + views.portal_hx_home, + name='portal_hx_home' ), path( 'portal/_hx_journals', diff --git a/scipost_django/scipost/views.py b/scipost_django/scipost/views.py index a6650ea1c0b37c7ca8f6f1ff8cbb0ce7470f60ce..0fc4c69bc54fb1d8d48c552a7d1045dd740a3e2a 100644 --- a/scipost_django/scipost/views.py +++ b/scipost_django/scipost/views.py @@ -149,7 +149,7 @@ def trigger_error(request): # Main view ############# -def index(request): +def index_pre202202(request): """Homepage view of SciPost.""" context = { 'news_items': NewsItem.objects.homepage().order_by('-date')[:4], @@ -162,19 +162,7 @@ def index(request): return render(request, 'scipost/index.html', context) -def index2(request): - """Homepage view of SciPost.""" - if NewsItem.objects.homepage().exists(): - latest_newsitem = NewsItem.objects.homepage().order_by('-date').first() - else: - latest_newsitem = NewsItem.objects.none() - context = { - 'latest_newsitem': latest_newsitem - } - return render(request, 'scipost/index2.html', context) - - -def index3(request): +def index(request): if request.GET.get('field', None): request.session['session_acad_field_slug'] = request.GET.get('field', None) request.session['session_specialty_slug'] = '' @@ -183,10 +171,10 @@ def index3(request): 'publications': Publication.objects.published().order_by('-publication_date', '-paper_nr')[:3], } - return render(request, 'scipost/portal/portal3.html', context) + return render(request, 'scipost/portal/portal.html', context) -def portal_hx_home3(request): +def portal_hx_home(request): """Homepage view of SciPost.""" if NewsItem.objects.homepage().exists(): news_items = NewsItem.objects.homepage().order_by('-date')[:3] @@ -197,7 +185,7 @@ def portal_hx_home3(request): 'publications': Publication.objects.published().order_by( '-publication_date', '-paper_nr')[:3], } - return render(request, 'scipost/portal/_hx_home3.html', context) + return render(request, 'scipost/portal/_hx_home.html', context) def portal_hx_publications(request):