This commit is contained in:
Aurélien Delobelle 2016-08-02 10:40:46 +02:00
parent a2177155a0
commit 43d938edd0
20 changed files with 1053 additions and 0 deletions

View file

@ -0,0 +1,74 @@
{% extends "kfet/base.html" %}
{% load static %}
{% block title %}Création d'un nouveau compte{% endblock %}
{% block extra_head %}
<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>
<script src="{% static "autocomplete_light/autocomplete.js" %}" type="text/javascript"></script>
{% endblock %}
{% block content %}
<h1>Création d'un nouveau compte</h1>
{% if post %}
{% if success %}
Nouveau compte créé : {{ trigramme }}
{% else %}
Echec de la création du compte
{{ errors }}
{% endif %}
<hr>
{% endif %}
<form action="{% url "kfet.admin.account.new" %}" method="post">
{{ account_trigramme_form }}
<div id="trigramme_valid"></div><br>
<input type="text" name="q" id="search_autocomplete" spellcheck="false" placeholder="Chercher un utilisateur par nom, prénom ou identifiant clipper">
<div id="search_results"></div>
<div id="form-placeholder"></div>
</form>
<script type="text/javascript">
$(document).ready(function() {
// Affichage des résultats d'autocomplétion
$('input#search_autocomplete').yourlabsAutocomplete({
url: '{% url "kfet.admin.account.new.autocomplete" %}',
minimumCharacters: 0,
id: 'search_autocomplete',
choiceSelector: 'li:has(a)',
container: $("#search_results"),
box: $("#search_results"),
// fixPosition: function() {},
});
// Chargement du formulaire adapté au choix sélectionné
$('input#search_autocomplete').bind(
'selectChoice',
function(e, choice, autocomplete) {
autocomplete.hide();
link = choice.find('a:first');
if (link.length && link.attr('href') != undefined) {
$('#form-placeholder').html("").load(link.attr('href'));
//, function() {
//$('#form-placeholder').toggle().toggle();
//});
}
}
);
// Vérification client de la disponibilité du trigramme choisi
old_trigramme = "";
$('#id_trigramme').keyup(function() {
trigramme = $('#id_trigramme').val();
if (trigramme.length == 3 && trigramme != old_trigramme) {
$.ajax({
dataType: "json",
url: "{% url "kfet.admin.account.is_free.ajax" %}",
data: { trigramme: trigramme },
}).done(function(data) {
$('#trigramme_valid').text(data['is_free']);
old_trigramme = trigramme;
});
}
});
});
</script>
{% endblock %}

View file

@ -0,0 +1,43 @@
{% load kfet_tags %}
<ul>
<li>
<a href="{% url "kfet.admin.account.new.empty" %}">
Créer un compte
</a>
</li>
{% if users_cof %}
<li>Membres du COF</li>
{% for user in users_cof %}
<li>
<a href="{% url "kfet.admin.account.new.fromuser" user.username %}">
{{ user|highlight_user:q }}
</a>
</li>
{% endfor %}
{% endif %}
{% if users_notcof %}
<li>Non-membres du COF</li>
{% for user in users_notcof %}
<li>
<a href="{% url "kfet.admin.account.new.fromuser" user.username %}">
{{ user|highlight_user:q }}
</a>
</li>
{% endfor %}
{% endif %}
{% if clippers %}
<li>Utilisateurs clipper</li>
{% for clipper in clippers %}
<li>
<a href="{% url "kfet.admin.account.new.fromclipper" clipper.username %}">
{{ clipper|highlight_clipper:q }}
</li>
{% endfor %}
{% endif %}
{% if not q %}
<li>Pas de recherche, pas de résultats !</li>
{% elif not options %}
<li>Aucune correspondance trouvée :-(</li>
{% endif %}
</ul>

View file

@ -0,0 +1,5 @@
{% csrf_token %}
{{ user_form }}
{{ cof_form }}
{{ account_form }}
<input type="submit" value="Enregistrer">

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>{% block title %}{% endblock %} | K-Fêt - ENS Ulm</title>
{% block extra_head %}{% endblock %}
{# Vieux IE pas comprendre HTML5 #}
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<nav>
<ul>
<li><a href="{% url "kfet.views.home" %}">Home</a></li>
{% if perms.kfet.add_account %}
<li>
<a href={% url "kfet.admin.account.new" %}>Créer un compte</a>
</li>
{% endif %}
</ul>
</nav>
<section id="content">
{% block content %}TGTG{% endblock %}
</section>
{% include "kfet/base_footer.html" %}
</body>
</html>

View file