diff --git a/assets/src/bundles/webapp/webapp.css b/assets/src/bundles/webapp/webapp.css --- a/assets/src/bundles/webapp/webapp.css +++ b/assets/src/bundles/webapp/webapp.css @@ -236,7 +236,7 @@ margin-left: 0; } -#swh-navbar { +.swh-navbar { border-style: solid; border-top-style: none; border-left-style: none; @@ -252,13 +252,17 @@ width: 100%; padding: 5px; margin-bottom: 10px; - margin-top: 60px; + margin-top: 30px; justify-content: normal; flex-wrap: nowrap; height: 72px; overflow: hidden; } +.swh-navbar-banner { + margin-top: 60px !important; +} + #back-to-top { display: none; position: fixed; @@ -365,6 +369,10 @@ } .main-sidebar { + margin-top: 30px; +} + +.main-sidebar-banner { margin-top: 60px; } @@ -763,13 +771,17 @@ text-align: center; letter-spacing: 1px; box-shadow: 0 0 3px rgb(0 0 0 / 30%); - top: 85px; + top: 55px; right: -50px; left: auto; transform: rotate(45deg); z-index: 2000; } +.swh-corner-ribbon-banner { + top: 85px; +} + @media screen and (max-width: 600px) { .swh-corner-ribbon { top: 53px; diff --git a/swh/web/tests/misc/__init__.py b/swh/web/banners/__init__.py rename from swh/web/tests/misc/__init__.py rename to swh/web/banners/__init__.py diff --git a/swh/web/templates/misc/fundraising-banner.html b/swh/web/banners/templates/fundraising-banner.html rename from swh/web/templates/misc/fundraising-banner.html rename to swh/web/banners/templates/fundraising-banner.html diff --git a/swh/web/templates/misc/hiring-banner-iframe.html b/swh/web/banners/templates/hiring-banner-iframe.html rename from swh/web/templates/misc/hiring-banner-iframe.html rename to swh/web/banners/templates/hiring-banner-iframe.html diff --git a/swh/web/templates/misc/hiring-banner.html b/swh/web/banners/templates/hiring-banner.html rename from swh/web/templates/misc/hiring-banner.html rename to swh/web/banners/templates/hiring-banner.html diff --git a/swh/web/banners/urls.py b/swh/web/banners/urls.py new file mode 100644 --- /dev/null +++ b/swh/web/banners/urls.py @@ -0,0 +1,13 @@ +# Copyright (C) 2022 The Software Heritage developers +# See the AUTHORS file at the top-level directory of this distribution +# License: GNU Affero General Public License version 3, or any later version +# See top-level LICENSE file for more information + +from django.urls import re_path as url + +from swh.web.banners.views import fundraising_banner, hiring_banner + +urlpatterns = [ + url(r"^fundraising/banner/$", fundraising_banner, name="swh-fundraising-banner"), + url(r"^hiring/banner/$", hiring_banner, name="swh-hiring-banner"), +] diff --git a/swh/web/misc/fundraising.py b/swh/web/banners/views.py rename from swh/web/misc/fundraising.py rename to swh/web/banners/views.py --- a/swh/web/misc/fundraising.py +++ b/swh/web/banners/views.py @@ -6,7 +6,6 @@ import requests from django.shortcuts import render -from django.urls import re_path as url from django.views.decorators.clickjacking import xframe_options_exempt from swh.web.config import get_config @@ -43,7 +42,7 @@ return render( request, - "misc/fundraising-banner.html", + "fundraising-banner.html", { "nb_donations": nb_donations, "donations_goal": donations_goal, @@ -57,6 +56,15 @@ ) -urlpatterns = [ - url(r"^fundraising/banner/$", fundraising_banner, name="swh-fundraising-banner"), -] +@xframe_options_exempt +def hiring_banner(request): + + lang = request.GET.get("lang") + + return render( + request, + "hiring-banner-iframe.html", + { + "lang": lang if lang else "en", + }, + ) diff --git a/swh/web/config.py b/swh/web/config.py --- a/swh/web/config.py +++ b/swh/web/config.py @@ -166,6 +166,7 @@ "swh.web.badges", "swh.web.archive_coverage", "swh.web.metrics", + "swh.web.banners", ], ), } diff --git a/swh/web/misc/urls.py b/swh/web/misc/urls.py --- a/swh/web/misc/urls.py +++ b/swh/web/misc/urls.py @@ -7,12 +7,10 @@ import requests -from django.conf.urls import include from django.contrib.staticfiles import finders from django.http import JsonResponse from django.shortcuts import render from django.urls import re_path as url -from django.views.decorators.clickjacking import xframe_options_exempt from swh.web.config import get_config from swh.web.utils import archive @@ -45,25 +43,9 @@ return JsonResponse(counters) -@xframe_options_exempt -def hiring_banner(request): - - lang = request.GET.get("lang") - - return render( - request, - "misc/hiring-banner-iframe.html", - { - "lang": lang if lang else "en", - }, - ) - - urlpatterns = [ url(r"^jslicenses/$", _jslicenses, name="jslicenses"), url(r"^stat_counters/$", _stat_counters, name="stat-counters"), - url(r"^", include("swh.web.misc.fundraising")), - url(r"^hiring/banner/$", hiring_banner, name="swh-hiring-banner"), ] diff --git a/swh/web/templates/layout.html b/swh/web/templates/layout.html --- a/swh/web/templates/layout.html +++ b/swh/web/templates/layout.html @@ -138,10 +138,13 @@ -
-