enter key simulated submit form
This commit is contained in:
@@ -19,7 +19,7 @@ def execute_query(request, query, params):
|
||||
mark_changed(request.dbsession)
|
||||
transaction.commit()
|
||||
|
||||
def get_chantiers_byName(request, societe, name, tous):
|
||||
def get_chantiers_byName(request, societe, name):
|
||||
|
||||
query = "CALL spGET_CHANTIERS_byName('%s','%s');" % (societe, name)
|
||||
results = request.dbsession.execute(query).fetchall()
|
||||
|
||||
@@ -8,31 +8,21 @@
|
||||
<br />
|
||||
<div class="col-md-offset-4 col-md-4 well">
|
||||
|
||||
<form id="login-form" role="form" action="${url}" method="post"
|
||||
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">
|
||||
<form id="login-form" role="form" action="${url}" method="post" >
|
||||
|
||||
<h3>Se connecter</h3>
|
||||
<input type="hidden" name="came_from" value="${came_from}"/>
|
||||
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="text" name="login" value="${login}"
|
||||
placeholder="Identifiant"
|
||||
data-fv-notempty="true"
|
||||
data-fv-notempty-message="L'identifiant est obligatoire" />
|
||||
<input class="form-control" type="text" name="login" value="${login}" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="password" name="password" value=""
|
||||
placeholder="Mot de passe"
|
||||
data-fv-notempty="true"
|
||||
data-fv-notempty-message="Le mot de passe est obligatoire">
|
||||
<input class="form-control" type="password" name="password" value="" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary" type="submit" name="form.submitted">Se connecter</button>
|
||||
<button id="submitButton" class="btn btn-primary" type="submit" name="form.submitted">Se connecter</button>
|
||||
|
||||
</div>
|
||||
<p class="help-block">
|
||||
@@ -49,9 +39,38 @@
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#login-form').formValidation();
|
||||
$('#login-form').formValidation({
|
||||
framework: 'bootstrap',
|
||||
message: 'This value is not valid',
|
||||
icon: {
|
||||
valid: 'glyphicon glyphicon-ok',
|
||||
invalid: 'glyphicon glyphicon-remove',
|
||||
validating: 'glyphicon glyphicon-refresh'
|
||||
},
|
||||
fields: {
|
||||
login: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Le code utilisateur est obligatoire'
|
||||
},
|
||||
}
|
||||
},
|
||||
password: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Le mot de passe est obligatoire'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$('form input').on('keypress', function(e) {
|
||||
return e.which !== 13;
|
||||
var code = e.keyCode || e.which;
|
||||
if (code === 13) {
|
||||
e.preventDefault();
|
||||
// simuler clic bouton submit
|
||||
document.getElementById("submitButton").click();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -25,23 +25,12 @@
|
||||
<label class="col-sm-4 control-label">Nom ou numéro du chantier</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="name" value="${name}"
|
||||
data-fv-notempty="true"
|
||||
data-fv-notempty-message="Le nom ou le numéro est obligatoire"
|
||||
|
||||
data-fv-stringlength="true"
|
||||
data-fv-stringlength-min="2"
|
||||
data-fv-stringlength-max="30"
|
||||
data-fv-stringlength-message="Le nom ou le numéro doit avoir de 2 à 30 caractères de long" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- case a cocher "Afficher fiches cloturées" -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-4 col-sm-8">
|
||||
<input type="checkbox" name="cb_tous" value="cb_tous"
|
||||
tal:attributes="checked cb_tous == 'oui' and 'checked' or None">
|
||||
Afficher les chantiers cloturées</input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-4 col-sm-8">
|
||||
@@ -74,6 +63,7 @@
|
||||
<script type="text/javascript">
|
||||
var dataSet = ${dt_data};
|
||||
var goto_url = '${goto_url}';
|
||||
var order_option = '${order_option}'
|
||||
|
||||
$(document).ready(function() {
|
||||
$.fn.dataTable.moment('DD-MM-YYYY');
|
||||
@@ -84,6 +74,7 @@
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
|
||||
},
|
||||
order: [[0, order_option]],
|
||||
columnDefs: [
|
||||
{ "targets": 0,
|
||||
"render": function (data, type, full, meta) {
|
||||
|
||||
@@ -75,13 +75,8 @@ def dossier_lookup(request):
|
||||
else:
|
||||
societe = societe_defaut
|
||||
|
||||
# si afficher tous les fiches ?
|
||||
if 'cb_tous' in request.params:
|
||||
cb_tous = "oui"
|
||||
chantiers = get_chantiers_byName(request, societe, name, True)
|
||||
else:
|
||||
cb_tous = "non"
|
||||
chantiers = get_chantiers_byName(request, societe, name, False)
|
||||
# lire les chantiers
|
||||
chantiers = get_chantiers_byName(request, societe, name)
|
||||
if len(chantiers) == 0:
|
||||
message = "Chantier non trouvé : %s" % name
|
||||
# construire la liste
|
||||
@@ -90,6 +85,11 @@ def dossier_lookup(request):
|
||||
item.nosin, item.status)
|
||||
liste.append(d)
|
||||
|
||||
if len(name) == 0 :
|
||||
order_option = 'desc'
|
||||
else:
|
||||
order_option = 'asc'
|
||||
|
||||
return {
|
||||
'page_title': "Rechercher un chantier",
|
||||
'url': url,
|
||||
@@ -99,7 +99,7 @@ def dossier_lookup(request):
|
||||
'societes': societes,
|
||||
'societe': societe,
|
||||
'name': name,
|
||||
'cb_tous': cb_tous,
|
||||
'order_option': order_option,
|
||||
}
|
||||
|
||||
@view_config(route_name='dossier_view', renderer='../templates/dossier/dossier_view.pt', permission='view')
|
||||
@@ -450,6 +450,10 @@ def rdf_edit(request):
|
||||
tierce_personnes = get_rdf_causes(request, 'C08')
|
||||
|
||||
if 'form.submitted' in request.params:
|
||||
if len(request.params['signature_svg']) > 7000:
|
||||
request.session.flash(u"La signature est trop grande !", 'danger')
|
||||
return HTTPFound(location=url)
|
||||
|
||||
new_values = {}
|
||||
for param, db_value in rapport.items():
|
||||
if param in request.params and request.params[param] != db_value:
|
||||
|
||||
Reference in New Issue
Block a user