Clean navbar + content_center only

- Add css transitions on buttons + navbar links.
- Clean css of navbar.
- Clean templates with only centered form/content.
- Page opened when login as generic team user close itself (only for
  non-CAS users).
- A message is added when generic team user connects.
- Fix extra space on right when messages are prompted.
This commit is contained in:
Aurélien Delobelle 2017-05-18 20:17:05 +02:00
parent 739990cdb6
commit 5776c81764
18 changed files with 171 additions and 235 deletions

View file

@ -13,6 +13,6 @@ def messages_on_login(sender, request, user, **kwargs):
'k-fet' in request.GET.get('next', '')): 'k-fet' in request.GET.get('next', '')):
messages.info( messages.info(
request, request,
('<a href="{}">Connexion en utilisateur partagé ?</a>' ('<a href="{}" target="_blank">Connexion en utilisateur partagé ?</a>'
.format(reverse('kfet.login.genericteam'))), .format(reverse('kfet.login.genericteam'))),
extra_tags='safe') extra_tags='safe')

View file

@ -70,6 +70,10 @@ textarea {
padding:8px 30px; padding:8px 30px;
} }
.btn {
transition: background-color 0.3s, color 0.3s;
}
.btn, .btn-lg, .btn-group-lg>.btn { .btn, .btn-lg, .btn-group-lg>.btn {
border-radius:0; border-radius:0;
} }
@ -188,10 +192,14 @@ textarea {
position:relative; position:relative;
} }
.content-right-block > div:not(.buttons-title) { .content-right-block > *:not(.buttons-title) {
background: #fff; background: #fff;
} }
.content-right-block > h2 {
background: transparent !important;
}
.content-right-block .buttons-title { .content-right-block .buttons-title {
position:absolute; position:absolute;
top:8px; top:8px;
@ -220,13 +228,13 @@ textarea {
* Pages tableaux seuls * Pages tableaux seuls
*/ */
.content-center { .content-center > *:not(.content-right-block) {
background:#fff; background: #fff;
} }
@media (min-width: 992px) { @media (min-width: 992px) {
.content-center { .content-center {
margin: 15px; margin: 15px 0;
} }
} }
@ -255,15 +263,12 @@ textarea {
* Pages formulaires seuls * Pages formulaires seuls
*/ */
.form-only .content-form { .content-form {
margin:15px; background-color: #fff;
padding: 15px;
background:#fff;
padding:15px;
} }
.form-only .account_create #id_trigramme { .account_create #id_trigramme {
display:block; display:block;
width:200px; width:200px;
height:80px; height:80px;
@ -329,6 +334,10 @@ textarea {
* Messages * Messages
*/ */
.messages {
margin: 0;
}
.messages .alert { .messages .alert {
padding:10px 15px; padding:10px 15px;
margin:0; margin:0;
@ -566,10 +575,6 @@ thead .tooltip {
} }
} }
.help-block {
padding-top: 15px;
}
/* Inventaires */ /* Inventaires */
#inventoryform input[type=number] { #inventoryform input[type=number] {

View file

@ -1,67 +1,80 @@
nav { .navbar {
background:#000; background: #000;
color:#DDD; color: #DDD;
font-family:Oswald; font-family: Oswald;
border: 0;
} }
.navbar-nav > li > .dropdown-menu { .navbar .navbar-brand {
border:0; padding: 3px 25px;
border-radius:0;
} }
.navbar-fixed-top { .navbar .navbar-brand img {
border:0; height: 44px;
} }
nav .navbar-brand { .navbar .navbar-toggle .icon-bar {
padding:3px 25px; background-color: #FFF;
}
nav .navbar-brand img {
height:44px;
}
nav .navbar-toggle .icon-bar {
background-color:#FFF;
}
nav a {
color:#DDD;
} }
.navbar-nav { .navbar-nav {
font-weight:bold; font-weight: bold;
font-size:14px; font-size: 14px;
text-transform:uppercase; text-transform: uppercase;
margin: 0 -15px;
} }
.nav>li>a:focus, .nav>li>a:hover { @media (min-width: 768px) {
background-color:#C8102E;
color:#FFF;
}
.nav .open>a, .nav .open>a:focus, .nav .open>a:hover {
background-color:#C8102E;
}
.dropdown-menu {
padding:0;
}
.dropdown-menu>li>a {
padding:8px 20px;
}
.dropdown-menu .divider {
margin:0;
}
@media (max-width: 767px) {
.navbar-nav .open .dropdown-menu {
background-color:#FFF;
}
.navbar-nav { .navbar-nav {
margin:0 -15px; margin: 0px;
}
.navbar-right {
margin-right: -15px;
}
}
.navbar-nav a {
transition: background-color 0.3s, color 0.3s;
}
.navbar-nav > li > a {
color: #DDD;
}
.navbar-nav > li:hover > a,
.navbar-nav > li > a:focus,
.nav .open > a:hover,
.nav .open > a:focus {
background-color: #C8102E;
color: #FFF;
}
.navbar-nav .dropdown .dropdown-menu {
padding: 0;
border: 0;
border-radius: 0;
background-color: #FFF;
}
.navbar-nav .dropdown .dropdown-menu > li > a {
padding: 8px 20px;
color: #333;
}
.navbar-nav .dropdown .dropdown-menu .divider {
margin: 0;
}
@media (min-width: 768px) {
.navbar-nav .dropdown .dropdown-menu {
display: block;
visibility: hidden;
opacity: 0;
transition: visibility 0s, opacity 0.3s;
}
.nav .dropdown:hover .dropdown-menu {
visibility: visible;
opacity: 1;
} }
} }

View file

@ -13,10 +13,10 @@
{% include 'kfet/base_messages.html' %} {% include 'kfet/base_messages.html' %}
<div class="row form-only"> <div class="row">
<div class="col-sm-12 col-md-8 col-md-offset-2"> <div class="col-sm-12 col-md-8 col-md-offset-2 nopadding">
<div class="content-form"> <div class="content-center content-form">
<form action="{% url "kfet.account.create" %}" method="post" class="account_create"> <form action="" method="post" class="account_create">
{% csrf_token %} {% csrf_token %}
<div> <div>
{{ trigramme_form.trigramme.errors }} {{ trigramme_form.trigramme.errors }}

View file

@ -13,10 +13,10 @@
{% include 'kfet/base_messages.html' %} {% include 'kfet/base_messages.html' %}
<div class="row form-only"> <div class="row">
<div class="col-sm-12 col-md-8 col-md-offset-2"> <div class="col-sm-12 col-md-8 col-md-offset-2 nopadding">
<div class="content-form"> <div class="content-center content-form">
<form action="{% url "kfet.account.create_special" %}" method="post" class="account_create"> <form action="" method="post" class="account_create">
{% csrf_token %} {% csrf_token %}
<div> <div>
{{ trigramme_form.trigramme.errors }} {{ trigramme_form.trigramme.errors }}

View file

@ -1,6 +1,4 @@
{% extends "kfet/base.html" %} {% extends "kfet/base.html" %}
{% load widget_tweaks %}
{% load staticfiles %}
{% block extra_head %} {% block extra_head %}
{{ negative_form.media }} {{ negative_form.media }}
@ -26,10 +24,10 @@
{% include "kfet/base_messages.html" %} {% include "kfet/base_messages.html" %}
<div class="row form-only"> <div class="row">
<div class="col-sm-12 col-md-8 col-md-offset-2"> <div class="col-sm-12 col-md-8 col-md-offset-2 nopadding">
<div class="content-form"> <div class="content-center content-form">
<form action="{% url 'kfet.account.update' account.trigramme %}" method="post" class="form-horizontal"> <form action="" method="post" class="form-horizontal">
{% csrf_token %} {% csrf_token %}
{% include 'kfet/form_snippet.html' with form=user_form %} {% include 'kfet/form_snippet.html' with form=user_form %}
{% include 'kfet/form_snippet.html' with form=cof_form %} {% include 'kfet/form_snippet.html' with form=cof_form %}

View file

@ -1,27 +1,10 @@
{% extends 'kfet/base.html' %} {% extends 'kfet/base.html' %}
{% load widget_tweaks %}
{% load staticfiles %}
{% block title %}Nouvel article{% endblock %} {% block title %}Nouvel article{% endblock %}
{% block content-header-title %}Création d'un article{% endblock %} {% block content-header-title %}Création d'un article{% endblock %}
{% block content %} {% block content %}
{% include "kfet/base_messages.html" %} {% include "kfet/base_form.html" with authz=perms.kfet.add_article submit_text="Enregistrer" %}
<div class="row form-only">
<div class="col-sm-12 col-md-8 col-md-offset-2">
<div class="content-form">
<form submit="" method="post" class="form-horizontal">
{% csrf_token %}
{% include 'kfet/form_snippet.html' with form=form %}
{% if not perms.kfet.add_article %}
{% include 'kfet/form_authentication_snippet.html' %}
{% endif %}
{% include 'kfet/form_submit_snippet.html' with value="Enregistrer" %}
</form>
</div>
</div>
</div>
{% endblock %} {% endblock %}

View file

@ -1,27 +1,10 @@
{% extends 'kfet/base.html' %} {% extends 'kfet/base.html' %}
{% load widget_tweaks %}
{% load staticfiles %}
{% block title %}Édition de l'article {{ article.name }}{% endblock %} {% block title %}Édition de l'article {{ article.name }}{% endblock %}
{% block content-header-title %}Article {{ article.name }} - Édition{% endblock %} {% block content-header-title %}Article {{ article.name }} - Édition{% endblock %}
{% block content %} {% block content %}
{% include "kfet/base_messages.html" %} {% include "kfet/base_form.html" with authz=perms.kfet.change_article submit_text="Mettre à jour"%}
<div class="row form-only">
<div class="col-sm-12 col-md-8 col-md-offset-2">
<div class="content-form">
<form action="" method="post" class="form-horizontal">
{% csrf_token %}
{% include 'kfet/form_snippet.html' with form=form %}
{% if not perms.kfet.change_article %}
{% include 'kfet/form_authentication_snippet.html' %}
{% endif %}
{% include 'kfet/form_submit_snippet.html' with value="Mettre à jour" %}
</form>
</div>
</div>
</div>
{% endblock %} {% endblock %}

View file

@ -0,0 +1,16 @@
{% include "kfet/base_messages.html" %}
<div class="row">
<div class="col-sm-12 col-md-8 col-md-offset-2 nopadding">
<div class="content-center content-form">
<form submit="" method="post" class="form-horizontal">
{% csrf_token %}
{% include "kfet/form_snippet.html" %}
{% if not authz %}
{% include "kfet/form_authentication_snippet.html" %}
{% endif %}
{% include "kfet/form_submit_snippet.html" with value=submit_text %}
</form>
</div>
</div>
</div>

View file

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

View file

@ -9,46 +9,50 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a class="navbar-brand" href="#"> <a class="navbar-brand" href="{% url 'kfet.home' %}">
<img src="{% static 'kfet/img/logo3.png' %}"> <img src="{% static 'kfet/img/logo3.png' %}">
</a> </a>
</div> </div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li><a href="{% url 'kfet.home' %}">Home</a></li> <li>
<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>
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
{% if user.username == 'kfet_genericteam' %} {% if user.username == 'kfet_genericteam' %}
<li class="navbar-text">Équipe standard</li> <li class="navbar-text">Équipe standard</li>
{% endif %}
{% if user.profile.account_kfet %}
<li>
<a href="{% url 'kfet.account.read' user.profile.account_kfet.trigramme %}">Mes infos</a>
</li>
{% endif %} {% endif %}
{% if perms.kfet.is_team %} {% if perms.kfet.is_team %}
<li class="dropdown"> <li><a href="{% url 'kfet.kpsul' %}">K-Psul</a></li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Admin <span class="caret"></span></a> <li><a href="{% url 'kfet.history' %}">Historique</a></li>
<ul class="dropdown-menu"> <li><a href="{% url 'kfet.transfers' %}">Transferts</a></li>
<li><a href="{% url 'kfet.kpsul' %}">K-Psul</a></li> <li class="dropdown">
<li><a href="{% url 'kfet.history' %}">Historique</a></li> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Admin <span class="caret"></span></a>
<li><a href="{% url 'kfet.transfers' %}">Transferts</a></li> <ul class="dropdown-menu">
<li class="divider"></li> <li class="divider"></li>
<li><a href="{% url 'kfet.account' %}">Comptes</a></li> <li><a href="{% url 'kfet.account' %}">Comptes</a></li>
<li><a href="{% url 'kfet.checkout' %}">Caisses</a></li> <li><a href="{% url 'kfet.checkout' %}">Caisses</a></li>
<li class="divider"></li> <li class="divider"></li>
<li><a href="{% url 'kfet.article' %}">Articles</a></li> <li><a href="{% url 'kfet.article' %}">Articles</a></li>
<li><a href="{% url 'kfet.inventory' %}">Inventaires</a></li> <li><a href="{% url 'kfet.inventory' %}">Inventaires</a></li>
<li><a href="{% url 'kfet.order' %}">Commandes</a></li> <li><a href="{% url 'kfet.order' %}">Commandes</a></li>
{% if user.username != 'kfet_genericteam' %} {% if user.username != 'kfet_genericteam' %}
<li class="divider"></li> <li class="divider"></li>
<li><a href="{% url 'kfet.login.genericteam' %}" target="_blank" id="genericteam">Connexion standard</a></li> <li><a href="{% url 'kfet.login.genericteam' %}" target="_blank" id="genericteam">Connexion standard</a></li>
{% endif %} {% endif %}
{% if perms.kfet.change_settings %} {% if perms.kfet.change_settings %}
<li><a href="{% url 'kfet.settings' %}">Paramètres</a></li> <li><a href="{% url 'kfet.settings' %}">Paramètres</a></li>
{% endif %} {% endif %}
</ul> </ul>
</li> </li>
{% endif %} {% endif %}
{% if user.is_authenticated %} {% 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> <li><a href="{% url 'gestioncof.views.logout' %}?next=/k-fet/" title="Déconnexion"><span class="glyphicon glyphicon-log-out"></span></a></li>

View file

@ -5,21 +5,6 @@
{% block content %} {% block content %}
{% include "kfet/base_messages.html" %} {% include "kfet/base_form.html" with authz=perms.kfet.edit_articlecategory submit_text="Enregistrer"%}
<div class="row form-only">
<div class="col-sm-12 col-md-8 col-md-offset-2">
<div class="content-form">
<form action="" method="post" class="form-horizontal">
{% csrf_token %}
{% include 'kfet/form_snippet.html' with form=form %}
{% if not perms.kfet.edit_articlecategory %}
{% include 'kfet/form_authentication_snippet.html' %}
{% endif %}
{% include 'kfet/form_submit_snippet.html' with value="Enregistrer"%}
<form>
</div>
</div>
</div>
{% endblock %} {% endblock %}

View file

@ -7,27 +7,6 @@ Caisse {{ checkout.name }} - Modification relevé {{ checkoutstatement.at }}
{% block content %} {% block content %}
<div class="row"> {% include "kfet/base_form.html" with authz=perms.kfet.change_checkoutstatement submit_text="Enregistrer"%}
<div class="col-sm-4 col-md-3 col-content-left">
<div class="content-left">
{% include 'kfet/left_checkout.html' %}
</div>
</div>
<div class="col-sm-8 col-md-9 col-content-right">
{% include 'kfet/base_messages.html' %}
<div class="content-right form-only">
<div class="content-form">
<form submit="" method="post" class="form-horizontal">
{% csrf_token %}
{% include 'kfet/form_snippet.html' with form=form %}
{% if not perms.kfet.change_checkoutstatement %}
{% include 'kfet/form_authentication_snippet.html' %}
{% endif %}
{% include 'kfet/form_submit_snippet.html' with value="Enregistrer" %}
</form>
</div>
</div>
</div>
</div>
{% endblock %} {% endblock %}

View file

@ -3,24 +3,20 @@
{% load kfet_tags %} {% load kfet_tags %}
{% block title %}Accueil{% endblock %} {% block title %}Accueil{% endblock %}
{% block content-header-title %}Accueil{% endblock %} {% block content-header %}{% endblock %}
{% block extra_head %} {% block extra_head %}
<link rel="stylesheet" type="text/css" href="{% static 'kfet/css/home.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'kfet/css/home.css' %}">
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% include 'kfet/base_messages.html' %}
<div class="row"> <div class="row">
<div class="col-sm-4 col-md-3 col-content-left"> <div class="col-sm-12 col-md-8 col-md-offset-2 nopadding">
<div class="content-left"> <div class="content-center">
</div>
</div>
<div class="col-sm-8 col-md-9 col-content-right">
{% include 'kfet/base_messages.html' %}
<div class="content-right">
<div class="content-right-block"> <div class="content-right-block">
<h2>Carte</h2> <h2>Carte</h2>
<div class="column-row"> <div class="column-row">
<div class="column-sm-1 column-md-2 column-lg-3"> <div class="column-sm-1 column-md-2 column-lg-3">
<div class="unbreakable carte-inverted"> <div class="unbreakable carte-inverted">
{% if pressions %} {% if pressions %}

View file

@ -1,7 +1,7 @@
{% extends 'kfet/base.html' %} {% extends 'kfet/base.html' %}
{% block content %} {% block extra_head %}
<script type="text/javascript">
Connexion utilisateur K-Fêt générique réussie close();
</script>
{% endblock %} {% endblock %}

View file

@ -5,21 +5,6 @@
{% block content %} {% block content %}
{% include "kfet/base_messages.html" %} {% include "kfet/base_form.html" with authz=perms.kfet.change_settings submit_text="Mettre à jour"%}
<div class="row form-only">
<div class="col-sm-12 col-md-8 col-md-offset-2">
<div class="content-form">
<form submit="" method="post" class="form-horizontal">
{% csrf_token %}
{% include 'kfet/form_snippet.html' with form=form %}
{% if not perms.kfet.change_settings %}
{% include 'kfet/form_authentication_snippet.html' %}
{% endif %}
{% include 'kfet/form_submit_snippet.html' with value="Mettre à jour" %}
</form>
</div>
</div>
</div>
{% endblock %} {% endblock %}

View file

@ -1,27 +1,10 @@
{% extends 'kfet/base.html' %} {% extends 'kfet/base.html' %}
{% load widget_tweaks %}
{% load staticfiles %}
{% block title %}Fournisseur - Modification{% endblock %} {% block title %}Fournisseur - Modification{% endblock %}
{% block content-header-title %}Fournisseur - Modification{% endblock %} {% block content-header-title %}Fournisseur - Modification{% endblock %}
{% block content %} {% block content %}
{% include 'kfet/base_messages.html' %} {% include 'kfet/base_form.html' with authz=perms.kfet.change_supplier submit_text="Mettre à jour" %}
<div class="row form-only">
<div class="col-sm-12 col-md-8 col-md-offset-2">
<div class="content-form">
<form submit="" method="post" class="form-horizontal">
{% csrf_token %}
{% include 'kfet/form_snippet.html' with form=form %}
{% if not perms.kfet.change_supplier %}
{% include 'kfet/form_authentication_snippet.html' %}
{% endif %}
{% include 'kfet/form_submit_snippet.html' with value="Mettre à jour" %}
</form>
</div>
</div>
</div>
{% endblock %} {% endblock %}

View file

@ -85,6 +85,8 @@ def login_genericteam(request):
user = authenticate(username="kfet_genericteam", token=token.token) user = authenticate(username="kfet_genericteam", token=token.token)
login(request, user) login(request, user)
messages.success(request, "Connecté en utilisateur partagé")
if need_cas_logout: if need_cas_logout:
# Vue de déconnexion de CAS # Vue de déconnexion de CAS
return logout_cas return logout_cas
@ -514,6 +516,10 @@ def account_update(request, trigramme):
return render(request, "kfet/account_update.html", { return render(request, "kfet/account_update.html", {
'account': account, 'account': account,
'forms': [
user_form, cof_form, account_form, group_form, pwd_form,
negative_form,
],
'account_form': account_form, 'account_form': account_form,
'cof_form': cof_form, 'cof_form': cof_form,
'user_form': user_form, 'user_form': user_form,