added users_list.pt and user_edit.pt

This commit is contained in:
2017-05-22 15:00:26 +02:00
parent fb01cd1437
commit 8ae79cb808
13 changed files with 404 additions and 101 deletions

View File

@@ -18,9 +18,9 @@
<br />
<div class="row well" tal:condition="layout.isAdmin">
<div class="col-sm-3">
<a href="${request.application_url}/last_connected">
<span class="glyphicon glyphicon-log-in logo-small"></span><br />
<h4>Derniers connectés</h4></a>
<a href="${request.application_url}/users_list">
<span class="glyphicon glyphicon-user logo-small"></span><br />
<h4>UTILISATEURS</h4></a>
</div>
</div> <!-- row 2 -->
<br />

View File

@@ -1,26 +0,0 @@
<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<div tal:condition="items">
<table class="table table-striped table-bordered">
<tr>
<th>Date</th>
<th>Code</th>
<th>Nom</th>
<th>email</th>
</tr>
<tr tal:repeat="item items">
<td tal:content="python:item.dern_cnx_le.strftime('%d/%m/%Y %H:%M')" />
<td align="left" tal:content="item.CD_UTI" />
<td align="left" tal:content="item.NOM" />
<td align="left" tal:content="item.email" />
</tr>
</table>
</div>
</div><!-- content -->
</metal:block>

View File

@@ -12,7 +12,7 @@
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<!-- link href="${request.static_url('mondumas:static/dist/datatable/dataTables.bootstrap.css')}" rel="stylesheet" media="all" -->
<link href="${request.static_url('mondumas:static/dist/datatable/dataTables.bootstrap.css')}" rel="stylesheet" media="all">
<link href="${request.static_url('mondumas:static/dist/formvalidation/css/formValidation.min.css')}" rel="stylesheet">
<!-- Custom CSS -->
<link href="${request.static_url('mondumas:static/css/style.less')}" type="text/css" rel="stylesheet/less">
@@ -23,14 +23,15 @@
<!-- Bootstrap Fullcalendar plugin -->
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/locale/fr.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/locale/fr.js"></script>
<!-- Bootstrap Datepicker plugin -->
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
<!-- Datatable
<!-- Datatable -->
<script src="${request.static_url('mondumas:static/dist/datatable/jquery.dataTables.js')}"></script>
<script src="${request.static_url('mondumas:static/dist/datatable/dataTables.bootstrap.js')}"></script>
-->
<script src="${request.static_url('mondumas:static/dist/datatable/datetime-moment.js')}"></script>
<!-- FormValidation plugin -->
<script src="${request.static_url('mondumas:static/dist/formvalidation/js/formValidation.min.js')}"></script>
<script src="${request.static_url('mondumas:static/dist/formvalidation/js/framework/bootstrap.min.js')}"></script>

View File

@@ -0,0 +1,11 @@
from .models.default import get_member_by_id
def groupfinder(userid, request):
member = get_member_by_id(request, userid)
if member:
# Roles administrateur ?
if member.access == 9:
return ['group:administrators']
else:
return [] # it means that userid is logged in (it returns None if userid isn't logged in)

View File

@@ -0,0 +1,110 @@
<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
<br />
<div class="row">
<form id="user_edit-form" class="form-horizontal" action="${url}" method="post" tal:condition="individu"
data-fv-framework="bootstrap"
data-fv-icon-valid="glyphicon glyphicon-ok"
data-fv-icon-invalid="glyphicon glyphicon-remove"
data-fv-icon-validating="glyphicon glyphicon-refresh">
<div class="form-group">
<label class="control-label col-xs-2" for="cd_uti">Identifiant</label>
<div class="col-xs-2">
<input class="form-control" type="text" id="cd_uti" name="cd_uti" value="${individu.cd_uti}"
placeholder="10 caractères maximum"
data-fv-notempty="true"
data-fv-notempty-message="L'identifiant est obligatoire"
data-fv-stringlength="true"
data-fv-stringlength-max="3"
data-fv-stringlength-message="3 caractères maximum" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="intitule">Nom et prénom</label>
<div class="col-xs-5">
<input class="form-control" type="text" id="intitule" name="nom" value="${individu.nom}"
placeholder="30 caractères maximum"
data-fv-notempty="true"
data-fv-notempty-message="Le nom est obligatoire"
data-fv-stringlength="true"
data-fv-stringlength-max="25"
data-fv-stringlength-message="25 caractères maximum" />
</div>
</div>
<div class="form-group">
<label class="col-xs-2 control-label">Email</label>
<div class="col-xs-5">
<input class="form-control" type="text" name="email"
value="${individu.email}" placeholder="55 caractères maximum"
data-fv-emailaddress="true"
data-fv-emailaddress-message="L'adresse email n'est pas valide" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="access">Accès</label>
<div class="col-xs-2">
<select class="form-control" id="access" name="access">
<optgroup tal:repeat="item access">
<option value="${item}" tal:attributes="selected individu.access==item[0] and 'selected' or None">${item}</option>
</optgroup>
</select>
</div>
</div>
<div class="form-group">
<div class="col-xs-offset-2 col-xs-7 checkbox">
<label><input type="checkbox" name="agenda" value="individu.agenda" id="agenda"
tal:attributes="checked individu.agenda <> 0 and 'checked' or None">Gérer son agenda
</label>
</div>
</div>
<div class="form-group">
<div class="col-xs-offset-2 col-xs-7 checkbox">
<label><input type="checkbox" name="actif" value="individu.actif" id="actif"
tal:attributes="checked individu.actif <> 0 and 'checked' or None">La fiche est active
</label>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="access">Dernière modif</label>
<div class="col-xs-7">
<p class="form-control-static">${individu.modif_le.strftime('%d/%m/%Y - %H:%M')}</p>
</div>
</div>
<div class="form-group">
<div class="col-xs-offset-2 col-xs-7 checkbox">
<p class="form-control-static">La fiche est active</p>
</div>
</div>
<br />
<div class="form-group">
<div class="col-xs-offset-2 col-xs-10">
<div class="form-group">
<a class="btn btn-default" href="${request.application_url}/users_list"><span class="glyphicon glyphicon-chevron-left"></span> Retour</a>
<button class="btn btn-primary" type="submit" name="form.submitted">
<span class="glyphicon glyphicon-ok"></span> Enregistrer</button>
<button class="btn btn-warning" type="submit" name="form.deleted"
tal:condition="individu.cd_uti > 0">
<span class="glyphicon glyphicon-remove"></span> Supprimer</button>
</div>
</div>
</div>
</form>
<br />
<br />
</div> <!-- row -->
<script>
$(document).ready(function() {
$('#user_edit-form').formValidation();
$('form input').on('keypress', function(e) {
return e.which !== 13;
});
});
</script>
</div>
</metal:block>

View File

@@ -0,0 +1,63 @@
<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<p>
<a href="${request.application_url}/" class="btn btn-default" role="button">
<span class="glyphicon glyphicon-chevron-left"></span> Retour</a>
<a href="${request.application_url}/user_edit/0" class="btn btn-success" role="button">
<span class="glyphicon glyphicon-plus"></span> Nouveau utilisateur</a>
</p>
<table id="users_list" class="table table-striped table-bordered">
<thead>
<tr>
<th>Login</th>
<th>Nom, Prénom</th>
<th>Email</th>
<th>Agenda</th>
<th>Rôle</th>
<th>Dern cnx</th>
<th>Etat</th>
</tr>
</thead>
</table>
<br />
<br />
<script type="text/javascript">
var dataSet = ${dt_data};
$(document).ready(function() {
$.fn.dataTable.moment('DD/MM/YYYY - HH:mm');
$('#users_list').DataTable({
data: dataSet,
pageLength: 50,
bLengthChange: false,
columnDefs: [
{ "targets": 0,
"render": function (data, type, full, meta) {
// ajouter un link vers le formulaire
return '<a href="/user_edit/' + data + '">' + data + '</a>';
},
},
{ "targets": 3,
"render": function (data, type, full, meta) {
if (data != 0) {
return '<span class="glyphicon glyphicon-calendar"></span>';
}
else {
return '';
}
},
}
]
});
});
</script>
</div><!-- content -->
</metal:block>