feat(base): ajoute une page d'accueil pour les visiteurs
parent
f7345d3825
commit
05a6443a33
|
@ -268,9 +268,9 @@
|
|||
"selector-no-vendor-prefix": true,
|
||||
"string-quotes": "double",
|
||||
"value-keyword-case": "lower",
|
||||
"value-list-comma-newline-after": "never-multi-line",
|
||||
"value-list-comma-newline-after": "always-multi-line",
|
||||
"value-list-comma-newline-before": "never-multi-line",
|
||||
"value-list-comma-space-after": "always",
|
||||
"value-list-comma-space-after": "always-single-line",
|
||||
"value-no-vendor-prefix": true
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
|
@ -28,4 +28,4 @@
|
|||
@import "components/tables";
|
||||
|
||||
// Page-specific styles
|
||||
//@import "pages/home";
|
||||
@import "pages/home";
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// Specific styles for the homepage
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
.homepage {
|
||||
color: $white;
|
||||
background-color: $primary;
|
||||
background-image:
|
||||
url("#{$img-path}/hand_top-left.png"),
|
||||
url("#{$img-path}/hand_top-right.png"),
|
||||
url("#{$img-path}/hand_bottom-right.png"),
|
||||
url("#{$img-path}/hand_bottom-left.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position:
|
||||
left 5%,
|
||||
95% top,
|
||||
right 95%,
|
||||
left 101%;
|
||||
background-size: auto 30%;
|
||||
|
||||
@media (orientation: portrait) and (min-height: 540px) {
|
||||
background-size: 40% auto;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px), (min-height: 768px) {
|
||||
background-size: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.homepage-header {
|
||||
position: absolute;
|
||||
top: 1rem;
|
||||
right: 2rem;
|
||||
z-index: $zindex-sticky;
|
||||
}
|
||||
|
||||
.homepage-content {
|
||||
@include grid-cell(shrink);
|
||||
max-width: 600px;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.homepage-lead {
|
||||
@include media-breakpoint-up(md) {
|
||||
font-size: $lead-font-size;
|
||||
}
|
||||
}
|
|
@ -10,27 +10,21 @@ from benevalibre.association.models import Association
|
|||
from benevalibre.utils.tests import count_text_in_content, is_login_view
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
class TestLandingPage:
|
||||
@pytest.mark.parametrize(
|
||||
'use, expected',
|
||||
[
|
||||
(None, 'association:index'),
|
||||
('user', 'base:board'),
|
||||
('staff', 'association:index'),
|
||||
],
|
||||
)
|
||||
def test_get_index(
|
||||
self, client, association, engagement, user, superuser, use, expected
|
||||
):
|
||||
if use == 'staff':
|
||||
client.force_login(superuser)
|
||||
elif use:
|
||||
client.force_login(user)
|
||||
class TestHome:
|
||||
url = reverse_lazy('base:home')
|
||||
|
||||
response = client.get(reverse('base:home'))
|
||||
def test_anonymous(self, client):
|
||||
response = client.get(self.url)
|
||||
assert response.status_code == 200
|
||||
assert count_text_in_content(response, reverse('association:index'))
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_user_redirect(self, client, user):
|
||||
client.force_login(user)
|
||||
|
||||
response = client.get(self.url)
|
||||
assert response.status_code == 302
|
||||
assert response.url == reverse(expected)
|
||||
assert response.url == reverse('base:board')
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.http import Http404
|
|||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils.text import slugify
|
||||
from django.views import generic
|
||||
from django.views.generic import FormView, TemplateView
|
||||
|
||||
from cruditor.views import (
|
||||
CruditorAddView,
|
||||
|
@ -25,7 +25,7 @@ from benevalibre.association.views import (
|
|||
)
|
||||
from benevalibre.benevalo.models import Benevalo
|
||||
from benevalibre.utils.html import fa_icon
|
||||
from benevalibre.utils.views import CruditorPageMixin
|
||||
from benevalibre.utils.views import CruditorPageMixin, PageMixin
|
||||
|
||||
from . import forms, tables
|
||||
|
||||
|
@ -59,38 +59,28 @@ class ExportTable(ExportMixin):
|
|||
return context
|
||||
|
||||
|
||||
class Home(PageMixin, TemplateView):
|
||||
template_name = 'base/home.html'
|
||||
page_title = "Accueil"
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
# Redirect to the board if the user is logged in
|
||||
if not self.request.user.is_anonymous:
|
||||
return redirect('base:board')
|
||||
return super().get(*args, **kwargs)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Board
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
class Home(generic.RedirectView):
|
||||
"""
|
||||
La page d'accueil de l'application vous oriente :
|
||||
|
||||
* soit vers la page « liste des associations » si votre compte ne contient
|
||||
pas d'engagement associatif ;
|
||||
* soit vers votre « tableau de bord ».
|
||||
"""
|
||||
|
||||
def get_redirect_url(self, *args, **kwargs):
|
||||
"""Dispatch between Board and AssociationIndex depending on things
|
||||
user has to see in Board"""
|
||||
if (
|
||||
not self.request.user.is_anonymous
|
||||
and self.request.user.engagement_set.exists()
|
||||
):
|
||||
return reverse('base:board')
|
||||
else:
|
||||
return reverse('association:index')
|
||||
|
||||
|
||||
class AssociationEngage(
|
||||
AssociationRelatedMixin,
|
||||
AssociationManageMenu,
|
||||
CruditorPageMixin,
|
||||
SuccessMessageMixin,
|
||||
generic.FormView,
|
||||
FormView,
|
||||
):
|
||||
"""
|
||||
Pour s'engager comme bénévole auprès d'une association, il suffit de
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
{% block extra_head %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% block container %}
|
||||
<div class="app-container">
|
||||
{% block header %}
|
||||
<header class="app-header">
|
||||
|
@ -60,6 +61,7 @@
|
|||
</footer>
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock container %}
|
||||
|
||||
{% block javascript %}
|
||||
<script src="{% minified "js/app.js" %}"></script>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block container %}
|
||||
<div class="app-container align-items-center justify-content-center homepage">
|
||||
<header class="homepage-header">
|
||||
<a href="{% url "accounts:login" %}" class="text-secondary">Se connecter</a>
|
||||
</header>
|
||||
|
||||
<main class="homepage-content text-center">
|
||||
<img src="{% static "img/logo-home.png" %}" alt="Bénévalibre" class="img-fluid mb-2 mb-md-3">
|
||||
<p class="homepage-lead mb-md-4">Le logiciel libre qui facilite la gestion et la valorisation du bénévolat dans les associations.</p>
|
||||
<a href="{% url "association:index" %}" class="btn btn-light btn-lg">Voir les associations</a>
|
||||
</main>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue