diff --git a/kfet/__init__.py b/kfet/__init__.py index e69de29b..5d6c8f97 100644 --- a/kfet/__init__.py +++ b/kfet/__init__.py @@ -0,0 +1 @@ +default_app_config = 'kfet.apps.KFetConfig' diff --git a/kfet/apps.py b/kfet/apps.py new file mode 100644 index 00000000..29f9f98e --- /dev/null +++ b/kfet/apps.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +from __future__ import (absolute_import, division, + print_function, unicode_literals) +from builtins import * + +from django.apps import AppConfig + +class KFetConfig(AppConfig): + name = 'kfet' + verbose_name = "Application K-Fêt" + + def ready(self): + import kfet.signals diff --git a/kfet/backends.py b/kfet/backends.py index 62b2d820..3729f1bd 100644 --- a/kfet/backends.py +++ b/kfet/backends.py @@ -18,7 +18,7 @@ class KFetBackend(object): return None try: - password_sha256 = hashlib.sha256(password.encode()).hexdigest() + password_sha256 = hashlib.sha256(password.encode('utf-8')).hexdigest() account = Account.objects.get(password=password_sha256) user = account.cofprofile.user except Account.DoesNotExist: diff --git a/kfet/routing.py b/kfet/routing.py index e7bcca55..9c816c92 100644 --- a/kfet/routing.py +++ b/kfet/routing.py @@ -8,7 +8,7 @@ from channels.routing import route, route_class from kfet import consumers channel_routing = [ - route_class(consumers.KPsul, path=r"^/ws/k-fet/k-psul/$"), + route_class(consumers.KPsul, path=r"^/gestion/ws/k-fet/k-psul/$"), #route("websocket.connect", ws_kpsul_history_connect), #route('websocket.receive', ws_message) ] diff --git a/kfet/signals.py b/kfet/signals.py new file mode 100644 index 00000000..3dd4d677 --- /dev/null +++ b/kfet/signals.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from __future__ import (absolute_import, division, + print_function, unicode_literals) +from builtins import * + +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 + +@receiver(user_logged_in) +def messages_on_login(sender, request, user, **kwargs): + if (not user.username == 'kfet_genericteam' + and user.has_perm('kfet.is_team')): + messages.info(request, 'Connexion en utilisateur partagé ?' % reverse('kfet.login.genericteam'), extra_tags='safe') diff --git a/kfet/static/kfet/css/index.css b/kfet/static/kfet/css/index.css index c6ee9ff6..f3e9bf8c 100644 --- a/kfet/static/kfet/css/index.css +++ b/kfet/static/kfet/css/index.css @@ -263,3 +263,81 @@ textarea { display:block; padding:5px 20px; } + +/* + * Messages + */ + +.messages .alert { + padding:10px 15px; + margin:0; + border:0; + border-radius:0; +} + +.messages .alert-dismissible { + padding-right:35px; +} + +.messages .alert .close { + top:0; + right:0; +} + +.messages .alert-info { + color:inherit; + background-color:#ccc; +} + +.messages .alert-error { + color:inherit; + background-color:rgba(200,16,46,0.2); +} + +.messages .alert-success { + color:#333; +} + +/* + * Help + */ + +.help { + display:none; + position:fixed; + top:50px; + left:0; + right:0; + bottom:0; + overflow:auto; + background:rgba(51,51,51,0.3); + z-index:500; +} + +.help-box { + margin-top:30px; + padding-top:1px; + padding-bottom:15px; + background:rgba(51,51,51,0.7); + color:#fff; +} + +@media (max-width:768px) { + .help-box { + margin:20px 15px; + } +} + +.help h2 { + padding:0 15px 20px; + border-bottom:1px solid #999; + text-align:center; +} + +.help .row > div { + padding-right:0; +} + +.help h4 { + margin:15px 0; +} diff --git a/kfet/static/kfet/css/kpsul.css b/kfet/static/kfet/css/kpsul.css index b15f6de8..9fd53604 100644 --- a/kfet/static/kfet/css/kpsul.css +++ b/kfet/static/kfet/css/kpsul.css @@ -319,6 +319,11 @@ input[type=number]::-webkit-outer-spin-button { padding-left:20px; } +#articles_data .article:hover { + background:rgba(200,16,46,0.3); + cursor:pointer; +} + /* Second part - Left - bottom */ .kpsul_middle_left_bottom { diff --git a/kfet/static/kfet/js/kfet.js b/kfet/static/kfet/js/kfet.js index 7aa1d963..dbfba0b2 100644 --- a/kfet/static/kfet/js/kfet.js +++ b/kfet/static/kfet/js/kfet.js @@ -66,8 +66,11 @@ function getErrorsHtml(data) { content += ''; } if ('negative' in data['errors']) { - var url_base = "{% url 'kfet.account.update' LIQ}"; - url_base = base_url(0, url_base.length-8); + if (window.location.pathname.startsWith('/gestion/')) { + var url_base = '/gestion/k-fet/accounts/'; + } else { + var url_base = '/k-fet/accounts/'; + } for (var i=0; iAutorisation de négatif requise pour '+data['errors']['negative'][i]+''; } @@ -110,4 +113,3 @@ function requestAuth(data, callback, focus_next = null) { } }); } - diff --git a/kfet/templates/kfet/account_create_autocomplete.html b/kfet/templates/kfet/account_create_autocomplete.html index b99abecf..1185c3a8 100644 --- a/kfet/templates/kfet/account_create_autocomplete.html +++ b/kfet/templates/kfet/account_create_autocomplete.html @@ -38,6 +38,7 @@ {{ clipper|highlight_clipper:q }} + {% endfor %} {% endif %} diff --git a/kfet/templates/kfet/account_negative.html b/kfet/templates/kfet/account_negative.html index 77fdf118..5f77b8f0 100644 --- a/kfet/templates/kfet/account_negative.html +++ b/kfet/templates/kfet/account_negative.html @@ -59,7 +59,7 @@ {{ neg.account.name }} {{ neg.account.balance|floatformat:2 }}€ - {% if neg.account.balance_offset %} + {% if neg.balance_offset %} {{ neg.account.real_balance|floatformat:2 }}€ {% endif %} diff --git a/kfet/templates/kfet/base.html b/kfet/templates/kfet/base.html index c1db0c26..173a5fb7 100644 --- a/kfet/templates/kfet/base.html +++ b/kfet/templates/kfet/base.html @@ -40,5 +40,13 @@ {% block content %}{% endblock %} {% include "kfet/base_footer.html" %} + + + + Aide + {% block help %}{% endblock %} + + +