Add Wagtail CMS for kfet app.

K-Fêt
- Integrate wagtail to serve "static" pages of old K-Fêt website
- Fixture "kfetcms/kfet_wagtail_17_05" contains a copy of old website
(as in May 2017).
- Media files can be got until end of June 17 at
http://partage.eleves.ens.fr//files/604e6dea2ceebc66b1936c6b3f911744/kfet_media.tar.gz

Login/logout
- Update package django_cas_ng to last version.
- Clean COFCASBackend.
- Change CAS version to 3 (version used on eleves.ens). This enables
the logout redirection (for CAS ofc).
- Add messages and clean existing ones on login/logout (for both
outsider and cas users).

Misc
- Update settings to bypass an incompability between debug-toolbar and
wagtailmenus packages.
- Better management of dev/test-specific urls (if debug-toolbar wasn't in
INSTALLED_APPS, media files were not served).
- UI improvements.
This commit is contained in:
Aurélien Delobelle 2017-05-30 20:44:30 +02:00
parent b13e992a30
commit 8c6d56b27c
67 changed files with 3038 additions and 618 deletions

View file

@ -177,7 +177,7 @@ Charger les mails indispensables au bon fonctionnement de GestioCOF :
Une base de donnée pré-remplie est disponible en lançant les commandes :
python manage.py loaddata gestion sites accounts groups articles
python manage.py loaddata gestion sites articles
python manage.py loaddevdata
Vous êtes prêts à développer ! Lancer GestioCOF en faisant

View file

@ -56,6 +56,22 @@ INSTALLED_APPS = [
'widget_tweaks',
'custommail',
'djconfig',
'wagtail.wagtailforms',
'wagtail.wagtailredirects',
'wagtail.wagtailembeds',
'wagtail.wagtailsites',
'wagtail.wagtailusers',
'wagtail.wagtailsnippets',
'wagtail.wagtaildocs',
'wagtail.wagtailimages',
'wagtail.wagtailsearch',
'wagtail.wagtailadmin',
'wagtail.wagtailcore',
'wagtail.contrib.modeladmin',
'wagtailmenus',
'modelcluster',
'taggit',
'kfet.cms',
]
MIDDLEWARE_CLASSES = [
@ -69,6 +85,8 @@ MIDDLEWARE_CLASSES = [
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'djconfig.middleware.DjConfigMiddleware',
'wagtail.wagtailcore.middleware.SiteMiddleware',
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
]
ROOT_URLCONF = 'cof.urls'
@ -87,6 +105,7 @@ TEMPLATES = [
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'wagtailmenus.context_processors.wagtailmenus',
'djconfig.context_processors.config',
'gestioncof.shared.context_processor',
'kfet.context_processors.auth',
@ -143,9 +162,12 @@ LOGIN_URL = "cof-login"
LOGIN_REDIRECT_URL = "home"
CAS_SERVER_URL = 'https://cas.eleves.ens.fr/'
CAS_VERSION = '3'
CAS_LOGIN_MSG = None
CAS_IGNORE_REFERER = True
CAS_REDIRECT_URL = '/'
CAS_EMAIL_FORMAT = "%s@clipper.ens.fr"
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'gestioncof.shared.COFCASBackend',
@ -171,3 +193,9 @@ CHANNEL_LAYERS = {
}
FORMAT_MODULE_PATH = 'cof.locale'
# Wagtail settings
WAGTAIL_SITE_NAME = 'GestioCOF'
WAGTAIL_ENABLE_UPDATE_CHECK = False
TAGGIT_CASE_INSENSITIVE = True

View file

@ -28,6 +28,26 @@ MEDIA_URL = '/media/'
# Debug tool bar
# ---
# "Versions" panel of django-debug-toolbar <=1.8 is not compatible with
# wagtailmenus.
# See https://github.com/jazzband/django-debug-toolbar/issues/922
# TODO: Bug should be fixed in ddt 1.9 (not released yet). When fixed, this
# declaration may be removed.
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
]
def show_toolbar(request):
"""
On ne veut pas la vérification de INTERNAL_IPS faite par la debug-toolbar

View file

@ -14,6 +14,10 @@ from django.views.generic.base import TemplateView
from django.contrib.auth import views as django_views
from django_cas_ng import views as django_cas_views
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls
from gestioncof import views as gestioncof_views, csv_views
from gestioncof.urls import export_patterns, petitcours_patterns, \
surveys_patterns, events_patterns, calendar_patterns, \
@ -48,7 +52,7 @@ urlpatterns = [
url(r'^outsider/login$', gestioncof_views.login_ext),
url(r'^outsider/logout$', django_views.logout, {'next_page': 'home'}),
url(r'^login$', gestioncof_views.login, name="cof-login"),
url(r'^logout$', gestioncof_views.logout),
url(r'^logout$', gestioncof_views.logout, name="cof-logout"),
# Infos persos
url(r'^profile$', gestioncof_views.profile),
url(r'^outsider/password-change$', django_views.password_change),
@ -82,6 +86,8 @@ urlpatterns = [
url(r'^utile_cof/diff_cof$', gestioncof_views.liste_diffcof),
url(r'^utile_bda/bda_revente$', gestioncof_views.liste_bdarevente),
url(r'^k-fet/', include('kfet.urls')),
url(r'^cms/', include(wagtailadmin_urls)),
url(r'^documents/', include(wagtaildocs_urls)),
]
if 'debug_toolbar' in settings.INSTALLED_APPS:
@ -90,7 +96,13 @@ if 'debug_toolbar' in settings.INSTALLED_APPS:
url(r'^__debug__/', include(debug_toolbar.urls)),
]
if settings.DEBUG:
# Si on est en production, MEDIA_ROOT est servi par Apache.
# Il faut dire à Django de servir MEDIA_ROOT lui-même en développement.
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
# Wagtail for uncatched
urlpatterns += [
url(r'', include(wagtail_urls)),
]

View file

@ -0,0 +1 @@
default_app_config = 'gestioncof.apps.GestioncofConfig'

8
gestioncof/apps.py Normal file
View file

@ -0,0 +1,8 @@
from django.apps import AppConfig
class GestioncofConfig(AppConfig):
name = 'gestioncof'
def ready(self):
import gestioncof.signals

View file

@ -1,62 +1,26 @@
from django.contrib.sites.models import Site
from django.conf import settings
from django.contrib.sites.models import Site
from django_cas_ng.backends import CASBackend
from django_cas_ng.utils import get_cas_client
from django.contrib.auth import get_user_model
from gestioncof.models import CofProfile
User = get_user_model()
class COFCASBackend(CASBackend):
def authenticate_cas(self, ticket, service, request):
"""Verifies CAS ticket and gets or creates User object"""
client = get_cas_client(service_url=service)
username, attributes, _ = client.verify_ticket(ticket)
if attributes:
request.session['attributes'] = attributes
if not username:
return None
def clean_username(self, username):
# Le CAS de l'ENS accepte les logins avec des espaces au début
# et à la fin, ainsi quavec une casse variable. On normalise pour
# éviter les doublons.
username = username.strip().lower()
return username.strip().lower()
profiles = CofProfile.objects.filter(login_clipper=username)
if len(profiles) > 0:
profile = profiles.order_by('-is_cof')[0]
user = profile.user
return user
try:
user = User.objects.get(username=username)
except User.DoesNotExist:
# user will have an "unusable" password
user = User.objects.create_user(username, '')
user.save()
return user
def authenticate(self, ticket, service, request):
"""Authenticates CAS ticket and retrieves user data"""
user = self.authenticate_cas(ticket, service, request)
if user is None:
return user
try:
profile = user.profile
except CofProfile.DoesNotExist:
profile, created = CofProfile.objects.get_or_create(user=user)
profile.save()
if not profile.login_clipper:
profile.login_clipper = user.username
profile.save()
if not user.email:
user.email = settings.CAS_EMAIL_FORMAT % profile.login_clipper
user.save()
if profile.is_buro and not user.is_staff:
user.is_staff = True
user.save()
def configure_user(self, user):
# cannot use "defaults" arg
profile, _ = CofProfile.objects.get_or_create(user=user)
profile.login_clipper = user.username
profile.save()
user.email = settings.CAS_EMAIL_FORMAT % profile.login_clipper
user.save()
return user

23
gestioncof/signals.py Normal file
View file

@ -0,0 +1,23 @@
from django.contrib import messages
from django.contrib.auth.signals import user_logged_in
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
from django_cas_ng.signals import cas_user_authenticated
@receiver(user_logged_in)
def messages_on_out_login(request, user, **kwargs):
if user.backend.startswith('django.contrib.auth'):
msg = _('Connexion à GestioCOF réussie. Bienvenue {}.').format(
user.get_short_name(),
)
messages.success(request, msg)
@receiver(cas_user_authenticated)
def mesagges_on_cas_login(request, user, **kwargs):
msg = _('Connexion à GestioCOF par CAS réussie. Bienvenue {}.').format(
user.get_short_name(),
)
messages.success(request, msg)

View file

@ -1,4 +1,5 @@
{% extends "gestioncof/base_header.html" %}
{% load wagtailcore_tags %}
{% block homelink %}
{% endblock %}
@ -55,7 +56,8 @@
<h3 class="block-title">K-Fêt<span class="pull-right"><i class="fa fa-coffee"></i></span></h3>
<div class="hm-block">
<ul>
<li><a href="{% url "kfet.home" %}">Page d'accueil</a></li>
{# TODO: Since Django 1.9, we can store result with "as", allowing proper value management (if None) #}
<li><a href="{% slugurl "k-fet" %}">Page d'accueil</a></li>
<li><a href="https://www.cof.ens.fr/k-fet/calendrier">Calendrier</a></li>
{% if perms.kfet.is_team %}
<li><a href="{% url 'kfet.kpsul' %}">K-Psul</a></li>

View file

@ -7,12 +7,17 @@ from custommail.shortcuts import send_custom_mail
from django.shortcuts import redirect, get_object_or_404, render
from django.http import Http404, HttpResponse, HttpResponseForbidden
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import login as django_login_view
from django.contrib.auth.views import (
login as django_login_view, logout as django_logout_view,
)
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.contrib import messages
from django_cas_ng.views import logout as cas_logout_view
from gestioncof.models import Survey, SurveyAnswer, SurveyQuestion, \
SurveyQuestionAnswer
from gestioncof.models import Event, EventRegistration, EventOption, \
@ -78,15 +83,21 @@ def login_ext(request):
@login_required
def logout(request):
try:
profile = request.user.profile
except CofProfile.DoesNotExist:
profile, created = CofProfile.objects.get_or_create(user=request.user)
if profile.login_clipper:
return redirect("django_cas_ng.views.logout")
def logout(request, next_page=None):
if next_page is None:
next_page = request.GET.get('next', None)
profile = getattr(request.user, 'profile', None)
if profile and profile.login_clipper:
msg = _('Déconnexion de GestioCOF et CAS réussie. À bientôt {}.')
logout_view = cas_logout_view
else:
return redirect("django.contrib.auth.views.logout")
msg = _('Déconnexion de GestioCOF réussie. À bientôt {}.')
logout_view = django_logout_view
messages.success(request, msg.format(request.user.get_short_name()))
return logout_view(request, next_page=next_page)
@login_required

1
kfet/cms/__init__.py Normal file
View file

@ -0,0 +1 @@
default_app_config = 'kfet.cms.apps.KFetCMSAppConfig'

7
kfet/cms/apps.py Normal file
View file

@ -0,0 +1,7 @@
from django.apps import AppConfig
class KFetCMSAppConfig(AppConfig):
name = 'kfet.cms'
label = 'kfetcms'
verbose_name = 'CMS K-Fêt'

View file

@ -0,0 +1,20 @@
from kfet.models import Article
def get_articles(request):
articles = (
Article.objects
.filter(is_sold=True, hidden=False)
.select_related('category')
.order_by('category__name', 'name')
)
pressions, others = [], []
for article in articles:
if article.category.name == 'Pression':
pressions.append(article)
else:
others.append(article)
return {
'pressions': pressions,
'articles': others,
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,35 @@
from django.contrib.auth.models import Group
from django.core.management import call_command
from django.core.management.base import BaseCommand
from wagtail.wagtailcore.models import Page, Site
class Command(BaseCommand):
help = "Importe des données pour Wagtail"
def add_arguments(self, parser):
parser.add_argument('--file', default='kfet_wagtail_17_05')
def handle(self, *args, **options):
self.stdout.write("Import des données wagtail")
# Nettoyage des données initiales posées par Wagtail dans la migration
# wagtailcore/0002
Group.objects.filter(name__in=('Moderators', 'Editors')).delete()
try:
homepage = Page.objects.get(
title="Welcome to your new Wagtail site!"
)
homepage.delete()
Site.objects.filter(root_page=homepage).delete()
except Page.DoesNotExist:
pass
# Import des données
# Par défaut, il s'agit d'une copie du site K-Fêt (17-05)
call_command('loaddata', options['file'])

View file

@ -0,0 +1,75 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import modelcluster.fields
import wagtail.wagtailcore.fields
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0033_remove_golive_expiry_help_text'),
('wagtailimages', '0019_delete_filter'),
]
operations = [
migrations.CreateModel(
name='GroupTeam',
fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)),
('name', models.CharField(max_length=255, verbose_name='Nom')),
],
options={
'verbose_name': 'Groupe de K-Fêt-eux-ses',
'verbose_name_plural': 'Groupes de K-Fêt-eux-ses',
},
),
migrations.CreateModel(
name='KFetPage',
fields=[
('page_ptr', models.OneToOneField(primary_key=True, to='wagtailcore.Page', parent_link=True, auto_created=True, serialize=False)),
('no_header', models.BooleanField(verbose_name='Sans en-tête', help_text="Coché, l'en-tête (avec le titre) de la page n'est pas affiché.", default=False)),
('content', wagtail.wagtailcore.fields.RichTextField(verbose_name='Contenu')),
('custom_template', models.CharField(max_length=255, verbose_name='Template personnalisé', blank=True)),
],
options={
'verbose_name': 'page K-Fêt',
'verbose_name_plural': 'pages K-Fêt',
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='KFetPageGroupTeam',
fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)),
('sort_order', models.IntegerField(editable=False, null=True, blank=True)),
('title', models.CharField(max_length=255, verbose_name='Titre du groupe', blank=True)),
('content', wagtail.wagtailcore.fields.RichTextField(verbose_name='Texte de présentation du groupe')),
('group', models.ForeignKey(related_name='+', verbose_name='Groupe de K-Fêt-eux-ses', to='kfetcms.GroupTeam')),
('page', modelcluster.fields.ParentalKey(related_name='team_groups', to='kfetcms.KFetPage')),
('show_only', models.IntegerField(default=None, verbose_name='Montrer seulement', blank=True, null=True, help_text='Nombre de membres du groupe affichés initialement. Laisser vide pour tou-te-s les afficher.')),
],
options={
'abstract': False,
'ordering': ['sort_order'],
},
),
migrations.CreateModel(
name='MemberTeam',
fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)),
('sort_order', models.IntegerField(editable=False, null=True, blank=True)),
('first_name', models.CharField(max_length=255, verbose_name='Prénom', blank=True, default='')),
('last_name', models.CharField(max_length=255, verbose_name='Nom', blank=True, default='')),
('nick_name', models.CharField(max_length=255, verbose_name='Alias', blank=True, default='')),
('group', modelcluster.fields.ParentalKey(related_name='members', verbose_name='Groupe de K-Fêt-eux-ses', to='kfetcms.GroupTeam')),
('photo', models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, blank=True, verbose_name='Photo', to='wagtailimages.Image', null=True)),
],
options={
'verbose_name': 'K-Fêt-eux-se',
},
),
]

View file

165
kfet/cms/models.py Normal file
View file

@ -0,0 +1,165 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from modelcluster.models import ClusterableModel, ParentalKey
from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailcore.models import Orderable, Page
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
from wagtail.wagtailsnippets.edit_handlers import SnippetChooserPanel
from wagtail.wagtailsnippets.models import register_snippet
from kfet.cms.context_processors import get_articles
class KFetPage(Page):
no_header = models.BooleanField(
verbose_name=_('Sans en-tête'),
default=False,
help_text=_(
"Coché, l'en-tête (avec le titre) de la page n'est pas affiché."
),
)
content = RichTextField(verbose_name=_('Contenu'))
custom_template = models.CharField(
verbose_name=_('Template personnalisé'),
max_length=255,
blank=True,
)
content_panels = Page.content_panels + [
FieldPanel('no_header'),
FieldPanel('content', classname='full'),
InlinePanel('team_groups', label=_("Groupes de K-Fêt-eux-ses")),
]
settings_panels = Page.settings_panels + [
FieldPanel('custom_template'),
]
class Meta:
verbose_name = _('page K-Fêt')
verbose_name_plural = _('pages K-Fêt')
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.template = "kfetcms/base.html"
def get_context(self, request, *args, **kwargs):
context = super().get_context(request, *args, **kwargs)
page = context['page']
if not page.seo_title:
page.seo_title = page.title
if self.slug == "carte":
context.update(get_articles(request))
return context
def get_template(self, request, *args, **kwargs):
return self.custom_template or (
super().get_template(request, *args, **kwargs))
class KFetPageGroupTeam(Orderable, models.Model):
page = ParentalKey(KFetPage, related_name='team_groups')
group = models.ForeignKey(
'kfetcms.GroupTeam',
verbose_name=_('Groupe de K-Fêt-eux-ses'),
related_name='+',
)
title = models.CharField(
verbose_name=_('Titre du groupe'),
max_length=255,
blank=True,
)
content = RichTextField(
verbose_name=_('Texte de présentation du groupe'),
)
show_only = models.IntegerField(
verbose_name=_('Montrer seulement'),
blank=True, null=True, default=None,
help_text=_(
'Nombre de membres du groupe affichés initialement. Laisser vide '
'pour tou-te-s les afficher.'
),
)
panels = [
FieldPanel('title', classname='full'),
FieldPanel('show_only', classname='full'),
FieldPanel('content', classname='full'),
SnippetChooserPanel('group'),
]
@register_snippet
class GroupTeam(ClusterableModel):
name = models.CharField(
verbose_name=_('Nom'),
max_length=255,
)
class Meta:
verbose_name = _('Groupe de K-Fêt-eux-ses')
verbose_name_plural = _('Groupes de K-Fêt-eux-ses')
def __str__(self):
return self.name
panels = [
FieldPanel('name', classname='full'),
InlinePanel('members', label=_('Membres du groupe')),
]
@register_snippet
class MemberTeam(Orderable, models.Model):
group = ParentalKey(
GroupTeam,
verbose_name=_("Groupe de K-Fêt-eux-ses"),
on_delete=models.CASCADE,
related_name='members',
)
first_name = models.CharField(
verbose_name=_('Prénom'),
max_length=255,
blank=True, default='',
)
last_name = models.CharField(
verbose_name=_('Nom'),
max_length=255,
blank=True, default='',
)
nick_name = models.CharField(
verbose_name=_('Alias'),
max_length=255,
blank=True, default='',
)
photo = models.ForeignKey(
'wagtailimages.Image',
verbose_name=_('Photo'),
on_delete=models.SET_NULL,
null=True, blank=True,
related_name='+',
)
class Meta:
verbose_name = _('K-Fêt-eux-se')
def __str__(self):
return self.get_full_name()
panels = [
FieldPanel('first_name'),
FieldPanel('last_name'),
FieldPanel('nick_name'),
FieldPanel('group'),
ImageChooserPanel('photo'),
]
def get_full_name(self):
full_name = '{} {}'.format(self.first_name, self.last_name)
return full_name.strip()

View file

@ -0,0 +1,155 @@
.cms-content {
text-align: justify;
font-size: 1.1em;
}
@media (min-width:768px) {
.cms-content {
font-size: 1.2em;
line-height: 1.6em;
}
}
.cms-column {
column-gap: 45px;
padding: 20px 15px;
background: white;
}
@media (min-width: 768px) {
.cms-column {
padding: 35px 30px;
}
}
@media (min-width: 992px) {
.cms-column {
margin: 0 15px;
}
}
/* Titles */
.cms-content h2, .cms-content h3 {
clear: both;
margin: 0 0 15px;
padding-bottom: 10px;
border-bottom: 1px solid #c8102e;
text-align: left;
font-weight: bold;
}
@media (min-width: 768px) {
.cms-content h2, .cms-content h3 {
padding-bottom: 15px;
}
}
/* Paragraphs */
.cms-content p {
margin-bottom: 20px;
text-indent: 2em;
}
.cms-content p + :not(h2):not(h3):not(div) {
margin-top: -10px;
}
@media (min-width: 768px) {
.cms-content p {
padding-bottom: 15px;
}
.cms-content p + :not(h2):not(h3):not(div) {
margin-top: -30px;
}
}
/* Lists */
.cms-content ol, .cms-content ul {
padding: 0 0 0 15px;
margin: 0 0 10px;
}
.cms-content ul {
list-style-type: square;
}
.cms-content ol > li, .cms-content ul > li {
padding-left: 5px;
}
/* Images */
.cms-content .richtext-image {
max-height: 100%;
margin: 5px 0 15px;
}
.cms-content .richtext-image.left {
float: left;
margin-right: 30px;
}
.cms-content .richtext-image.right {
float: right;
margin-left: 30px;
}
/* Team groups & members */
.team-group {
margin-bottom: 20px;
}
.team-group .col-btn {
margin-bottom: 20px;
}
.team-group .member-more {
display: none;
}
.team-member {
padding: 0;
margin-bottom: 20px;
min-height: 190px;
background-color: inherit;
border: 0;
}
.team-member img {
max-width: 100%;
max-height: 125px;
width: auto;
height: auto;
display: block;
}
.team-member .infos {
height: 50px;
margin-top: 15px;
}
@media (min-width: 768px) {
.team-group {
margin-left: 20px;
margin-right: 20px;
}
.team-member {
min-height: 215px;
}
.team-member img {
max-height: 150px;
}
}

View file

@ -0,0 +1,68 @@
{% extends "kfet/base.html" %}
{% load static %}
{% load wagtailuserbar %}
{% load wagtailcore_tags %}
{% block extra_head %}
<link rel="stylesheet" type="text/css" href="{% static "kfetcms/css/index.css" %}">
{% endblock %}
{% block title %}{{ page.seo_title }}{% endblock %}
{% block header-class %}text-center{% endblock %}
{% block header-title %}{{ page.title }}{% endblock %}
{% block content %}
<div class="row row-messages">
{% include "kfet/base_messages.html" %}
</div>
<div class="row column-row">
<div class="cms-column {% block col-size %}column-md-2{% endblock %}">
<div class="cms-content">
{% block block1-content %}
{% endblock %}
{% block block2-content %}
{{ page.content|richtext }}
{% endblock %}
{% block block3-content %}
{% endblock %}
</div>
</div>
</div>
{% wagtailuserbar %}
<script type="text/javascript">
$( function() {
// Titles and their following elements (until next title) are unbreakable.
// This workaround should not be necessary if we use StreamField instead of
// RichTextField in wagtail pages.
$('.cms-content h2, .cms-content h3').filter( function() {
return $(this).closest('.unbreakable').length == 0;
})
.each( function() {
let elt = $('<div>', {class: "unbreakable"});
$(this).before(elt);
let current = $(this);
while (current.length !== 0) {
let next = current.next(':not(h2, h3)');
current.appendTo(elt);
current = next;
}
});
});
</script>
{% endblock %}
{% block footer %}
{% include "kfet/base_footer.html" %}
{% endblock %}

View file

@ -0,0 +1,46 @@
{% extends "kfetcms/base.html" %}
{% load static %}
{% load kfet_tags %}
{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "kfet/css/home.css" %}">
{% endblock %}
{% block col-size %}column-sm-2 column-md-3{% endblock %}
{% block block3-content %}
{% if pressions %}
<div class="unbreakable carte carte-inverted">
<h3 class="carte-title">Pressions du moment</h3>
<ul class="carte-list">
{% for article in pressions %}
<li class="carte-item">
<div class="filler"></div>
<span class="carte-label">{{ article.name }}</span>
<span class="carte-ukf">{{ article.price | ukf:False}} UKF</span>
</li>
{% endfor %}
</ul>
</div><!-- endblock unbreakable -->
{% endif %}
{% regroup articles by category as categories %}
{% for category in categories %}
<div class="unbreakable carte">
<h3 class="carte-title">{{ category.grouper.name }}</h3>
<ul class="carte-list">
{% for article in category.list %}
<li class="carte-item">
<div class="filler"></div>
<span class="carte-label">{{ article.name }}</span>
<span class="carte-ukf">{{ article.price | ukf:False}} UKF</span>
</li>
{% endfor %}
</ul>
</div><!-- endblock unbreakable -->
{% endfor %}
{% endblock %}

View file

@ -0,0 +1,67 @@
{% extends "kfetcms/base.html" %}
{% load wagtailcore_tags %}
{% load wagtailimages_tags %}
{% block block1-content %}
{% for group_block in page.team_groups.all %}
<h3>{{ group_block.title }}</h3>
<div>
{{ group_block.content|richtext }}
</div>
{% with members=group_block.group.members.all %}
{% with len=members|length %}
{% if len > 0 %}
<div class="team-group row">
{% if len == 2 %}
<div class="visible-sm col-sm-3"></div>
{% endif %}
{% for member in members %}
<div class="col-xs-6 {% if len == 1 %}col-sm-4 col-sm-offset-4{% elif len == 3 %}col-sm-4{% elif len == 2%}col-sm-3 col-md-6{% else %}col-sm-3 col-md-4 col-lg-3{% endif %} {% if group_block.show_only != None and forloop.counter0 >= group_block.show_only %}member-more{% endif %}">
<div class="team-member thumbnail text-center">
{% image member.photo max-200x500 %}
<div class="infos">
<b>{{ member.get_full_name }}</b>
<br>
{% if member.nick_name %}
<i>alias</i> {{ member.nick_name }}
{% endif %}
</div>
</div>
</div>
{% endfor %}
{% if group_block.show_only != None and len > group_block.show_only %}
<div class="col-xs-12 col-btn text-center">
<button class="btn btn-primary btn-lg more">
{% if group_block.show_only %}
Y'en a plus !
{% else %}
Les voir
{% endif %}
</button>
</div>
{% endif %}
</div>
{% endif %}
{% endwith %}
{% endwith %}
{% endfor %}
<script type="text/javascript">
$( function() {
$('.more').click( function() {
$(this).closest('.col-btn').hide();
$(this).closest('.team-group').children('.member-more').show();
});
});
</script>
{% endblock %}

View file

@ -147,3 +147,9 @@ class Command(MyBaseCommand):
# ---
call_command('createopes', '100', '7', '--transfers=20')
# ---
# Wagtail CMS
# ---
call_command('kfet_loadwagtail')

View file

@ -78,7 +78,7 @@ class Account(models.Model):
def __str__(self):
return '%s (%s)' % (self.trigramme, self.name)
# Propriétés pour accéder aux attributs de user et cofprofile et user
# Propriétés pour accéder aux attributs de cofprofile et user
@property
def user(self):
return self.cofprofile.user
@ -120,6 +120,14 @@ class Account(models.Model):
def need_comment(self):
return self.trigramme == '#13'
@property
def readable(self):
return self.trigramme != 'GNR'
@property
def is_team(self):
return self.has_perm('kfet.is_team')
@staticmethod
def is_validandfree(trigramme):
data = { 'is_valid' : False, 'is_free' : False }

View file

@ -4,6 +4,7 @@ from django.contrib import messages
from django.contrib.auth.signals import user_logged_in
from django.core.urlresolvers import reverse
from django.dispatch import receiver
from django.utils.html import mark_safe
@receiver(user_logged_in)
@ -11,8 +12,9 @@ def messages_on_login(sender, request, user, **kwargs):
if (not user.username == 'kfet_genericteam' and
user.has_perm('kfet.is_team') and
'k-fet' in request.GET.get('next', '')):
messages.info(
request,
('<a href="{}" target="_blank">Connexion en utilisateur partagé ?</a>'
.format(reverse('kfet.login.genericteam'))),
extra_tags='safe')
messages.info(request, mark_safe(
'<a href="{}" class="genericteam" target="_blank">'
' Connexion en utilisateur partagé ?'
'</a>'
.format(reverse('kfet.login.genericteam'))
))

View file

@ -0,0 +1,19 @@
.footer {
line-height: 40px;
background: #c63b52;
color: white;
text-align: center;
font-size: 14px;
font-family: Roboto;
}
.footer a {
color: inherit;
}
.footer a:hover, .footer a:focus {
color: inherit;
text-decoration: underline;
}

View file

@ -9,9 +9,10 @@
#history .day {
height:40px;
line-height:40px;
background-color:rgba(200,16,46,0.9);
background-color:rgba(200,16,46,1);
color:#fff;
padding-left:20px;
font-family:"Roboto Slab";
font-size:16px;
font-weight:bold;
position:sticky;
@ -22,7 +23,7 @@
#history .opegroup {
height:30px;
line-height:30px;
background-color:rgba(200,16,46,0.75);
background-color: #c63b52;
color:#fff;
font-weight:bold;
padding-left:20px;

View file

@ -1,54 +1,58 @@
ul.carte {
.carte {
margin-bottom: 15px;
font-family: "Roboto Slab";
}
.carte .carte-title {
padding-top: 0;
margin-top: 0;
margin-bottom: 0;
}
.carte .carte-list {
width: 100%;
padding: 15px;
list-style-type: none;
padding-left: 15px;
padding-right: 15px;
display: inline-block;
*display: inline;
zoom: 1;
position: relative;
clip: auto;
overflow: hidden;
}
/*
ul.carte > li {
border-style: none none solid none;
border-width: 1px;
border-color: #DDD;
}
*/
li.carte-line {
.carte .carte-item {
position: relative;
text-align: right;
white-space: nowrap;
padding: 0;
}
.filler {
.carte .carte-item .filler {
position: absolute;
left: 0;
right: 0;
border-bottom: 3px dotted #333;
height: 70%;
border-bottom: 2px dotted #333;
height: 75%;
}
.carte-label {
.carte .carte-item > span {
position: relative;
}
.carte .carte-item .carte-label {
background: white;
float: left;
padding-right: 4px;
position: relative;
max-width: calc(100% - 40px);
overflow: hidden;
padding-right: 10px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.carte-ukf {
.carte .carte-item .carte-ukf {
padding: 0 10px;
background: #ffdbc7;
}
.carte-inverted .carte-list,
.carte-inverted .carte-item .carte-label {
background: #ffdbc7;
}
.carte-inverted .carte-item .carte-ukf {
background: white;
padding-left: 4px;
position: relative;
}
.unbreakable.carte-inverted .carte-ukf,
.unbreakable.carte-inverted .carte-label,
.unbreakable.carte-inverted {
background: #FFDBC7;
}

View file

@ -1,4 +1,5 @@
@import url("nav.css");
@import url("footer.css");
@import url("kpsul.css");
@import url("jconfirm-kfet.css");
@import url("history.css");
@ -10,11 +11,11 @@ body {
}
h1,h2,h3,h4,h5,h6 {
font-family:Oswald;
font-family:"Roboto Slab";
}
a {
color:#333;
color:#C8202E;
}
a:focus, a:hover {
@ -30,6 +31,10 @@ textarea {
border-radius:0 !important;
}
.glyphicon + span, span + .glyphicon {
margin-left: 10px;
}
.table {
margin-bottom:0;
border-bottom:1px solid #ddd;
@ -57,7 +62,7 @@ textarea {
}
.table tr.section {
background:rgba(200,16,46,0.9);
background:#c8102e;
color:#fff;
font-weight:bold;
}
@ -68,14 +73,26 @@ textarea {
padding:8px 30px;
}
.table-hover > tbody > tr.section:hover {
background:#c8102e;
}
.table-responsive {
border: 0;
margin-bottom: 0;
}
.btn {
border: 0;
transition: background-color, color;
transition-duration: 0.15s;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
font-family: "Roboto Slab";
}
.btn, .btn-lg, .btn-group-lg>.btn {
@ -83,8 +100,7 @@ textarea {
}
.btn-primary {
font-family:Oswald;
background-color:rgba(200,16,46,0.9);
background-color:#c63b52;
color:#FFF;
border:0;
}
@ -95,7 +111,8 @@ textarea {
.btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover,
.nav-pills>li.active>a, .nav-pills>li.active>a:focus, .nav-pills>li.active>a:hover {
outline: 0;
background-color:rgba(200,16,46,1);
background-color:#bf0f2c;
background-color:#c8102e;
color:#FFF;
}
@ -115,17 +132,15 @@ textarea {
color:#FFF;
}
.row-page-header {
.header-row {
background-color:rgba(200,16,46,1);
color:#FFF;
border-bottom:3px solid #000;
}
.page-header {
border:0;
padding:0;
margin:15px 20px;
text-transform:uppercase;
font-weight:bold;
}
@ -137,41 +152,49 @@ textarea {
padding:0;
}
@media (min-width: 768px) {
.col-content-left {
position: sticky;
top:50px;
margin-bottom: 15px;
}
}
.content-left-top {
background:#fff;
padding:10px 30px;
padding:15px;
}
.content-left .buttons {
background:#fff;
@media (min-width: 1200px) {
.content-left-top {
padding: 30px;
}
}
.content-left .buttons .btn {
display:block;
.content-left .btn-lg {
font-size: 16px;
}
.content-left .buttons ul.nav-pills {
margin-bottom:5px;
.btn-actions {
margin: 0 -15px;
}
.content-left .buttons ul.nav-pills li {
margin:0 0 -5px;
.btn-actions .btn {
color: inherit;
}
.btn-actions .btn:not([disabled]):hover, .btn-actions .btn:not([disabled]):focus {
color: #c8102e;
}
.content-left-top.frozen-account {
background:#000FBA;
background:#5072e0;
color:#fff;
}
.content-left .block {
padding-top:25px;
padding-top:15px;
}
.content-left .block .line {
@ -180,10 +203,11 @@ textarea {
}
.content-left .line.line-big {
font-family:Oswald;
font-family:"Roboto Slab";
font-size:60px;
font-weight:bold;
text-align:center;
overflow:hidden;
}
.content-left .line.line-bigsub {
@ -197,6 +221,12 @@ textarea {
text-align:center;
}
@media (min-width: 1200px) {
.content-left .line.line-big {
margin-top: -15px;
}
}
@media (min-width: 768px) {
.content-right {
margin: 15px;
@ -204,6 +234,7 @@ textarea {
}
.content-right-block {
margin-top: 15px;
position:relative;
}
@ -239,6 +270,15 @@ textarea {
font-size:25px;
}
.content-right-block a:not(.btn) {
color:#000;
}
.content-right-block a:not(.btn):focus ,
.content-right-block a:not(.btn):hover {
color:#C81022;
}
/*
* Pages tableaux seuls
*/
@ -251,6 +291,11 @@ textarea {
.content-center {
margin: 15px 0;
}
.column-row {
margin-top: 15px;
margin-bottom: 15px;
}
}
.content-center tbody tr:not(.section) td {
@ -261,6 +306,11 @@ textarea {
padding: 1px 12px ;
height:28px;
margin:3px 0px;
background: transparent;
}
.table .form-control[disabled], .table .form-control[readonly] {
background: #f5f5f5;
}
.table-condensed input.form-control {
@ -349,10 +399,6 @@ textarea {
* Messages
*/
.messages {
margin: 0;
}
.messages .alert {
padding:10px 15px;
margin:0;
@ -360,10 +406,6 @@ textarea {
border-radius:0;
}
.messages .alert-dismissible {
padding-right:35px;
}
.messages .alert .close {
top:0;
right:0;
@ -375,12 +417,18 @@ textarea {
}
.messages .alert-error {
color:inherit;
background-color:rgba(200,16,46,0.2);
color: white;
background-color: #c63b52;
}
.messages .alert-success {
color:#333;
color: white;
background: #3d9947;
}
.messages a {
font-weight: bold;
text-decoration: none;
}
/*
@ -403,7 +451,7 @@ textarea {
margin-top:30px;
padding-top:1px;
padding-bottom:15px;
background:rgba(51,51,51,0.7);
background:rgba(51,51,51,0.9);
color:#fff;
}
@ -449,145 +497,43 @@ thead .tooltip {
width: 100%;
}
.column-row {
padding: 15px 20px;
}
.column-xs-1,
.column-sm-1,
.column-md-1,
.column-lg-1,
.column-xs-2,
.column-sm-2,
.column-md-2,
.column-lg-2,
.column-xs-3,
.column-sm-3,
.column-md-3,
.column-lg-3,
.column-xs-4,
.column-sm-4,
.column-md-4,
.column-lg-4,
.column-xs-5,
.column-sm-5,
.column-md-5,
.column-lg-5 {
-webkit-column-count: 1; /* Chrome, Safari, Opera */
-moz-column-count: 1; /* Firefox */
.column-xs-1, .column-sm-1, .column-md-1, .column-lg-1,
.column-xs-2, .column-sm-2, .column-md-2, .column-lg-2,
.column-xs-3, .column-sm-3, .column-md-3, .column-lg-3,
.column-xs-4, .column-sm-4, .column-md-4, .column-lg-4,
.column-xs-5, .column-sm-5, .column-md-5, .column-lg-5 {
column-count: 1;
column-gap: 0;
}
.column-xs-1 {
-webkit-column-count: 1; /* Chrome, Safari, Opera */
-moz-column-count: 1; /* Firefox */
column-count: 1;
}
.column-xs-2 {
-webkit-column-count: 2; /* Chrome, Safari, Opera */
-moz-column-count: 2; /* Firefox */
column-count: 2;
}
.column-xs-3 {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
.column-xs-4 {
-webkit-column-count: 4; /* Chrome, Safari, Opera */
-moz-column-count: 4; /* Firefox */
column-count: 4;
}
.column-xs-5 {
-webkit-column-count: 5; /* Chrome, Safari, Opera */
-moz-column-count: 5; /* Firefox */
column-count: 5;
}
@media (min-width: 576px) {
.column-sm-1 {
-webkit-column-count: 1; /* Chrome, Safari, Opera */
-moz-column-count: 1; /* Firefox */
column-count: 1;
}
.column-sm-2 {
-webkit-column-count: 2; /* Chrome, Safari, Opera */
-moz-column-count: 2; /* Firefox */
column-count: 2;
}
.column-sm-3 {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
.column-sm-4 {
-webkit-column-count: 4; /* Chrome, Safari, Opera */
-moz-column-count: 4; /* Firefox */
column-count: 4;
}
.column-sm-5 {
-webkit-column-count: 5; /* Chrome, Safari, Opera */
-moz-column-count: 5; /* Firefox */
column-count: 5;
}
}
.column-xs-1 { column-count: 1; }
.column-xs-2 { column-count: 2; }
.column-xs-3 { column-count: 3; }
.column-xs-4 { column-count: 4; }
.column-xs-5 { column-count: 5; }
@media (min-width: 768px) {
.column-md-1 {
-webkit-column-count: 1; /* Chrome, Safari, Opera */
-moz-column-count: 1; /* Firefox */
column-count: 1;
}
.column-md-2 {
-webkit-column-count: 2; /* Chrome, Safari, Opera */
-moz-column-count: 2; /* Firefox */
column-count: 2;
}
.column-md-3 {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
.column-md-4 {
-webkit-column-count: 4; /* Chrome, Safari, Opera */
-moz-column-count: 4; /* Firefox */
column-count: 4;
}
.column-md-5 {
-webkit-column-count: 5; /* Chrome, Safari, Opera */
-moz-column-count: 5; /* Firefox */
column-count: 5;
}
.column-sm-1 { column-count: 1; }
.column-sm-2 { column-count: 2; }
.column-sm-3 { column-count: 3; }
.column-sm-4 { column-count: 4; }
.column-sm-5 { column-count: 5; }
}
@media (min-width: 992px) {
.column-lg-1 {
-webkit-column-count: 1; /* Chrome, Safari, Opera */
-moz-column-count: 1; /* Firefox */
column-count: 1;
}
.column-lg-2 {
-webkit-column-count: 2; /* Chrome, Safari, Opera */
-moz-column-count: 2; /* Firefox */
column-count: 2;
}
.column-lg-3 {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
.column-lg-4 {
-webkit-column-count: 4; /* Chrome, Safari, Opera */
-moz-column-count: 4; /* Firefox */
column-count: 4;
}
.column-lg-5 {
-webkit-column-count: 5; /* Chrome, Safari, Opera */
-moz-column-count: 5; /* Firefox */
column-count: 5;
}
.column-md-1 { column-count: 1; }
.column-md-2 { column-count: 2; }
.column-md-3 { column-count: 3; }
.column-md-4 { column-count: 4; }
.column-md-5 { column-count: 5; }
}
@media (min-width: 1200px) {
.column-lg-1 { column-count: 1; }
.column-lg-2 { column-count: 2; }
.column-lg-3 { column-count: 3; }
.column-lg-4 { column-count: 4; }
.column-lg-5 { column-count: 5; }
}
/* Inventaires */

View file

@ -5,7 +5,7 @@
.jconfirm .jconfirm-box {
padding:0;
border-radius:0 !important;
font-family:"Roboto Mono";
font-family:Roboto;
}
.jconfirm .jconfirm-box div.title-c .title {
@ -28,7 +28,6 @@
.jconfirm .jconfirm-box .content {
border-bottom:1px solid #ddd;
padding:5px 10px;
}
.jconfirm .jconfirm-box input {
@ -37,6 +36,7 @@
border:0;
font-family:"Roboto Mono";
font-size:40px;
text-align:center;
@ -49,6 +49,7 @@
}
.jconfirm .jconfirm-box .buttons button {
width:40px;
height:100%;
margin:0;
margin:0 !important;

View file

@ -143,9 +143,10 @@ input[type=number]::-webkit-outer-spin-button {
height:50px;
padding:0 15px;
background:rgba(200,16,46,0.9);
background:rgba(200,16,46,1);
color:#fff;
font-family:"Roboto Slab";
font-weight:bold;
font-size:18px;
}
@ -226,16 +227,10 @@ input[type=number]::-webkit-outer-spin-button {
height:40px;
}
#special_operations button {
height:100%;
width:25%;
#special_operations .btn {
height:40px;
float:left;
background: rgba(200,16,46,0.9);
color:#FFF;
font-size:18px;
font-size:15px;
font-weight:bold;
text-overflow: ellipsis;
@ -243,12 +238,6 @@ input[type=number]::-webkit-outer-spin-button {
overflow: hidden;
}
#special_operations button:focus,
#special_operations button:hover {
outline:none;
background: rgba(200,16,46,1);
color:#fff;
}
/* Article autocomplete */
@ -317,16 +306,22 @@ input[type=number]::-webkit-outer-spin-button {
font-size:14px;
}
#articles_data table tr.article>td:first-child {
#articles_data table tr.article td:first-child {
padding-left:10px;
}
#articles_data table tr.article td + td {
padding-right:10px;
text-align:right;
}
#articles_data table tr.category {
height:35px;
background-color:rgba(200,16,46,0.9);
background-color:#c8102e;
font-family:"Roboto Slab";
font-size:16px;
color:#FFF;
font-weight:bold;
color:#FFF;
}
#articles_data table tr.category>td:first-child {

View file

@ -1,54 +1,98 @@
.navbar {
background: #000;
color: #DDD;
font-family: Oswald;
border: 0;
font-family: Roboto;
}
.navbar .navbar-header {
float: left;
display: none;
margin-left: -15px;
margin-right: 0;
}
.navbar .navbar-brand {
padding: 3px 25px;
padding: 3px 0;
margin: 0 15px !important;
}
.navbar .navbar-brand img {
height: 44px;
}
.navbar .navbar-toggle {
border: 0;
border-radius: 0;
padding: 18px 15px;
margin: 0;
min-width: auto;
}
.navbar .navbar-toggle .icon-bar {
background-color: #FFF;
background: #fff;
}
.navbar-nav {
font-weight: bold;
font-size: 14px;
text-transform: uppercase;
margin: 0 -15px;
margin: 0 0 0 -15px;
float: left;
}
@media (min-width: 768px) {
@media (min-width: 460px) {
.navbar .navbar-header {
display: block;
}
.navbar-nav {
margin: 0px;
margin-left: 0;
}
.navbar-right {
margin-right: -15px;
.navbar-nav .nav-pages.dropdown .dropdown-menu > li:first-child {
display: none;
}
}
.navbar-right {
float: right !important;
margin: 0 -15px 0 0;
}
.navbar-nav a {
transition: background-color, box-shadow, color;
transition-duration: 0.15s;
}
.navbar-nav > li {
float: left;
text-align: center;
}
.navbar-nav > li > a {
min-width: 50px;
padding: 15px 10px;
color: #FFF;
}
.navbar-nav > li:hover > a,
.navbar-nav > li > a:focus,
.nav .open > a:hover,
.nav .open > a:focus {
.navbar-nav > .divider {
height: 1px;
background: rgba(255, 255, 255, 0.1);
}
@media (min-width: 1200px) {
.navbar-nav > li > a {
padding-left: 15px;
padding-right: 15px;
}
}
.navbar-nav > li > a:hover, .navbar-nav > li > a:focus,
.nav .open > a:hover, .nav .open > a:focus,
.navbar-nav > li.active > a,
.navbar-nav .dropdown:hover > a, .navbar-nav .dropdown:focus > a {
background-color: #C8102E;
color: #FFF;
box-shadow: inset 0 5px 5px -5px #000;
box-shadow: inset 0 3px 3px -4px #000;
}
.navbar-nav .dropdown .dropdown-menu {
@ -56,15 +100,22 @@
border: 0;
border-radius: 0;
background-color: #FFF;
font-size: 14px;
/* override max-width: 767px of bs */
position: absolute;
float: left;
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.navbar-nav .dropdown .dropdown-menu > li > a {
padding: 8px 20px;
padding: 8px 10px;
line-height: inherit;
color: #000;
}
.navbar-nav .dropdown .dropdown-menu > li > a:hover,
.navbar-nav .dropdown .dropdown-meny > li > a:focus {
.navbar-nav .dropdown .dropdown-menu > li > a:focus {
color: #c8102e;
background-color: transparent;
}
@ -73,16 +124,28 @@
margin: 0;
}
@media (min-width: 768px) {
.navbar-nav .dropdown .dropdown-menu {
display: block;
visibility: hidden;
opacity: 0;
transition: opacity 0.15s;
}
.navbar-nav .dropdown .dropdown-menu {
display: block;
visibility: hidden;
opacity: 0;
transition: opacity 0.15s;
}
.nav .dropdown:hover .dropdown-menu {
visibility: visible;
opacity: 1;
.navbar-nav .dropdown:hover > .dropdown-menu,
.navbar-nav .dropdown:focus > .dropdown-menu,
.navbar-nav .dropdown.open > .dropdown-menu {
visibility: visible;
opacity: 1;
}
@media (min-width: 992px) {
.navbar-nav .dropdown .dropdown-menu > li > a {
padding-left: 20px;
padding-right: 20px;
}
}
.nav-app .dropdown-menu {
right: 0;
left: auto;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -67,7 +67,6 @@
{
label: chart.label,
borderColor: chart.color,
backgroundColor: chart.color,
fill: is_time_chart,
lineTension: 0,
data: chart_data,

View file

@ -10,14 +10,27 @@
<div class="line line-bigsub">compte{{ accounts|length|add:-1|pluralize }}</div>
</div>
<div class="buttons">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.create' %}">Créer un compte</a>
<div class="btn-group btn-group-justified">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.create' %}">
<span class="glyphicon glyphicon-plus"></span>
<span>Créer un compte</span>
</a>
</div>
</div>
{% if perms.kfet.manage_perms or perms.kfet.view_negs %}
<div class="buttons btn-group btn-group-justified">
{% if perms.kfet.manage_perms %}
<div class="btn-group">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.group' %}">Permissions</a>
</div>
{% endif %}
{% if perms.kfet.view_negs %}
<div class="btn-group">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.negative' %}">Négatifs</a>
</div>
{% endif %}
</div>
{% endif %}
{% endblock %}
@ -26,16 +39,15 @@
<div class="content-right-block">
<h2>Liste des comptes</h2>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td>Trigramme</td>
<td class="text-center">Tri.</td>
<td>Nom</td>
<td>Balance</td>
<td>COF</td>
<td class="text-right">Balance</td>
<td class="text-center">COF</td>
<td>Dpt</td>
<td>Promo</td>
<td class="text-center">Promo</td>
</tr>
</thead>
<tbody>
@ -43,15 +55,14 @@
<tr>
<td class="text-center">
<a href="{% url 'kfet.account.read' account.trigramme %}">
<span class="glyphicon glyphicon-cog"></span>
{{ account.trigramme }}
</a>
</td>
<td>{{ account.trigramme }}</td>
<td>{{ account.name }}</td>
<td class="text-right">{{ account.balance }}€</td>
<td>{{ account.is_cof|yesno:"Oui,Non" }}</td>
<td class="text-center">{{ account.is_cof|yesno }}</td>
<td>{{ account.departement }}</td>
<td>{{ account.promo|default_if_none:'' }}</td>
<td class="text-center">{{ account.promo|default_if_none:'' }}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -5,7 +5,7 @@
{% block fixed-content %}
<div class="buttons">
<div class="buttons btn-group btn-group-justified">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.group.create' %}">Créer un groupe</a>
</div>
@ -40,7 +40,11 @@
<h3>Comptes</h3>
<ul class="list-unstyled">
{% for user in group.user_set.all %}
<li>{{ user.profile.account_kfet }}</li>
<li>
<a href="{% url "kfet.account.update" user.profile.account_kfet.trigramme %}">
{{ user.profile.account_kfet }}
</a>
</li>
{% endfor %}
</ul>
</div>

View file

@ -18,7 +18,7 @@
</div>
</div>
{% if perms.kfet.change_settings %}
<div class="buttons">
<div class="buttons btn-group btn-group-justified">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.settings' %}">Modifier les valeurs par défaut</a>
</div>
{% endif %}
@ -30,14 +30,13 @@
<div class="content-right-block">
<h2>Liste des comptes en négatifs</h2>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td>Tri</td>
<td class="text-center">Tri.</td>
<td>Nom</td>
<td>Balance</td>
<td>Réelle</td>
<td class="text-right">Balance</td>
<td class="text-right">Réelle</td>
<td>Début</td>
<td>Découvert autorisé</td>
<td>Jusqu'au</td>
@ -49,10 +48,9 @@
<tr>
<td class="text-center">
<a href="{% url 'kfet.account.update' neg.account.trigramme %}">
<span class="glyphicon glyphicon-cog"></span>
{{ neg.account.trigramme }}
</a>
</td>
<td>{{ neg.account.trigramme }}</td>
<td>{{ neg.account.name }}</td>
<td class="text-right">{{ neg.account.balance|floatformat:2 }}€</td>
<td class="text-right">

View file

@ -44,6 +44,10 @@ $(document).ready(function() {
{% endif %}
{% endblock %}
{% block footer %}
{% include "kfet/base_footer.html" %}
{% endblock %}
{% block fixed-content %}
{% include "kfet/left_account.html" %}
{% endblock %}

View file

@ -20,6 +20,12 @@
{% endif %}
{% endblock %}
{% block footer %}
{% if not account.user.is_team %}
{% include "kfet/base_footer.html" %}
{% endif %}
{% endblock %}
{% block main-class %}content-form{% endblock %}
{% block main-content %}

View file

@ -9,13 +9,18 @@
<div class="line line-big">{{ articles|length }}</div>
<div class="line line-bigsub">article{{ articles|length|pluralize }}</div>
</div>
<div class="buttons">
<div class="buttons btn-group btn-group-justified">
<div class="btn-group">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.article.create' %}">
Nouvel article
<span class="glyphicon glyphicon-plus"></span>
<span>Nouvel article</span>
</a>
</div>
<div class="btn-group">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.category' %}">
Catégories
</a>
</div>
</div>
{% endblock %}
@ -24,10 +29,9 @@
<div class="content-right-block">
<h2>Liste des articles</h2>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td>Nom</td>
<td class="text-right">Prix</td>
<td class="text-right">Stock</td>
@ -40,16 +44,15 @@
{% for article in articles %}
{% ifchanged article.category %}
<tr class="section">
<td colspan="7">{{ article.category.name }}</td>
<td colspan="6">{{ article.category.name }}</td>
</tr>
{% endifchanged %}
<tr>
<td class="text-center">
<td>
<a href="{% url 'kfet.article.read' article.pk %}">
<span class="glyphicon glyphicon-cog"></span>
{{ article.name }}
</a>
</td>
<td>{{ article.name }}</td>
<td class="text-right">{{ article.price }}€</td>
<td class="text-right">{{ article.stock }}</td>
<td class="text-right">{{ article.is_sold | yesno:"En vente,Non vendu"}}</td>

View file

@ -14,6 +14,14 @@
<div class="content-left-top">
<div class="line line-big">{{ article.name }}</div>
<div class="line line-bigsub">{{ article.category }}</div>
<div class="block text-center">
<div class="btn-actions btn-group">
<a class="btn btn-lg" href="{% url 'kfet.article.update' article.pk %}">
<span class="glyphicon glyphicon-cog"></span>
<span>Éditer</span>
</a>
</div>
</div>
<div class="block">
<div class="line">Prix (hors réduc.): {{ article.price }}€</div>
<div class="line">Stock: {{ article.stock }}</div>
@ -21,11 +29,6 @@
<div class="line">Affiché: {{ article.hidden | yesno:"Non,Oui" }}</div>
</div>
</div>
<div class="buttons">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.article.update' article.pk %}">
Modifier
</a>
</div>
{% endblock %}
@ -36,29 +39,35 @@
<div class="row" style="padding-bottom: 15px">
<div class="col-md-6">
<h3>Inventaires</h3>
<table class="table">
<thead>
<tr>
<td>Date</td>
<td>Stock</td>
<td>Erreur</td>
</tr>
</thead>
<tbody>
{% for inventoryart in inventoryarts %}
<tr>
<td>{{ inventoryart.inventory.at }}</td>
<td>{{ inventoryart.stock_new }}</td>
<td>{{ inventoryart.stock_error }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="table-responsive">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td>Date</td>
<td>Stock</td>
<td>Erreur</td>
</tr>
</thead>
<tbody>
{% for inventoryart in inventoryarts %}
<tr>
<td>
<a href="{% url "kfet.inventory.read" inventoryart.inventory.pk %}">
{{ inventoryart.inventory.at }}
</a>
</td>
<td>{{ inventoryart.stock_new }}</td>
<td>{{ inventoryart.stock_error }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h3>Prix fournisseurs</h3>
<div class="table-responsive">
<table class="table">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td>Date</td>

View file

@ -1,4 +1,5 @@
{% load staticfiles %}
{% load menu_tags %}
<!DOCTYPE html>
<html lang="fr">
<head>
@ -7,9 +8,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}{% endblock %} | K-Fêt - ENS Ulm</title>
<meta name="theme-color" content="#a00e26">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="icon" sizes="96x96" href="{% static "kfet/img/favicon.png" %}">
{# CSS #}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,700|Oswald:400,700|Roboto+Mono:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,700|Roboto+Mono:400,700|Roboto+Slab:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="{% static 'kfet/css/jquery-confirm.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'kfet/css/index.css' %}">
@ -28,18 +33,26 @@
<![endif]-->
</head>
<body>
{% include "kfet/base_nav.html" %}
{% main_menu template="kfet/base_nav.html" %}
<div class="container-fluid">
{% block header %}
<div class="row row-page-header">
<div class="col-lg-12">
<h1 class="page-header">{% block header-title %}{% endblock %}</h1>
{% if not page or not page.no_header %}
<div class="row header-row">
<div class="{% block header-class %}{% endblock %}">
<h1 class="page-header">
{% block header-title %}{% endblock %}
</h1>
</div>
</div>
</div>
{% endif %}
{% endblock %}
{% block content %}{% endblock %}
{% include "kfet/base_footer.html" %}
{% block footer %}
{% endblock footer %}
</div>
<div class="help">
<div class="help-box col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
<div class="help-content">

View file

@ -1,5 +1,7 @@
{% extends "kfet/base.html" %}
{% block header-class %}text-center{% endblock %}
{% block content %}
<div class="row">
@ -9,6 +11,6 @@
{% block main-content %}{% endblock %}
</div>
</div>
<div>
</div>
{% endblock %}

View file

@ -3,12 +3,12 @@
{% block content %}
<div class="row">
<div class="col-content-left {% block fixed-size %}col-sm-4 col-md-3{% endblock %}">
<div class="col-content-left {% block fixed-size %}col-sm-3{% endblock %}">
<div class="content-left">
{% block fixed-content %}{% endblock %}
</div>
</div>
<div class="col-content-right {% block main-size %}col-sm-8 col-md-9{% endblock %}">
<div class="col-content-right {% block main-size %}col-sm-9{% endblock %}">
{% include "kfet/base_messages.html" %}
<div class="content-right">
{% block main-content %}{% endblock %}

View file

@ -0,0 +1,17 @@
{% load wagtailcore_tags %}
{% with "k-fet@ens.fr" as kfet_mail %}
<div class="footer-row row">
<div class="footer">
<span>
<a href="{% slugurl "mentions-legales" %}">Mentions légales</a>
</span>
|
<span>
En cas de pépin : <a href="mailto:{{ kfet_mail }}"><tt>{{ kfet_mail }}</tt></a>
</span>
</div>
</div>
{% endwith %}

View file

@ -1,16 +1,12 @@
{% if messages %}
<div class="row messages">
<div class="messages">
{% for message in messages %}
<div class="col-sm-12 nopadding">
<div class="alert alert-{{ message.level_tag }} alert-dismissible fade in {{ message.tags }}">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span></button>
{% if 'safe' in message.tags %}
{{ message|safe }}
{% else %}
{{ message }}
{% endif %}
</div>
</div>
<div class="alert alert-{{ message.level_tag }} alert-dismissible fade in {{ message.tags }}">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
</button>
{{ message }}
</div>
{% endfor %}
</div>
{% endif %}

View file

@ -1,70 +1,107 @@
{% load staticfiles %}
{% load static %}
{% load wagtailcore_tags %}
<nav class="navbar navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{% url 'kfet.home' %}">
<a class="navbar-brand" href="{% slugurl "k-fet" %}">
<img src="{% static 'kfet/img/logo3.png' %}">
</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="hidden-xs">
<a href="{% url 'kfet.home' %}">
<span class="glyphicon glyphicon-home"></span>
</a>
</li>
{% if user.profile.account_kfet %}
<li>
<a href="{% url 'kfet.account.read' user.profile.account_kfet.trigramme %}">Mon compte</a>
</li>
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
{% if user.username == 'kfet_genericteam' %}
<li class="navbar-text">Équipe standard</li>
{% endif %}
{% if perms.kfet.is_team %}
<li><a href="{% url 'kfet.kpsul' %}">K-Psul</a></li>
<li><a href="{% url 'kfet.history' %}">Historique</a></li>
<li><a href="{% url 'kfet.transfers' %}">Transferts</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Admin <span class="caret"></span></a>
<ul class="dropdown-menu">
<li class="divider"></li>
<li><a href="{% url 'kfet.account' %}">Comptes</a></li>
<li><a href="{% url 'kfet.checkout' %}">Caisses</a></li>
<li class="divider"></li>
<li><a href="{% url 'kfet.article' %}">Articles</a></li>
<li><a href="{% url 'kfet.inventory' %}">Inventaires</a></li>
<li><a href="{% url 'kfet.order' %}">Commandes</a></li>
{% if user.username != 'kfet_genericteam' %}
<li class="divider"></li>
<li><a href="{% url 'kfet.login.genericteam' %}" target="_blank" id="genericteam">Connexion standard</a></li>
{% endif %}
{% if perms.kfet.change_settings %}
<li><a href="{% url 'kfet.settings' %}">Paramètres</a></li>
{% endif %}
</ul>
</li>
{% endif %}
{% if user.is_authenticated %}
<li><a href="{% url 'gestioncof.views.logout' %}?next=/k-fet/" title="Déconnexion"><span class="glyphicon glyphicon-log-out"></span></a></li>
{% endif %}
</ul>
</div>
<ul class="nav navbar-nav">
{% for item in menu_items %}
{% if item.text == "Accueil" %}
<li class="{{ item.active_class }} hidden-xs hidden-sm">
<a href="{{ item.href }}" title="Accueil">
<span class="glyphicon glyphicon-home"></span>
</a>
</li>
{% else %}
<li class="{{ item.active_class }} hidden-xs hidden-sm">
<a href="{{ item.href }}">
{{ item.text }}
</a>
</li>
{% endif %}
{% endfor %}
<li class="dropdown visible-xs visible-sm nav-pages">
<a href="#" data-toggle="dropdown" roles="button" aria-haspopup="true" aria-expanded="false" class="navbar-toggle">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<ul class="dropdown-menu">
{% for item in menu_items %}
<li>
<a href="{{ item.href }}">
{{ item.text }}
</a>
</li>
{% endfor %}
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right nav-app">
{% if user.username == 'kfet_genericteam' %}
{% include "kfet/nav_item.html" with text="Équipe standard" %}
{% elif user.profile.account_kfet.readable %}
{% url "kfet.account.read" user.profile.account_kfet.trigramme as url_my_account %}
{% include "kfet/nav_item.html" with href=url_my_account glyphicon="user" text="Mon compte" %}
{% endif %}
{% if perms.kfet.is_team %}
{% include "kfet/nav_item.html" with url="kfet.kpsul" glyphicon="shopping-cart" text="K-Psul" %}
{% include "kfet/nav_item.html" with url="kfet.transfers" glyphicon="transfer" text="Transferts" %}
{% include "kfet/nav_item.html" with url="kfet.history" glyphicon="th-list" text="Historique" %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-option-vertical"></span>
</a>
<ul class="dropdown-menu">
<li class="divider"></li>
<li><a href="{% url 'kfet.account' %}">Comptes</a></li>
<li><a href="{% url 'kfet.checkout' %}">Caisses</a></li>
<li class="divider"></li>
<li><a href="{% url 'kfet.article' %}">Articles</a></li>
<li><a href="{% url 'kfet.inventory' %}">Inventaires</a></li>
<li><a href="{% url 'kfet.order' %}">Commandes</a></li>
{% if user.username != 'kfet_genericteam' %}
<li class="divider"></li>
<li><a href="{% url 'kfet.login.genericteam' %}" target="_blank" class="genericteam">Connexion standard</a></li>
{% endif %}
{% if perms.kfet.change_settings %}
<li><a href="{% url 'kfet.settings' %}">Paramètres</a></li>
{% endif %}
<li class="divider"></li>
<li>
<a href="{% url "cof-logout" %}?next=/k-fet/">
<span class="glyphicon glyphicon-log-out"></span><span>Déconnexion</span>
</a>
</li>
</ul>
</li>
{% endif %}
{% if user.is_authenticated and not perms.kfet.is_team %}
<li>
<a href="{% url "cof-logout" %}?next=/k-fet/" title="Déconnexion">
<span class="glyphicon glyphicon-log-out"></span>
</a>
</li>
{% elif not user.is_authenticated %}
<li>
<a href="{% url "cof-login" %}?next={{ request.path }}" title="Connexion">
<span>Connexion</span><!--
--><span class="glyphicon glyphicon-log-in"></span>
</a>
</li>
{% endif %}
</ul>
</div>
</nav>
<script type="text/javascript">
$(document).ready(function () {
$('#genericteam').on('click', function () {
$('.genericteam').on('click', function () {
setTimeout(function () { location.reload() }, 1000);
});
});

View file

@ -17,10 +17,9 @@
<div class="content-right-block">
<h2>Liste des catégories</h2>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td>Nom</td>
<td class="text-right">Nombre d'articles</td>
<td class="text-right">Peut être majorée</td>
@ -29,12 +28,11 @@
<tbody>
{% for category in categories %}
<tr>
<td class="text-center">
<td>
<a href="{% url 'kfet.category.update' category.pk %}">
<span class="glyphicon glyphicon-cog"></span>
{{ category.name }}
</a>
</td>
<td>{{ category.name }}</td>
<td class="text-right">{{ category.articles.all|length }}</td>
<td class="text-right">{{ category.has_addcost | yesno:"Oui,Non"}}</td>
</tr>

View file

@ -9,8 +9,11 @@
<div class="line line-big">{{ checkouts|length }}</div>
<div class="line line-bigsub">caisse{{ checkouts|length|pluralize }}</div>
</div>
<div class="buttons">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.checkout.create' %}">Créer une caisse</a>
<div class="buttons btn-group btn-group-justified">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.checkout.create' %}">
<span class="glyphicon glyphicon-plus"></span>
<span>Créer une caisse</span>
</a>
</div>
{% endblock %}
@ -20,10 +23,9 @@
<div class="content-right-block">
<h2>Liste des caisses</h2>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td>Nom</td>
<td class="text-right">Balance</td>
<td class="text-right">Déb. valid.</td>
@ -36,14 +38,13 @@
<tr>
<td>
<a href="{% url 'kfet.checkout.read' checkout.pk %}">
<span class="glyphicon glyphicon-cog"></span>
{{ checkout.name }}
</a>
</td>
<td>{{ checkout.name }}</td>
<td class="text-right">{{ checkout.balance}}€</td>
<td class="text-right">{{ checkout.valid_from }}</td>
<td class="text-right">{{ checkout.valid_to }}</td>
<td class="text-right">{{ checkout.is_protected }}</td>
<td class="text-right">{{ checkout.is_protected|yesno }}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -7,6 +7,9 @@
{% include 'kfet/left_checkout.html' %}
{% endblock %}
{% block fixed-size %}col-sm-4 col-lg-3{% endblock %}
{% block main-size %}col-sm-8 col-lg-9{% endblock %}
{% block main-content %}
<div class="content-right-block">
<h2>Relevés</h2>
@ -14,10 +17,9 @@
{% if not statements %}
Pas de relevé
{% else %}
<table class="table">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td>Date/heure</td>
<td>Montant pris</td>
<td>Montant laissé</td>
@ -26,8 +28,11 @@
<tbody>
{% for statement in statements %}
<tr>
<td><a href="{% url 'kfet.checkoutstatement.update' checkout.pk statement.pk %}"><span class="glyphicon glyphicon-cog"></span></a></td>
<td>{{ statement.at }}</td>
<td>
<a href="{% url 'kfet.checkoutstatement.update' checkout.pk statement.pk %}">
{{ statement.at }}
</a>
</td>
<td>{{ statement.amount_taken }}</td>
<td>{{ statement.balance_new }}</td>
<td>{{ statement.amount_error }}</td>

View file

@ -1,59 +0,0 @@
{% extends "kfet/base_col_1.html" %}
{% load staticfiles %}
{% load kfet_tags %}
{% block title %}Accueil{% endblock %}
{% block header %}{% endblock %}
{% block extra_head %}
<link rel="stylesheet" type="text/css" href="{% static 'kfet/css/home.css' %}">
{% endblock %}
{% block main-size %}col-md-10 col-md-offset-1{% endblock %}
{% block main-content %}
<div class="content-right-block">
<h2>Carte</h2>
<div class="column-row">
<div class="column-sm-1 column-md-2 column-lg-3">
<div class="unbreakable carte-inverted">
{% if pressions %}
<h3>Pressions du moment</h3>
<ul class="carte">
{% for article in pressions %}
<li class="carte-line">
<div class="filler"></div>
<span class="carte-label">{{ article.name }}</span>
<span class="carte-ukf">{{ article.price | ukf:False}} UKF</span>
</li>
{% endfor %}
</ul>
{% endif %}
</div><!-- endblock unbreakable -->
{% for article in articles %}
{% ifchanged article.category %}
{% if not forloop.first %}
</ul>
</div><!-- endblock unbreakable -->
{% endif %}
<div class="unbreakable">
<h3>{{ article.category.name }}</h3>
<ul class="carte">
{% endifchanged %}
<li class="carte-line">
<div class="filler"></div>
<span class="carte-label">{{ article.name }}</span>
<span class="carte-ukf">{{ article.price | ukf:False}} UKF</span>
</li>
{% if forloop.last %}
</ul>
</div><!-- endblock unbreakable -->
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endblock %}

View file

@ -5,9 +5,10 @@
{% block fixed-content %}
<div class="buttons">
<div class="buttons btn-group btn-group-justified">
<a href="{% url 'kfet.inventory.create' %}" class="btn btn-primary btn-lg">
Nouveau
<span class="glyphicon glyphicon-plus"></span>
<span>Nouveau</span>
</a>
</div>
@ -18,10 +19,9 @@
<div class="content-right-block">
<h2>Liste des inventaires</h2>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td>Date</td>
<td>Par</td>
<td>Nb articles</td>
@ -31,12 +31,11 @@
<tbody>
{% for inventory in inventories %}
<tr>
<td class="text-center">
<td>
<a href="{% url 'kfet.inventory.read' inventory.pk %}">
<span class="glyphicon glyphicon-cog"></span>
<span>{{ inventory.at }}</span>
</a>
</td>
<td>{{ inventory.at }}</td>
<td>{{ inventory.by.trigramme }}</td>
<td>{{ inventory.nb_articles }}</td>
<td>

View file

@ -16,7 +16,7 @@
<form id='inventoryform' action="" method="post">
<div class="table-responsive">
<table class="table table-condensed text-center">
<table class="table table-hover table-condensed text-center">
<thead>
<tr>
<td>Article</td>
@ -39,7 +39,7 @@
{% endifchanged %}
<tr>
{{ form.article }}
<td class='name'>{{ form.name }}</td>
<td class='name text-left'>{{ form.name }}</td>
<td class='box_capacity'>{{ form.box_capacity }}</td>
<td>
<span class='current_stock'>{{ form.stock_old }}</span><span class='stock_diff'></span>

View file

@ -42,7 +42,11 @@
</tr>
{% endifchanged %}
<tr>
<td>{{ inventoryart.article.name }}</td>
<td>
<a href="{% url "kfet.article.read" inventoryart.article.id %}">
{{ inventoryart.article.name }}
</a>
</td>
<td>{{ inventoryart.stock_old }}</td>
<td>{{ inventoryart.stock_new }}</td>
<td>{{ inventoryart.stock_error }}</td>

View file

@ -18,6 +18,7 @@
{% block title %}K-Psul{% endblock %}
{% block header %}{% endblock %}
{% block footer %}{% endblock %}
{% block help %}
@ -113,11 +114,27 @@
<div class="col-sm-8 kpsul_middle_left_col">
<div class="kpsul_middle_left">
<div class="kpsul_middle_left_top">
<div id="special_operations">
<button role="button" class="btn" id="operation_deposit">Charge (F3)</button>
<button role="button" class="btn" id="operation_withdraw">Retrait (Shift+F3)</button>
<button role="button" class="btn" id="cool_reset">RAZ (F1)</button>
<button role="button" class="btn" id="ask_addcost">Major. (F9)</button>
<div id="special_operations" class="btn-group btn-group-justified">
<div class="btn-group">
<button role="button" class="btn btn-primary" id="operation_deposit">
Charge <span class="hidden-xs hidden-sm">(F3)</span>
</button>
</div>
<div class="btn-group">
<button role="button" class="btn btn-primary" id="operation_withdraw">
Retrait <span class="hidden-xs hidden-sm">(Shift+F3)</span>
</button>
</div>
<div class="btn-group">
<button role="button" class="btn btn-primary" id="cool_reset">
RAZ <span class="hidden-xs hidden-sm">(F1)</span>
</button>
</div>
<div class="btn-group">
<button role="button" class="btn btn-primary" id="ask_addcost">
Major. <span class="hidden-xs hidden-sm">(F9)</span>
</button>
</div>
</div>
<div id="article_selection">
<input type="text" id="article_autocomplete" autocomplete="off">
@ -169,6 +186,11 @@
{% csrf_token %}
<script type="text/javascript">
jconfirm.defaults = {
confirmButton: '<span class="glyphicon glyphicon-ok"></span>',
cancelButton: '<span class="glyphicon glyphicon-remove"></span>'
};
$(document).ready(function() {
// -----
// General

View file

@ -3,6 +3,18 @@
<div class="content-left-top {% if account.is_frozen %}frozen-account{% endif %}">
<div class="line line-big">{{ account.trigramme }}</div>
<div class="line balance">{{ account.balance|ukf:account.is_cof }} UKF</div>
<div class="block text-center">
<div class="btn-actions btn-group">
<a class="btn btn-lg" href="{% url 'kfet.account.update' account.trigramme %}">
<span class="glyphicon glyphicon-cog"></span>
<span>Éditer</span>
</a>
<a class="btn btn-lg" disabled>
<span class="glyphicon glyphicon-credit-card"></span>
<span>Créditer</span>
</a>
</div>
</div>
<div class="block">
<div class="line">{{ account.name }}</div>
{% if perms.kfet.is_team %}
@ -18,8 +30,9 @@
<div class="line">
{{ account.departement }} {{ account.promo }}
</div>
<div class="line">Statut COF: {{ account.is_cof }}</div>
<div class="line">{{ account.is_cof|yesno:"Est COF,N'est pas COF" }}</div>
</div>
{% if account.negative %}
<div class="block block-neg">
{% if account.negative.start %}
<div class="line">En négatif depuis {{ account.negative.start }}</div>
@ -34,16 +47,18 @@
<div class="line">Découvert autorisé jusqu'à : {{ account.negative.authz_overdraft_until }}</div>
{% endif %}
</div>
</div>
<div class="buttons">
{% if account.user == request.user %}
<ul class='nav nav-pills nav-justified'>
<li class="active"><a class="btn btn-primary" data-toggle="pill" href="#tab_stats">Statistiques</a></li>
<li><a class="btn btn-primary" data-toggle="pill" href="#tab_history">Historique</a></li>
</ul>
{% endif %}
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.update' account.trigramme %}">
Modifier
</a>
<a class="btn btn-primary btn-lg" disabled>Recharger par CB</a>
</div>
{% if account.user == request.user %}
<div class="buttons-tabs">
<div class="btn-group btn-group-justified">
<div class="btn-group">
<a class="btn btn-primary btn-lg" data-toggle="pill" href="#tab_stats">Statistiques</a>
</div>
<div class="btn-group">
<a class="btn btn-primary btn-lg" data-toggle="pill" href="#tab_history">Historique</a>
</div>
</div>
</div>
{% endif %}

View file

@ -1,13 +1,24 @@
<div class="content-left-top">
<div class="line line-big">{{ checkout.name }}</div>
<div class="line balance">{{ checkout.balance|floatformat:2 }} €</div>
<div class="block text-center">
<div class="btn-actions btn-group">
<div class="btn-group">
<a class="btn btn-lg {% if checkout.is_protected %} disabled{% endif %}" href="{% url 'kfet.checkout.update' checkout.pk %}">
<span class="glyphicon glyphicon-cog"></span>
<span>Modifier</span>
</a>
</div>
</div>
</div>
<div class="block">
<div class="line">Valide du {{ checkout.valid_from|date:'l j F Y, G:i' }}</div>
<div class="line">au {{ checkout.valid_to|date:'l j F Y, G:i' }}</div>
<div class="line">Créée par {{ checkout.created_by }}</div>
</div>
</div>
<div class="buttons">
<a class="btn btn-primary btn-lg {% if checkout.is_protected %} disabled{% endif %}" href="{% url 'kfet.checkout.update' checkout.pk %}">Modifier</a>
<a class="btn btn-primary btn-lg" href="{% url 'kfet.checkoutstatement.create' checkout.pk %}">Effectuer un relevé</a>
<div class="buttons btn-group btn-group-justified">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.checkoutstatement.create' checkout.pk %}">
Effectuer un relevé
</a>
</div>

View file

@ -0,0 +1,18 @@
{% if not href %}
{% url url as href %}
{% endif %}
<li class="{% if not href %}navbar-text{% endif %} {% if request.path == href %}active{% endif %}">
{% if href %}
<a href="{{ href }}" title="{{ text }}">
{% endif %}<!--
{% if glyphicon %}
--><span class="glyphicon glyphicon-{{ glyphicon }}"></span><!--
{% endif %}
{% if text %}
--><span class="visible-lg-inline">{{ text }}</span><!--
{% endif %}
-->
{% if href %}
</a>
{% endif %}
</li>

View file

@ -17,10 +17,9 @@
<div class="content-right-block">
<h2>Fournisseurs</h2>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td></td>
<td>Nom</td>
<td>Mail</td>
@ -35,12 +34,11 @@
Passer une commande
</a>
</td>
<td class="text-center">
<td>
<a href="{% url 'kfet.order.supplier.update' supplier.pk %}">
<span class="glyphicon glyphicon-cog"></span>
{{ supplier.name }}
</a>
</td>
<td>{{ supplier.name }}</td>
<td>{{ supplier.email }}</td>
<td>{{ supplier.phone }}</td>
<td>{{ supplier.address }}</td>
@ -54,10 +52,9 @@
<div class="content-right-block">
<h2>Liste des commandes</h2>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td></td>
<td></td>
<td>Date</td>
<td>Fournisseur</td>
@ -76,10 +73,9 @@
</td>
<td>
<a href="{% url 'kfet.order.read' order.pk %}">
<span class="glyphicon glyphicon-cog"></span>
{{ order.at }}
</a>
</td>
<td>{{ order.at }}</td>
<td>{{ order.supplier }}</td>
<td>
{% if order.inventory %}

View file

@ -11,7 +11,7 @@
<form action="" method="post">
{% csrf_token %}
<div class="table-responsive">
<table class="table table-condensed text-center">
<table class="table table-hover table-condensed text-center">
<thead>
<tr>
<td rowspan="2">Article</td>
@ -51,7 +51,7 @@
{% endifchanged %}
<tr>
{{ form.article }}
<td>{{ form.name }}</td>
<td class="text-left">{{ form.name }}</td>
{% for v_chunk in form.v_all %}
<td>{{ v_chunk }}</td>
{% endfor %}

View file

@ -7,9 +7,22 @@
<div class="content-left-top">
<div class="line"><b>Créée le:</b> {{ order.at }}</div>
<div class="line"><b>Fournisseur:</b> {{ order.supplier.name }}</div>
<div class="line">
<b>Fournisseur:</b>&nbsp;
<a href="{% url "kfet.order.supplier.update" order.supplier.id %}">
{{ order.supplier.name }}
</a>
</div>
{% if order.inventory %}
<div class="line">
<b>Inventaire relatif:</b>
<a href="{% url "kfet.inventory.read" order.inventory.pk %}">
#{{ order.inventory.pk }}
</a>
</div>
{% endif %}
</div>
<div class="buttons">
<div class="buttons btn-group btn-group-justified">
{% if not order.inventory %}
<a class="btn btn-primary btn-lg" href="{% url 'kfet.order.to_inventory' order.pk %}">
Générer inventaire
@ -41,7 +54,11 @@
</tr>
{% endifchanged %}
<tr>
<td>{{ orderart.article.name }}</td>
<td>
<a href="{% url "kfet.article.read" orderart.article.id %}">
{{ orderart.article.name }}
</a>
</td>
<td>{{ orderart.quantity_ordered }}</td>
<td>
{% if orderart.article.box_capacity %}

View file

@ -14,7 +14,7 @@
<table class='table table-condensed text-center'>
<thead>
<tr>
<td style="width:25%">Article</td>
<td style="width: 25%">Article</td>
<td>Prix HT</td>
<td>TVA</td>
<td>Droits</td>
@ -25,13 +25,13 @@
<tbody>
{% for form in formset %}
{% ifchanged form.category %}
<tr class='section'>
<td>{{ form.category_name }}</td>
<td colspan="5"></td>
<tr class='section text-left'>
<td colspan="6">{{ form.category_name }}</td>
</tr>
{% endifchanged %}
<tr>
<td>{{ form.name }}</td>
{{ form.article }}
<td class="text-left">{{ form.name }}</td>
<td class="nopadding">{{ form.price_HT | add_class:"form-control" }}</td>
<td class="nopadding">{{ form.TVA | add_class:"form-control" }}</td>
<td class="nopadding">{{ form.rights | add_class:"form-control" }}</td>

View file

@ -5,7 +5,7 @@
{% block fixed-content %}
<div class="buttons">
<div class="buttons btn-group btn-group-justified">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.settings.update' %}">
Modifier
</a>
@ -18,7 +18,7 @@
<div class="content-right-block">
<h2>Valeurs</h2>
<div class="table-responsive">
<table class="table table-condensed">
<table class="table table-hover table-condensed">
<thead>
<tr>
<td>Nom</td>

View file

@ -19,7 +19,7 @@
<div class="content-left">
<div class="content-left-top">
</div>
<div class="buttons">
<div class="buttons btn-group btn-group-justified">
<a class="btn btn-primary btn-lg" href="{% url 'kfet.transfers.create' %}">
Nouveaux
</a>
@ -47,7 +47,7 @@
</div>
{% endfor %}
{% endfor %}
</table>
</div>
</div>
</div>
</div>

View file

@ -2,13 +2,12 @@
from django.conf.urls import url
from django.contrib.auth.decorators import permission_required
from kfet import views
from kfet import autocomplete
from kfet import autocomplete, views
from kfet.decorators import teamkfet_required
urlpatterns = [
url(r'^$', views.Home.as_view(),
name='kfet.home'),
url(r'^login/genericteam$', views.login_genericteam,
name='kfet.login.genericteam'),
url(r'^history$', views.history,

View file

@ -23,6 +23,9 @@ from django.db.models.functions import Coalesce
from django.utils import timezone
from django.utils.crypto import get_random_string
from django.utils.decorators import method_decorator
from django_cas_ng.views import logout as cas_logout_view
from gestioncof.models import CofProfile
from kfet.config import kfet_config
@ -47,48 +50,21 @@ from collections import defaultdict
from kfet import consumers
from datetime import timedelta
from decimal import Decimal
import django_cas_ng
import heapq
import statistics
from kfet.statistic import ScaleMixin, last_stats_manifest, tot_ventes, WeekScale
class Home(TemplateView):
template_name = "kfet/home.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
articles = list(
Article.objects
.filter(is_sold=True, hidden=False)
.select_related('category')
.order_by('category__name')
)
pressions, others = [], []
while len(articles) > 0:
article = articles.pop()
if article.category.name == 'Pression':
pressions.append(article)
else:
others.append(article)
context['pressions'], context['articles'] = pressions, others
return context
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(TemplateView, self).dispatch(*args, **kwargs)
@teamkfet_required
def login_genericteam(request):
# Check si besoin de déconnecter l'utilisateur de CAS
profile, _ = CofProfile.objects.get_or_create(user=request.user)
need_cas_logout = False
if profile.login_clipper:
need_cas_logout = True
profile = getattr(request.user, 'profile', None)
cas_logout = None
if profile and profile.login_clipper:
# Récupèration de la vue de déconnexion de CAS
# Ici, car request sera modifié après
logout_cas = django_cas_ng.views.logout(request)
next_page = request.META.get('HTTP_REFERER', None)
cas_logout = cas_logout_view(request, next_page=next_page)
# Authentification du compte générique
token = GenericTeamToken.objects.create(token=get_random_string(50))
@ -97,11 +73,8 @@ def login_genericteam(request):
messages.success(request, "Connecté en utilisateur partagé")
if need_cas_logout:
# Vue de déconnexion de CAS
return logout_cas
return cas_logout or render(request, "kfet/login_genericteam.html")
return render(request, "kfet/login_genericteam.html")
def put_cleaned_data_in_dict(dict, form):
for field in form.cleaned_data:
@ -368,8 +341,9 @@ def account_read(request, trigramme):
account = get_object_or_404(Account, trigramme=trigramme)
# Checking permissions
if not request.user.has_perm('kfet.is_team') \
and request.user != account.user:
if not account.readable or (
not request.user.has_perm('kfet.is_team') and
request.user != account.user):
raise PermissionDenied
addcosts = (
@ -2056,6 +2030,7 @@ def order_to_inventory(request, pk):
messages.success(request, "C'est tout bon !")
return redirect('kfet.order')
else:
print(formset.errors)
messages.error(request, "Corrigez les erreurs")
else:
formset = cls_formset(initial=initial)
@ -2324,7 +2299,7 @@ class AccountStatBalance(PkUrlMixin, JSONDetailView):
)
context['charts'] = [{
"color": "rgb(255, 99, 132)",
"color": "rgb(200, 20, 60)",
"label": "Balance",
"values": changes,
}]
@ -2419,7 +2394,7 @@ class AccountStatOperation(ScaleMixin, PkUrlMixin, JSONDetailView):
ventes = sum(ope['article_nb'] for ope in chunk)
nb_ventes.append(ventes)
context['charts'] = [{"color": "rgb(255, 99, 132)",
context['charts'] = [{"color": "rgb(200, 20, 60)",
"label": "NB items achetés",
"values": nb_ventes}]
return context
@ -2501,7 +2476,7 @@ class ArticleStatSales(ScaleMixin, JSONDetailView):
nb_accounts.append(sum_accounts)
nb_liq.append(sum_liq)
context['charts'] = [{"color": "rgb(255, 99, 132)",
context['charts'] = [{"color": "rgb(200, 20, 60)",
"label": "Toutes consommations",
"values": nb_ventes},
{"color": "rgb(54, 162, 235)",

View file

@ -2,7 +2,7 @@ configparser==3.5.0
Django==1.8.*
django-autocomplete-light==2.3.3
django-autoslug==1.9.3
django-cas-ng==3.5.5
django-cas-ng==3.5.7
django-djconfig==0.5.3
django-grappelli==2.8.1
django-recaptcha==1.0.5
@ -22,3 +22,5 @@ git+https://git.eleves.ens.fr/cof-geek/django_custommail.git#egg=django_customma
ldap3
channels==1.1.3
python-dateutil
wagtail==1.10.*
wagtailmenus==2.2.*