Design the page

This commit is contained in:
Yohann D'ANELLO 2020-02-29 13:04:03 +01:00
parent 78e18d6dc1
commit b01ed31e45
4 changed files with 43 additions and 68 deletions

View File

@ -56,26 +56,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
</head>
<body class="d-flex w-100 h-100 flex-column">
<main class="mb-auto">
<nav class="navbar navbar-expand-md navbar-light bg-light fixed-navbar shadow-sm">
<a class="navbar-brand" href="/">{{ request.site.name }}</a>
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarNavDropdown"
aria-controls="navbarNavDropdown" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav ml-auto">
{% if not user.is_authenticated %}
<li class="nav-item active">
<a class="nav-link" href="{% url 'login' %}">
<i class="fa fa-sign-in"></i> Se connecter
</a>
</li>
{% endif %}
</ul>
</div>
</nav>
<div class="container-fluid my-3" style="max-width: 1600px;">
{% block contenttitle %}<h1>{{ title }}</h1>{% endblock %}
{% block content %}
@ -83,43 +63,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% endblock content %}
</div>
</main>
<footer class="bg-light mt-auto py-2">
<div class="container-fluid">
<div class="row">
<div class="col-sm">
<form action="{% url 'set_language' %}" method="post"
class="form-inline">
<span class="text-muted mr-1">
Tombola Saper[list]popette &mdash;
<a href="mailto:tresorie.bde@lists.crans.org"
class="text-muted">Nous contacter</a> &mdash;
</span>
{% csrf_token %}
<select title="language" name="language"
class="custom-select custom-select-sm"
onchange="this.form.submit()">
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<option value="{{ language.code }}"
{% if language.code == LANGUAGE_CODE %}
selected{% endif %}>
{{ language.name_local }} ({{ language.code }})
</option>
{% endfor %}
</select>
<noscript>
<input type="submit">
</noscript>
</form>
</div>
<div class="col-sm text-right">
<a href="#" class="text-muted">Retour en haut</a>
</div>
</div>
</div>
</footer>
{% block extrajavascript %}
{% endblock extrajavascript %}

View File

@ -7,16 +7,40 @@
{% endblock %}
{% block content %}
Old:
<div style="">
<div class="alert alert-danger" style="width: 15%; float: left; margin: 1%;">
<strong>Lots déjà offerts :</strong>
<ul>
{% for reward in old_rewards %}
{{ reward.name }} (won by {{ previous_reward.rewarded_by.note }}, ticket n°{{ previous_reward.rewarded_by.number }})<br />
<li><strong>{{ reward.name }} :</strong> remporté par {{ reward.rewarded_by.note }} (ticket n° {{ reward.rewarded_by.number }})</li>
{% endfor %}
Previous: {{ previous_reward.name }} (won by {{ previous_reward.rewarded_by.note }}, ticket n°{{ previous_reward.rewarded_by.number }})<br />
Current: {{ current_reward.name }}<br />
Next:
</ul>
</div>
<div class="alert alert-warning" style="width: 30%; float: left; margin: 1%;">
<strong>Lot précédent :</strong><br />
<strong>{{ previous_reward.name }} :</strong> remporté par {{ previous_reward.rewarded_by.note }}
(ticket n° {{ previous_reward.rewarded_by.number }})<br />
<img src="{{ previous_reward.image.url }}" alt="{{ previous_reward.name }}" style="width: 100%;" />
</div>
<div class="alert alert-info" style="width: 30%; float: left; margin: 1%;">
<strong>Lot suivant :</strong><br />
<strong>{{ current_reward.name }}</strong><br />
<img src="{{ current_reward.image.url }}" alt="{{ previous_reward.name }}" style="width: 100%;" />
</div>
<div class="alert alert-success" style="width: 15%; float: left; margin: 1%;">
<strong>Lots à venir :</strong>
<ul>
{% for reward in next_rewards %}
{{ reward.name }}<br />
<li><strong>{{ reward.name }}</strong></li>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}
{% block extrajavascript %}

View File

@ -166,6 +166,9 @@ STATIC_ROOT = os.path.realpath(__file__)
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')]
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
CRISPY_TEMPLATE_PACK = 'bootstrap4'
DJANGO_TABLES2_TEMPLATE = 'django_tables2/bootstrap4.html'
# URL prefix for static files.

View File

@ -15,8 +15,10 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from . import settings
from django.contrib import admin
from django.contrib.staticfiles.urls import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import path, include
urlpatterns = [
@ -25,3 +27,6 @@ urlpatterns = [
path('admin/', admin.site.urls),
path('', include('tbde.urls')),
]
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)