Skip to content

Commit

Permalink
Split index to 3 views
Browse files Browse the repository at this point in the history
Each view is accessible from the landing page

We could also use tabs (but then the url is not directly accessible to
reach a given tab (we can set it up, but now make it change in the
browser as we select a tab)
  • Loading branch information
Bachibouzouk committed Nov 13, 2024
1 parent 4bc18c7 commit 5c17e6a
Show file tree
Hide file tree
Showing 8 changed files with 800 additions and 283 deletions.
10 changes: 10 additions & 0 deletions app/projects/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@

urlpatterns = [
path("", home, name="home"),
# TODO provide landing with different URL for different languages
# https://stackoverflow.com/questions/28675442/switch-language-in-django-with-the-translated-url-redirect
# https://docs.djangoproject.com/en/5.1/topics/http/urls/
# TODO https://docs.djangoproject.com/en/5.1/topics/i18n/translation/#translating-url-patterns
path("<int:version>", home, name="home"),
path("commune", landing_commune, name="landing_commune"),
path("cellular", landing_cellular, name="landing_cellular"),
path("index", landing_default, name="landing_default"),
path("commune/<int:version>", landing_commune, name="landing_commune"),
path("cellular/<int:version>", landing_cellular, name="landing_cellular"),
path("index/<int:version>", landing_default, name="landing_default"),
# Project
path("project/create/", project_create, name="project_create"),
path("notimplementedyet/", not_implemented, name="not_implemented"),
Expand Down
24 changes: 24 additions & 0 deletions app/projects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,30 @@ def home(request, version=1):
return render(request, "index.html", {"version": version})


@require_http_methods(["GET"])
def landing_commune(request, version=1):
if request.user.is_authenticated:
return HttpResponseRedirect(reverse("project_search"))
else:
return render(request, "landing/commune.html", {"version": version})


@require_http_methods(["GET"])
def landing_cellular(request, version=1):
if request.user.is_authenticated:
return HttpResponseRedirect(reverse("project_search"))
else:
return render(request, "landing/cellular.html", {"version": version})


@require_http_methods(["GET"])
def landing_default(request, version=1):
if request.user.is_authenticated:
return HttpResponseRedirect(reverse("project_search"))
else:
return render(request, "landing/default.html", {"version": version})


@login_required
@require_http_methods(["POST"])
def scenario_upload(request, proj_id):
Expand Down
296 changes: 13 additions & 283 deletions app/templates/index.html

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions app/templates/landing/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{% load static %}

<section class="about">
<div class="about__wrap">
<!--div class="about__heading">
<h2>About us</h2>
</div>
<div class="about__text">
<p></p>
</div-->
<div class="about__logos">
<div class="about__partners">
<div>
<a href="https://www.dgs.de/aktuell/" target="_blank" rel="noopener noreferrer">
<img src="{% static 'assets/logos/2020-03-09_DGS.png' %}" alt="Deutsche Gesellschaft für Sonnenenergie logo">
</a>
</div>
<div>
<a href="https://reiner-lemoine-institut.de/en/" target="_blank" rel="noopener noreferrer">
<img src="{% static 'assets/logos/rlilogo.png' %}" alt="Reiner Lemoine Institut logo">
</a>
</div>
<div>
<a href="https://www.ifam.fraunhofer.de" target="_blank" rel="noopener noreferrer">
<img src="{% static 'assets/logos/ifam_logo.png' %}" alt="Fraunhofer IFAM logo">
</a>
</div>
</div>
<div class="about__support">
{% if "de" in LANGUAGE_NAME %}
<a href="https://www.bmwi.de/Navigation/DE/Home/home.html" target="_blank" rel="noopener noreferrer">
<img src="{% static 'assets/logos/BMWK_Fz_2017_WebSVG_de.svg' %}" alt="Federal Ministry for Economic Affairs and Energy logo">
</a>
{% else %}
<a href="https://www.bmwi.de/Navigation/EN/Home/home.html" target="_blank" rel="noopener noreferrer">
<img src="{% static 'assets/logos/BMWK_Fz_2017_WebSVG_en.svg' %}" alt="Federal Ministry for Economic Affairs and Energy logo">
</a>
{% endif %}
</div>
</div>
</div>
</section>
324 changes: 324 additions & 0 deletions app/templates/landing/cellular.html

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions app/templates/landing/commune.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{% extends 'base.html' %}
{% load static %}
{% load i18n %}


{% block title %} {% translate "Commune" %} {% endblock title %}


{% block head_block %}
<link rel="stylesheet" href="{% static 'css/landing.css' %}">
{% endblock head_block %}

{% block index %}
{% if not user.is_authenticated %}
{% get_current_language as LANGUAGE_NAME %}
<main class="landing-page">

<section class="header">
<div class="header__wrap" style="flex-direction:column;">
<div class="header__heading">
<h1>{% translate "Something about KEP" %}</h1>
<p>{% translate "tbd" %}</p>
</div>
<div class="header__btn">
<a href="#tool-anchor" class="btn btn--full">Learn more</a>
</div>
</div>
</section>


{% include 'landing/newsletter.html' %}
{% include 'landing/about.html' %}


</main>



{% endif %}
{% endblock index %}
Loading

0 comments on commit 5c17e6a

Please sign in to comment.