Commit 850f49a6 authored by Michaël Paulon's avatar Michaël Paulon

Merge remote-tracking branch 'origin/master' into mikachu_django_2

parents 413f1036 b089e641
......@@ -3,7 +3,6 @@
# Ignore les fichiers statiques, sauf ceux des frameworks type Bootstrap
static/*
!static/common/
# Ignore les médias (avatars, ...)
media/*
......
......@@ -6,12 +6,12 @@ Paquets requis
Les paquets peuvent être récupérés via APT ou PIP.
* python3 (>= 3.4)
* python3-django (>= 1.11)
* python3-psycopg2 (>= 2.5)
* python3-jinja2 (>= 2.9)
* python3-django-filters (>= 1.0)
* python3-djangorestframework (>= 3.4.0)
* python3 (>= 3.5)
* python3-django (>= 2.1)
* python3-psycopg2 (>= 2.6)
* python3-jinja2 (>= 2.10)
* python3-django-filters (>= 2.0.0)
* python3-djangorestframework (>= 3.8.2)
* drf-nested-routers (>= 0.90.2)
* python3-pil (>= 4.0.0)
* postgresql (>= 9.6)
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-09-07 09:38
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
replaces = [('activites', '0001_initial'), ('activites', '0002_auto_20170609_1940'), ('activites', '0003_auto_20180719_1939'), ('activites', '0004_auto_20180719_1949')]
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Activite',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('intitule', models.CharField(max_length=255, verbose_name='intitulé')),
('description', models.TextField(blank=True)),
('debut', models.DateTimeField(verbose_name='début')),
('fin', models.DateTimeField()),
('liste_invitation', models.BooleanField(default=False, verbose_name="sur liste d'invitation ?")),
],
options={
'default_permissions': [],
'permissions': [('activite_ajouter', 'Ajouter/supprimer une activité'), ('activite_modifier', 'Modifier une activité'), ('activite_gerer', 'Gérer les activités')],
},
),
migrations.CreateModel(
name='Invite',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nom', models.CharField(max_length=255)),
('prenom', models.CharField(max_length=255, verbose_name='prénom')),
('present', models.NullBooleanField(default=None, verbose_name='présent')),
('activite', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invites', to='activites.Activite', verbose_name='activité')),
('invite_par', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invites', to=settings.AUTH_USER_MODEL, verbose_name='invité par')),
('naissance', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date de naissance')),
],
options={
'default_permissions': [],
'permissions': [('invite_inviter', 'Inviter une personne à une activité'), ('invite_supprimer', 'Supprimer un invité')],
},
),
migrations.AddField(
model_name='activite',
name='organisateur',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activites_organisees', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='activite',
name='valide_par',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='activites_validees', to=settings.AUTH_USER_MODEL, verbose_name='validé par'),
),
migrations.AlterUniqueTogether(
name='invite',
unique_together=set([('nom', 'prenom', 'naissance', 'activite')]),
),
migrations.AlterUniqueTogether(
name='activite',
unique_together=set([('intitule', 'debut', 'fin')]),
),
migrations.AlterField(
model_name='invite',
name='naissance',
field=models.DateField(verbose_name='date de naissance'),
),
]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -32,18 +32,22 @@ function (element) {
return this.filter(item => item !== element);
}
/* Fonction permettant de marquer une input */
function highlightInput(dom_id, mark) {
/* Fonction permettant de marquer une input comme valide */
function validInput(dom_id) {
"use strict";
$(dom_id).parent().addClass('has-{0}'.format(mark));
$(dom_id).addClass('form-control-{0}'.format(mark));
$(dom_id).removeClass('is-invalid').addClass('is-valid');
}
/* Fonction permettant de marquer une input comme invalide */
function invalidInput(dom_id) {
"use strict";
$(dom_id).removeClass('is-valid').addClass('is-invalid');
}
/* Fonction permettant de retirer le marquage d'une input */
function unhighlightInput(dom_id, mark) {
function clearInputState(dom_id) {
"use strict";
$(dom_id).parent().removeClass('has-{0}'.format(mark));
$(dom_id).removeClass('form-control-{0}'.format(mark));
$(dom_id).removeClass('is-invalid').removeClass('is-valid');
}
/* Fonction permettant d'afficher des messages en haut de page */
......
/*
Copyright (C) Federico Zivolo 2017
Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
*/(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.Popper=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var o=window.getComputedStyle(e,null);return t?o[t]:o}function o(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function n(e){if(!e||-1!==['HTML','BODY','#document'].indexOf(e.nodeName))return window.document.body;var i=t(e),r=i.overflow,p=i.overflowX,s=i.overflowY;return /(auto|scroll)/.test(r+s+p)?e:n(o(e))}function r(e){var o=e&&e.offsetParent,i=o&&o.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TD','TABLE'].indexOf(o.nodeName)&&'static'===t(o,'position')?r(o):o:window.document.documentElement}function p(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||r(e.firstElementChild)===e)}function s(e){return null===e.parentNode?e:s(e.parentNode)}function d(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return window.document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,i=o?e:t,n=o?t:e,a=document.createRange();a.setStart(i,0),a.setEnd(n,0);var l=a.commonAncestorContainer;if(e!==l&&t!==l||i.contains(n))return p(l)?l:r(l);var f=s(e);return f.host?d(f.host,t):d(e,s(t).host)}function a(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'top',o='top'===t?'scrollTop':'scrollLeft',i=e.nodeName;if('BODY'===i||'HTML'===i){var n=window.document.documentElement,r=window.document.scrollingElement||n;return r[o]}return e[o]}function l(e,t){var o=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=a(t,'top'),n=a(t,'left'),r=o?-1:1;return e.top+=i*r,e.bottom+=i*r,e.left+=n*r,e.right+=n*r,e}function f(e,t){var o='x'===t?'Left':'Top',i='Left'==o?'Right':'Bottom';return+e['border'+o+'Width'].split('px')[0]+ +e['border'+i+'Width'].split('px')[0]}function m(e,t,o,i){return X(t['offset'+e],t['scroll'+e],o['client'+e],o['offset'+e],o['scroll'+e],ne()?o['offset'+e]+i['margin'+('Height'===e?'Top':'Left')]+i['margin'+('Height'===e?'Bottom':'Right')]:0)}function c(){var e=window.document.body,t=window.document.documentElement,o=ne()&&window.getComputedStyle(t);return{height:m('Height',e,t,o),width:m('Width',e,t,o)}}function h(e){return de({},e,{right:e.left+e.width,bottom:e.top+e.height})}function g(e){var o={};if(ne())try{o=e.getBoundingClientRect();var i=a(e,'top'),n=a(e,'left');o.top+=i,o.left+=n,o.bottom+=i,o.right+=n}catch(e){}else o=e.getBoundingClientRect();var r={left:o.left,top:o.top,width:o.right-o.left,height:o.bottom-o.top},p='HTML'===e.nodeName?c():{},s=p.width||e.clientWidth||r.right-r.left,d=p.height||e.clientHeight||r.bottom-r.top,l=e.offsetWidth-s,m=e.offsetHeight-d;if(l||m){var g=t(e);l-=f(g,'x'),m-=f(g,'y'),r.width-=l,r.height-=m}return h(r)}function u(e,o){var i=ne(),r='HTML'===o.nodeName,p=g(e),s=g(o),d=n(e),a=t(o),f=+a.borderTopWidth.split('px')[0],m=+a.borderLeftWidth.split('px')[0],c=h({top:p.top-s.top-f,left:p.left-s.left-m,width:p.width,height:p.height});if(c.marginTop=0,c.marginLeft=0,!i&&r){var u=+a.marginTop.split('px')[0],b=+a.marginLeft.split('px')[0];c.top-=f-u,c.bottom-=f-u,c.left-=m-b,c.right-=m-b,c.marginTop=u,c.marginLeft=b}return(i?o.contains(d):o===d&&'BODY'!==d.nodeName)&&(c=l(c,o)),c}function b(e){var t=window.document.documentElement,o=u(e,t),i=X(t.clientWidth,window.innerWidth||0),n=X(t.clientHeight,window.innerHeight||0),r=a(t),p=a(t,'left'),s={top:r-o.top+o.marginTop,left:p-o.left+o.marginLeft,width:i,height:n};return h(s)}function y(e){var i=e.nodeName;return'BODY'===i||'HTML'===i?!1:'fixed'===t(e,'position')||y(o(e))}function w(e,t,i,r){var p={top:0,left:0},s=d(e,t);if('viewport'===r)p=b(s);else{var a;'scrollParent'===r?(a=n(o(e)),'BODY'===a.nodeName&&(a=window.document.documentElement)):'window'===r?a=window.document.documentElement:a=r;var l=u(a,s);if('HTML'===a.nodeName&&!y(s)){var f=c(),m=f.height,h=f.width;p.top+=l.top-l.marginTop,p.bottom=m+l.top,p.left+=l.left-l.marginLeft,p.right=h+l.left}else p=l}return p.left+=i,p.top+=i,p.right-=i,p.bottom-=i,p}function E(e){var t=e.width,o=e.height;return t*o}function v(e,t,o,i,n){var r=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0;if(-1===e.indexOf('auto'))return e;var p=w(o,i,r,n),s={top:{width:p.width,height:t.top-p.top},right:{width:p.right-t.right,height:p.height},bottom:{width:p.width,height:p.bottom-t.bottom},left:{width:t.left-p.left,height:p.height}},d=Object.keys(s).map(function(e){return de({key:e},s[e],{area:E(s[e])})}).sort(function(e,t){return t.area-e.area}),a=d.filter(function(e){var t=e.width,i=e.height;return t>=o.clientWidth&&i>=o.clientHeight}),l=0<a.length?a[0].key:d[0].key,f=e.split('-')[1];return l+(f?'-'+f:'')}function x(e,t,o){var i=d(t,o);return u(o,i)}function O(e){var t=window.getComputedStyle(e),o=parseFloat(t.marginTop)+parseFloat(t.marginBottom),i=parseFloat(t.marginLeft)+parseFloat(t.marginRight),n={width:e.offsetWidth+i,height:e.offsetHeight+o};return n}function L(e){var t={left:'right',right:'left',bottom:'top',top:'bottom'};return e.replace(/left|right|bottom|top/g,function(e){return t[e]})}function S(e,t,o){o=o.split('-')[0];var i=O(e),n={width:i.width,height:i.height},r=-1!==['right','left'].indexOf(o),p=r?'top':'left',s=r?'left':'top',d=r?'height':'width',a=r?'width':'height';return n[p]=t[p]+t[d]/2-i[d]/2,n[s]=o===s?t[s]-i[a]:t[L(s)],n}function T(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function C(e,t,o){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===o});var i=T(e,function(e){return e[t]===o});return e.indexOf(i)}function N(t,o,i){var n=void 0===i?t:t.slice(0,C(t,'name',i));return n.forEach(function(t){t.function&&console.warn('`modifier.function` is deprecated, use `modifier.fn`!');var i=t.function||t.fn;t.enabled&&e(i)&&(o.offsets.popper=h(o.offsets.popper),o.offsets.reference=h(o.offsets.reference),o=i(o,t))}),o}function k(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=x(this.state,this.popper,this.reference),e.placement=v(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.offsets.popper=S(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position='absolute',e=N(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function W(e,t){return e.some(function(e){var o=e.name,i=e.enabled;return i&&o===t})}function B(e){for(var t=[!1,'ms','Webkit','Moz','O'],o=e.charAt(0).toUpperCase()+e.slice(1),n=0;n<t.length-1;n++){var i=t[n],r=i?''+i+o:e;if('undefined'!=typeof window.document.body.style[r])return r}return null}function P(){return this.state.isDestroyed=!0,W(this.modifiers,'applyStyle')&&(this.popper.removeAttribute('x-placement'),this.popper.style.left='',this.popper.style.position='',this.popper.style.top='',this.popper.style[B('transform')]=''),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function D(e,t,o,i){var r='BODY'===e.nodeName,p=r?window:e;p.addEventListener(t,o,{passive:!0}),r||D(n(p.parentNode),t,o,i),i.push(p)}function H(e,t,o,i){o.updateBound=i,window.addEventListener('resize',o.updateBound,{passive:!0});var r=n(e);return D(r,'scroll',o.updateBound,o.scrollParents),o.scrollElement=r,o.eventsEnabled=!0,o}function A(){this.state.eventsEnabled||(this.state=H(this.reference,this.options,this.state,this.scheduleUpdate))}function M(e,t){return window.removeEventListener('resize',t.updateBound),t.scrollParents.forEach(function(e){e.removeEventListener('scroll',t.updateBound)}),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t}function I(){this.state.eventsEnabled&&(window.cancelAnimationFrame(this.scheduleUpdate),this.state=M(this.reference,this.state))}function R(e){return''!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function U(e,t){Object.keys(t).forEach(function(o){var i='';-1!==['width','height','top','right','bottom','left'].indexOf(o)&&R(t[o])&&(i='px'),e.style[o]=t[o]+i})}function Y(e,t){Object.keys(t).forEach(function(o){var i=t[o];!1===i?e.removeAttribute(o):e.setAttribute(o,t[o])})}function F(e,t,o){var i=T(e,function(e){var o=e.name;return o===t}),n=!!i&&e.some(function(e){return e.name===o&&e.enabled&&e.order<i.order});if(!n){var r='`'+t+'`';console.warn('`'+o+'`'+' modifier is required by '+r+' modifier in order to work, be sure to include it before '+r+'!')}return n}function j(e){return'end'===e?'start':'start'===e?'end':e}function K(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=le.indexOf(e),i=le.slice(o+1).concat(le.slice(0,o));return t?i.reverse():i}function q(e,t,o,i){var n=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),r=+n[1],p=n[2];if(!r)return e;if(0===p.indexOf('%')){var s;switch(p){case'%p':s=o;break;case'%':case'%r':default:s=i;}var d=h(s);return d[t]/100*r}if('vh'===p||'vw'===p){var a;return a='vh'===p?X(document.documentElement.clientHeight,window.innerHeight||0):X(document.documentElement.clientWidth,window.innerWidth||0),a/100*r}return r}function G(e,t,o,i){var n=[0,0],r=-1!==['right','left'].indexOf(i),p=e.split(/(\+|\-)/).map(function(e){return e.trim()}),s=p.indexOf(T(p,function(e){return-1!==e.search(/,|\s/)}));p[s]&&-1===p[s].indexOf(',')&&console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');var d=/\s*,\s*|\s+/,a=-1===s?[p]:[p.slice(0,s).concat([p[s].split(d)[0]]),[p[s].split(d)[1]].concat(p.slice(s+1))];return a=a.map(function(e,i){var n=(1===i?!r:r)?'height':'width',p=!1;return e.reduce(function(e,t){return''===e[e.length-1]&&-1!==['+','-'].indexOf(t)?(e[e.length-1]=t,p=!0,e):p?(e[e.length-1]+=t,p=!1,e):e.concat(t)},[]).map(function(e){return q(e,n,t,o)})}),a.forEach(function(e,t){e.forEach(function(o,i){R(o)&&(n[t]+=o*('-'===e[i-1]?-1:1))})}),n}function z(e,t){var o,i=t.offset,n=e.placement,r=e.offsets,p=r.popper,s=r.reference,d=n.split('-')[0];return o=R(+i)?[+i,0]:G(i,p,s,d),'left'===d?(p.top+=o[0],p.left-=o[1]):'right'===d?(p.top+=o[0],p.left+=o[1]):'top'===d?(p.left+=o[0],p.top-=o[1]):'bottom'===d&&(p.left+=o[0],p.top+=o[1]),e.popper=p,e}for(var V=Math.min,_=Math.floor,X=Math.max,Q=['native code','[object MutationObserverConstructor]'],J=function(e){return Q.some(function(t){return-1<(e||'').toString().indexOf(t)})},Z='undefined'!=typeof window,$=['Edge','Trident','Firefox'],ee=0,te=0;te<$.length;te+=1)if(Z&&0<=navigator.userAgent.indexOf($[te])){ee=1;break}var i,oe=Z&&J(window.MutationObserver),ie=oe?function(e){var t=!1,o=0,i=document.createElement('span'),n=new MutationObserver(function(){e(),t=!1});return n.observe(i,{attributes:!0}),function(){t||(t=!0,i.setAttribute('x-index',o),++o)}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},ee))}},ne=function(){return void 0==i&&(i=-1!==navigator.appVersion.indexOf('MSIE 10')),i},re=function(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')},pe=function(){function e(e,t){for(var o,n=0;n<t.length;n++)o=t[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}return function(t,o,i){return o&&e(t.prototype,o),i&&e(t,i),t}}(),se=function(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e},de=Object.assign||function(e){for(var t,o=1;o<arguments.length;o++)for(var i in t=arguments[o],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ae=['auto-start','auto','auto-end','top-start','top','top-end','right-start','right','right-end','bottom-end','bottom','bottom-start','left-end','left','left-start'],le=ae.slice(3),fe={FLIP:'flip',CLOCKWISE:'clockwise',COUNTERCLOCKWISE:'counterclockwise'},me=function(){function t(o,i){var n=this,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};re(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(n.update)},this.update=ie(this.update.bind(this)),this.options=de({},t.Defaults,r),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=o.jquery?o[0]:o,this.popper=i.jquery?i[0]:i,this.options.modifiers={},Object.keys(de({},t.Defaults.modifiers,r.modifiers)).forEach(function(e){n.options.modifiers[e]=de({},t.Defaults.modifiers[e]||{},r.modifiers?r.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return de({name:e},n.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(t){t.enabled&&e(t.onLoad)&&t.onLoad(n.reference,n.popper,n.options,t,n.state)}),this.update();var p=this.options.eventsEnabled;p&&this.enableEventListeners(),this.state.eventsEnabled=p}return pe(t,[{key:'update',value:function(){return k.call(this)}},{key:'destroy',value:function(){return P.call(this)}},{key:'enableEventListeners',value:function(){return A.call(this)}},{key:'disableEventListeners',value:function(){return I.call(this)}}]),t}();return me.Utils=('undefined'==typeof window?global:window).PopperUtils,me.placements=ae,me.Defaults={placement:'bottom',eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(e){var t=e.placement,o=t.split('-')[0],i=t.split('-')[1];if(i){var n=e.offsets,r=n.reference,p=n.popper,s=-1!==['bottom','top'].indexOf(o),d=s?'left':'top',a=s?'width':'height',l={start:se({},d,r[d]),end:se({},d,r[d]+r[a]-p[a])};e.offsets.popper=de({},p,l[i])}return e}},offset:{order:200,enabled:!0,fn:z,offset:0},preventOverflow:{order:300,enabled:!0,fn:function(e,t){var o=t.boundariesElement||r(e.instance.popper);e.instance.reference===o&&(o=r(o));var i=w(e.instance.popper,e.instance.reference,t.padding,o);t.boundaries=i;var n=t.priority,p=e.offsets.popper,s={primary:function(e){var o=p[e];return p[e]<i[e]&&!t.escapeWithReference&&(o=X(p[e],i[e])),se({},e,o)},secondary:function(e){var o='right'===e?'left':'top',n=p[o];return p[e]>i[e]&&!t.escapeWithReference&&(n=V(p[o],i[e]-('right'===e?p.width:p.height))),se({},o,n)}};return n.forEach(function(e){var t=-1===['left','top'].indexOf(e)?'secondary':'primary';p=de({},p,s[t](e))}),e.offsets.popper=p,e},priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,o=t.popper,i=t.reference,n=e.placement.split('-')[0],r=_,p=-1!==['top','bottom'].indexOf(n),s=p?'right':'bottom',d=p?'left':'top',a=p?'width':'height';return o[s]<r(i[d])&&(e.offsets.popper[d]=r(i[d])-o[a]),o[d]>r(i[s])&&(e.offsets.popper[d]=r(i[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,o){if(!F(e.instance.modifiers,'arrow','keepTogether'))return e;var i=o.element;if('string'==typeof i){if(i=e.instance.popper.querySelector(i),!i)return e;}else if(!e.instance.popper.contains(i))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),e;var n=e.placement.split('-')[0],r=e.offsets,p=r.popper,s=r.reference,d=-1!==['left','right'].indexOf(n),a=d?'height':'width',l=d?'Top':'Left',f=l.toLowerCase(),m=d?'left':'top',c=d?'bottom':'right',g=O(i)[a];s[c]-g<p[f]&&(e.offsets.popper[f]-=p[f]-(s[c]-g)),s[f]+g>p[c]&&(e.offsets.popper[f]+=s[f]+g-p[c]);var u=s[f]+s[a]/2-g/2,b=t(e.instance.popper,'margin'+l).replace('px',''),y=u-h(e.offsets.popper)[f]-b;return y=X(V(p[a]-g,y),0),e.arrowElement=i,e.offsets.arrow={},e.offsets.arrow[f]=Math.round(y),e.offsets.arrow[m]='',e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(W(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var o=w(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement),i=e.placement.split('-')[0],n=L(i),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case fe.FLIP:p=[i,n];break;case fe.CLOCKWISE:p=K(i);break;case fe.COUNTERCLOCKWISE:p=K(i,!0);break;default:p=t.behavior;}return p.forEach(function(s,d){if(i!==s||p.length===d+1)return e;i=e.placement.split('-')[0],n=L(i);var a=e.offsets.popper,l=e.offsets.reference,f=_,m='left'===i&&f(a.right)>f(l.left)||'right'===i&&f(a.left)<f(l.right)||'top'===i&&f(a.bottom)>f(l.top)||'bottom'===i&&f(a.top)<f(l.bottom),c=f(a.left)<f(o.left),h=f(a.right)>f(o.right),g=f(a.top)<f(o.top),u=f(a.bottom)>f(o.bottom),b='left'===i&&c||'right'===i&&h||'top'===i&&g||'bottom'===i&&u,y=-1!==['top','bottom'].indexOf(i),w=!!t.flipVariations&&(y&&'start'===r&&c||y&&'end'===r&&h||!y&&'start'===r&&g||!y&&'end'===r&&u);(m||b||w)&&(e.flipped=!0,(m||b)&&(i=p[d+1]),w&&(r=j(r)),e.placement=i+(r?'-'+r:''),e.offsets.popper=de({},e.offsets.popper,S(e.instance.popper,e.offsets.reference,e.placement)),e=N(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundariesElement:'viewport'},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,o=t.split('-')[0],i=e.offsets,n=i.popper,r=i.reference,p=-1!==['left','right'].indexOf(o),s=-1===['top','left'].indexOf(o);return n[p?'left':'top']=r[o]-(s?n[p?'width':'height']:0),e.placement=L(t),e.offsets.popper=h(n),e}},hide:{order:800,enabled:!0,fn:function(e){if(!F(e.instance.modifiers,'hide','preventOverflow'))return e;var t=e.offsets.reference,o=T(e.instance.modifiers,function(e){return'preventOverflow'===e.name}).boundaries;if(t.bottom<o.top||t.left>o.right||t.top>o.bottom||t.right<o.left){if(!0===e.hide)return e;e.hide=!0,e.attributes['x-out-of-boundaries']=''}else{if(!1===e.hide)return e;e.hide=!1,e.attributes['x-out-of-boundaries']=!1}return e}},computeStyle:{order:850,enabled:!0,fn:function(e,t){var o=t.x,i=t.y,n=e.offsets.popper,p=T(e.instance.modifiers,function(e){return'applyStyle'===e.name}).gpuAcceleration;void 0!==p&&console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');var s,d,a=void 0===p?t.gpuAcceleration:p,l=r(e.instance.popper),f=g(l),m={position:n.position},c={left:_(n.left),top:_(n.top),bottom:_(n.bottom),right:_(n.right)},h='bottom'===o?'top':'bottom',u='right'===i?'left':'right',b=B('transform');if(d='bottom'==h?-f.height+c.bottom:c.top,s='right'==u?-f.width+c.right:c.left,a&&b)m[b]='translate3d('+s+'px, '+d+'px, 0)',m[h]=0,m[u]=0,m.willChange='transform';else{var y='bottom'==h?-1:1,w='right'==u?-1:1;m[h]=d*y,m[u]=s*w,m.willChange=h+', '+u}var E={"x-placement":e.placement};return e.attributes=de({},E,e.attributes),e.styles=de({},m,e.styles),e.arrowStyles=de({},e.offsets.arrow,e.arrowStyles),e},gpuAcceleration:!0,x:'bottom',y:'right'},applyStyle:{order:900,enabled:!0,fn:function(e){return U(e.instance.popper,e.styles),Y(e.instance.popper,e.attributes),e.arrowElement&&Object.keys(e.arrowStyles).length&&U(e.arrowElement,e.arrowStyles),e},onLoad:function(e,t,o,i,n){var r=x(n,t,e),p=v(o.placement,r,t,e,o.modifiers.flip.boundariesElement,o.modifiers.flip.padding);return t.setAttribute('x-placement',p),U(t,{position:'absolute'}),o},gpuAcceleration:void 0}}},me});
//# sourceMappingURL=popper.min.js.map
/* Drapeaux de contrôle des options de recherche */
var INCLUDE_DISABLED = 0x1 // Inclure les comptes désactivés
var INCLUDE_OLD = 0x2 // Inclure les comptes supprimés
var INCLUDE_SPECIAL = 0x4 // Inclure les comptes spéciaux (débit ...)
var EXCLUDE_SELF = 0x8 // Exclure le réquérant des résultats le cas échéant
var ALIASES_LOOKUP = 0x10 // Chercher parmi les aliases
var USE_HISTORY = 0x20 // Utiliser l'historique des aliases
var STARTS_WITH = 0x40 // Chercher une correspondance au début du texte
var EXACT_MATCH = 0x80 // Rechercher une correspondance exacte
/* Callbacks pour consulter le détail d'un résultat de recherche via la page de recherche */
function bindDetailPages(data_attribute, template_url) {
function redirectToDetailPage (index) {
......@@ -20,28 +10,38 @@ function bindDetailPages(data_attribute, template_url) {
/* Générateurs de callbacks pour mettre à jour la table des résultats d'une page de recherche */
function renewResultTable(column_generators, data_attribute, template_url) {
return function (data) {
unhighlightInput("#inputRechRapide", 'danger');
clearInputState('#inputRechRapide');
$('#tableResultats table tbody tr').remove();
var table_resultats = $('#tableResultats table tbody');
var new_lign = null;
var new_case = null;
for (const result of data) {
new_lign = $(document.createElement("tr"));
new_lign.attr("data-{0}".format(data_attribute), result.id);
for (const column of column_generators) {
new_case = $(document.createElement("td")).text(column(result));
new_lign.append(new_case);
}
if (data.length === 0) {
invalidInput('#inputRechRapide');
new_lign = $(document.createElement("tr")).addClass('text-center');
new_case = $(document.createElement("td")).text("Aucun résultat").attr('colspan', column_generators.length);
new_case.addClass('lead');
new_lign.append(new_case);
table_resultats.append(new_lign);
} else {
validInput('#inputRechRapide');
for (const result of data) {
new_lign = $(document.createElement("tr"));
new_lign.attr("data-{0}".format(data_attribute), result.id);
for (const column of column_generators) {
new_case = $(document.createElement("td")).text(column(result));
new_lign.append(new_case);
}
table_resultats.append(new_lign);
}
bindDetailPages(data_attribute, template_url);
}
bindDetailPages(data_attribute, template_url);
}
}
/* Générateur de callbacks pour indiquer une recherche infructueuse */
function showNoResults(colspan) {
return function (jqxhr) {
highlightInput("#inputRechRapide", 'danger')
invalidInput("#inputRechRapide")
$('#tableResultats table tbody tr').remove();
var table_resultats = $('#tableResultats table tbody');
var new_lign = $(document.createElement("tr")).addClass('text-center');
......
......@@ -4,25 +4,29 @@
* Transforme les données à envoyer en JSON
* Décode les données reçues du serveur */
function xhr(url, method, data, success, fail) {
console.log(method);
"use strict";
success = (success === undefined) ? doNothing : success;
fail = (fail === undefined) ? doNothing : fail;
var safe_methods = ["GET", "HEAD", "OPTIONS", "TRACE"];
var xhr_settings = {
'type' : method.toLocaleUpperCase(),
'url' : url,
'contentType' : 'application/json',
'accepts' : {'json' : 'application/json', 'yaml' : 'application/yaml'},
'accepts' : {'json' : 'application/json'},
'dataType' : 'json',
'data' : (typeof data === "string") ? data : JSON.stringify(data),
};
if (typeof data === "string") {
xhr_settings['data'] = data;
} else {
xhr_settings['data'] = JSON.stringify(data);
}
if (!safe_methods.includes(method.toLocaleUpperCase())) {
xhr_settings['headers'] = {'X-CSRFToken' : getCookie('csrftoken')};
}
return $.ajax(xhr_settings).done(success).fail(fail);
}
/* Callback pour afficher à l'utilisateur l'erreur renvoyée par l'API */
/* Callbacks pour afficher à l'utilisateur un message renvoyé par l'API */
function showSuccess(jqxhr) {display_message(jqxhr.responseJSON.detail, 'success');}
function showInfo(jqxhr) {display_message(jqxhr.responseJSON.detail, 'info');}
function showWarning(jqxhr) {display_message(jqxhr.responseJSON.detail, 'warning');}
function showError(jqxhr) {display_message(jqxhr.responseJSON.detail, 'error');}
/* Callback pour ne rien faire des données renvoyées par l'API */
function doNothing(jqxhr) {}
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-09-07 09:37
from __future__ import unicode_literals
import comptes.models
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
replaces = [('comptes', '0001_initial'), ('comptes', '0002_auto_20171213_1003'), ('comptes', '0003_auto_20171213_1005'), ('comptes', '0004_auto_20171213_1017'), ('comptes', '0005_auto_20180207_2231'), ('comptes', '0006_auto_20180225_0249')]
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
('auth', '0008_alter_user_username_max_length'),
]
operations = [
migrations.CreateModel(
name='Adherent',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('pseudo', models.CharField(max_length=1023, unique=True, validators=[django.core.validators.RegexValidator('^(\\S|\\S+.*\\S+)$')])),
('nom', models.CharField(blank=True, max_length=255)),
('prenom', models.CharField(blank=True, max_length=255, verbose_name='prénom')),
('email', models.EmailField(max_length=254)),
('sexe', models.CharField(blank=True, choices=[(None, 'ND'), ('M', 'M'), ('F', 'F')], default=None, max_length=1, null=True)),
('type', models.CharField(choices=[('personne', 'Personne'), ('club', 'Club'), ('section', 'Section'), ('débit', 'Débit')], default='personne', max_length=255)),
('telephone', models.CharField(blank=True, max_length=50, validators=[django.core.validators.RegexValidator('^[0-9 -]+$')], verbose_name='téléphone')),
('adresse', models.TextField(blank=True, default='')),
('remunere', models.BooleanField(default=False, verbose_name='rémunéré')),
('pbsante', models.TextField(blank=True, default='', verbose_name='problème de santé')),
('remarque', models.TextField(blank=True, default='')),
('uuid', models.UUIDField(default=uuid.uuid4, unique=True)),
('is_staff', models.BooleanField(default=False, verbose_name='membre actif')),
('is_active', models.BooleanField(default=True, verbose_name='compte actif')),
('supprime', models.BooleanField(default=False, verbose_name='compte supprimé')),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
],
options={
'permissions': [('adherent_inscrire', 'Inscrire un nouvel adhérent'), ('adherent_detail', "Consulter le profil d'un adhérent"), ('adherent_modifier', "Modifier le profil d'un adhérent"), ('adherent_chercher', 'Chercher parmi les adhérents'), ('adherent_change_pw', 'Changer un mot de passe'), ('adherent_desactiver', "Désactiver le compte d'un adhérent"), ('adherent_supprimer', 'Supprimer un adhérent')],
'verbose_name': 'adhérent',
'default_permissions': [],
},
),
migrations.CreateModel(
name='Accreditation',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('meta', models.BooleanField(default=False, verbose_name='méta-droit')),
('adherent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='accreditations', to=settings.AUTH_USER_MODEL, verbose_name='adhérent')),
],
options={
'default_permissions': [],
},
),
migrations.CreateModel(
name='Adhesion',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('debut', models.DateTimeField(auto_now_add=True, verbose_name='début')),
('fin', models.DateTimeField(blank=True)),
('adherent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='adhesions', to=settings.AUTH_USER_MODEL, verbose_name='adhérent')),
],
options={
'verbose_name': 'adhésion',
'default_permissions': [],
},
),
migrations.CreateModel(
name='Alias',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('alias', models.TextField(unique=True, validators=[django.core.validators.RegexValidator('^__deleted__[0-9]+$', inverse_match=True), django.core.validators.RegexValidator('^(\\S|\\S+.*\\S+)$')], verbose_name='alias')),
('proprietaire', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='aliases', to=settings.AUTH_USER_MODEL, verbose_name='propriétaire')),
],
options={
'permissions': [('alias_adopter', 'Adopter un alias'), ('alias_abandonner', 'Abandonner un alias')],
'default_permissions': [],
},
),
migrations.CreateModel(
name='Droit',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.CharField(max_length=255, verbose_name='description')),
('codename', models.CharField(max_length=100, verbose_name='nom de code')),
('niveau', models.PositiveIntegerField(choices=[(0, 'LIMITE'), (1, 'BASIQUE'), (2, 'ETENDU'), (255, 'TOTAL')])),
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='content type')),
],
options={
'default_permissions': [],
},
),
migrations.CreateModel(
name='Historique',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateTimeField(auto_now_add=True)),
('alias', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='comptes.Alias')),
('precedent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='aliases_cedes', to=settings.AUTH_USER_MODEL)),
('suivant', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='aliases_acquis', to=settings.AUTH_USER_MODEL)),
],
options={
'default_permissions': [],
},
),
migrations.CreateModel(
name='Section',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sigle', models.CharField(max_length=255, unique=True, verbose_name='sigle')),
('nom', models.TextField(verbose_name='nom')),
('ferme', models.BooleanField(default=False, verbose_name='fermé')),
],
options={
'default_permissions': [],
},
),
migrations.AddField(
model_name='adhesion',
name='section',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='adhesions', to='comptes.Section'),
),
migrations.AddField(
model_name='accreditation',
name='droit',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='accreditations', to='comptes.Droit'),
),
migrations.AddField(
model_name='adherent',
name='droits',
field=models.ManyToManyField(related_name='adherents', through='comptes.Accreditation', to='comptes.Droit'),
),
migrations.AlterUniqueTogether(
name='droit',
unique_together=set([('codename', 'niveau')]),
),
migrations.AlterUniqueTogether(
name='accreditation',
unique_together=set([('droit', 'adherent')]),
),
migrations.RemoveField(
model_name='adherent',
name='groups',
),
migrations.AddField(
model_name='adherent',
name='avatar',
field=models.ImageField(blank=True, default=None, max_length=255, null=True, upload_to=comptes.models.upload_to_avatars),
),
migrations.AlterField(
model_name='adherent',
name='is_superuser',
field=models.BooleanField(default=False, verbose_name='superutilisateur'),
),
migrations.AlterField(
model_name='adherent',
name='pseudo',
field=models.CharField(max_length=1023, unique=True, validators=[django.core.validators.RegexValidator('^#[0-9]+$', inverse_match=True), django.core.validators.RegexValidator('^(\\S|\\S+.*\\S+)$')]),
),
migrations.AlterField(
model_name='alias',
name='alias',
field=models.TextField(unique=True, validators=[django.core.validators.RegexValidator('^__deleted__[0-9]+$', inverse_match=True), django.core.validators.RegexValidator('^#[0-9]+$', inverse_match=True), django.core.validators.RegexValidator('^(\\S|\\S+.*\\S+)$')], verbose_name='alias'),
),
]
......@@ -270,7 +270,7 @@ function getAlias(data) {
alias_link.click(triggerAliasDeletion);
$("#idAliasList").append(alias_list_item.prepend(alias_link));
}
unhighlightInput("#inputNewAlias", 'danger');
clearInputState("#inputNewAlias");
if (alias_id) {
xhr('/api/comptes/aliases/{0}/'.format(alias_id), 'PATCH', {proprietaire : {{ object.id }}}, enqueueNewAlias);
} else {
......@@ -278,7 +278,7 @@ function getAlias(data) {
}
}
function aliasNotAvailable () {highlightInput("#inputNewAlias", 'danger');}
function aliasNotAvailable () {invalidInput("#inputNewAlias");}