Files
caotek_monaa/caotek_mesavoirs/templates/contents/doc_search.pt

78 lines
1.9 KiB
XML

<div metal:use-macro="load: ../global_layout.pt">
<div metal:fill-slot="content">
<div class="row">
<form id="search-form" class="form-horizontal" role="form" action="/doc_search" method="post">
<div class="form-group">
<div class="col-sm-offset-2 col-sm-8">
<div class="input-group" align="center">
<input type="text" class="form-control" name="critere" value="${critere}" />
<span class="input-group-btn">
<button id="submitButton" class="btn btn-primary" type="submit" name="form.submitted">
Rechercher
</button>
</span>
</div>
</div>
</div>
</form>
</div><!-- row -->
<div class="row">
<div tal:condition="docs">
<table class="table table-striped table-bordered">
<tr tal:repeat="ligne docs">
<td><a href="/doc_view/${ligne.doc_id}"><b>${ligne.intitule}</b></a></td>
<td>${ligne.tag1}</td>
<td>${ligne.cree_le.strftime("%d-%m-%Y")}</td>
<td>${ligne.modif_le.strftime("%d-%m-%Y")}</td>
</tr>
</table>
</div>
<div tal:condition="not docs">
<p class="text-danger text-center">Aucun document ne correspond à la recherche</p>
</div>
</div>
<br />
<br />
<script>
$(document).ready(function() {
$('#search-form').formValidation({
framework: 'bootstrap',
message: 'This value is not valid',
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
critere: {
validators: {
notEmpty: {
message: 'Veuillez saisir le texte à rechercher'
},
stringLength: {
min: 3,
max: 30,
message: 'Le texte doit avoir de 3 à 30 caractères de long'
},
}
},
}
});
$('form input').on('keypress', function(e) {
var code = e.keyCode || e.which;
if (code === 13) {
e.preventDefault();
// simuler clic bouton submit
document.getElementById("submitButton").click();
}
});
});
</script>
</div>
</div>