refonte de folder.pt et docs_search.pt
This commit is contained in:
22
.vscode/launch.json
vendored
Normal file
22
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Pserve",
|
||||||
|
"python": "C:/pyramid10/Scripts/python.exe",
|
||||||
|
"program": "/pyramid10/Scripts/pserve.exe",
|
||||||
|
"args": [
|
||||||
|
"-v",
|
||||||
|
"development.ini",
|
||||||
|
"--reload"
|
||||||
|
],
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"pyramid": true,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -24,16 +24,6 @@
|
|||||||
<textarea class="form-control monospace-font" rows="15" cols="40" id="texte" name="texte">${doc.texte}</textarea>
|
<textarea class="form-control monospace-font" rows="15" cols="40" id="texte" name="texte">${doc.texte}</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label col-xs-2" for="tag2">Statut</label>
|
|
||||||
<div class="col-xs-6">
|
|
||||||
<select class="form-control" id="tag1" name="tag1">
|
|
||||||
<div tal:repeat="item statuts">
|
|
||||||
<option value="${item}" tal:attributes="selected doc.statut==item and 'selected' or None">${item}</option>
|
|
||||||
</div>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-2">Dossier</label>
|
<label class="control-label col-xs-2">Dossier</label>
|
||||||
<div class="col-xs-7">
|
<div class="col-xs-7">
|
||||||
|
|||||||
@@ -20,24 +20,28 @@
|
|||||||
</div><!-- row -->
|
</div><!-- row -->
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div tal:condition="docs">
|
<div tal:condition="dt_data != '[]'">
|
||||||
<table class="table table-striped table-bordered">
|
<table id="folder_list" class="table">
|
||||||
<tr tal:repeat="ligne docs">
|
<thead>
|
||||||
<td><a href="/doc_view/${ligne.doc_id}"><b>${ligne.intitule}</b></a></td>
|
<tr>
|
||||||
<td>${ligne.tag1}</td>
|
<th>Titre</th>
|
||||||
<td>${ligne.cree_le.strftime("%d-%m-%Y")}</td>
|
<th>Tags</th>
|
||||||
<td>${ligne.modif_le.strftime("%d-%m-%Y")}</td>
|
<th>Date</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div tal:condition="not docs">
|
<div tal:condition="dt_data == '[]'">
|
||||||
<p class="text-danger text-center">Aucun document ne correspond à la recherche</p>
|
<h3 class="text-center">Aucun élément trouvé pour ce critère</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
|
var dataSet = ${dt_data};
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#search-form').formValidation({
|
$('#search-form').formValidation({
|
||||||
framework: 'bootstrap',
|
framework: 'bootstrap',
|
||||||
@@ -62,6 +66,23 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$.fn.dataTable.moment('DD/MM/YYYY - HH:mm');
|
||||||
|
$('#folder_list').DataTable({
|
||||||
|
data: dataSet,
|
||||||
|
pageLength: 50,
|
||||||
|
bLengthChange: false,
|
||||||
|
language: {
|
||||||
|
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
|
||||||
|
},
|
||||||
|
columnDefs: [
|
||||||
|
{ "targets": 0,
|
||||||
|
"render": function (data, type, row, meta) {
|
||||||
|
// ajouter un link vers le formulaire
|
||||||
|
return '<a href="/doc_view/' + row[3] + '">' + data + '</a>';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
});
|
||||||
$('form input').on('keypress', function(e) {
|
$('form input').on('keypress', function(e) {
|
||||||
var code = e.keyCode || e.which;
|
var code = e.keyCode || e.which;
|
||||||
if (code === 13) {
|
if (code === 13) {
|
||||||
|
|||||||
@@ -6,18 +6,44 @@
|
|||||||
<a href="${request.application_url}/doc_edit/${topic}/0" tal:condition="not layout.isAnonymous()">[ Créer ]</a>
|
<a href="${request.application_url}/doc_edit/${topic}/0" tal:condition="not layout.isAnonymous()">[ Créer ]</a>
|
||||||
</p>
|
</p>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<table class="table">
|
<table id="folder_list" class="table">
|
||||||
<tr tal:repeat="ligne docs">
|
<thead>
|
||||||
<td><a href="/doc_view/${ligne.doc_id}"><b>${ligne.intitule}</b></a></td>
|
<tr>
|
||||||
<td>${ligne.tag1}</td>
|
<th>Titre</th>
|
||||||
<td>${ligne.cree_le.strftime("%d-%m-%Y")}</td>
|
<th>Tags</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
</div>
|
<script type="text/javascript">
|
||||||
|
var dataSet = ${dt_data};
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$.fn.dataTable.moment('DD/MM/YYYY - HH:mm');
|
||||||
|
$('#folder_list').DataTable({
|
||||||
|
data: dataSet,
|
||||||
|
pageLength: 50,
|
||||||
|
bLengthChange: false,
|
||||||
|
language: {
|
||||||
|
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
|
||||||
|
},
|
||||||
|
columnDefs: [
|
||||||
|
{ "targets": 0,
|
||||||
|
"render": function (data, type, row, meta) {
|
||||||
|
// ajouter un link vers le formulaire
|
||||||
|
return '<a href="/doc_view/' + row[3] + '">' + data + '</a>';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div> <!-- content -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from pyramid.httpexceptions import (
|
|||||||
HTTPNotFound,
|
HTTPNotFound,
|
||||||
HTTPForbidden,
|
HTTPForbidden,
|
||||||
)
|
)
|
||||||
|
import json
|
||||||
|
|
||||||
from ..models.contents import *
|
from ..models.contents import *
|
||||||
|
|
||||||
@@ -23,12 +24,25 @@ def folder(request):
|
|||||||
logged_in = request.authenticated_userid
|
logged_in = request.authenticated_userid
|
||||||
|
|
||||||
# lire toutes les docs du topic
|
# lire toutes les docs du topic
|
||||||
docs = get_docs_bytopic(request, topic, logged_in)
|
items = get_docs_bytopic(request, topic, logged_in)
|
||||||
|
|
||||||
|
# construire la liste
|
||||||
|
liste=[]
|
||||||
|
for item in items:
|
||||||
|
# lire le(s) tag(s) du documents
|
||||||
|
tags = get_docs_tags(request, item.doc_id)
|
||||||
|
tags_list = ''
|
||||||
|
for tag in tags:
|
||||||
|
tags_list += tag.tag + ', '
|
||||||
|
|
||||||
|
cree_le = item.cree_le.strftime('%d/%m/%Y')
|
||||||
|
d = (item.intitule, tags_list, cree_le, item.doc_id)
|
||||||
|
liste.append(d)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'page_title': "Contenu de %s" % topic.upper(),
|
'page_title': "Contenu de %s" % topic.upper(),
|
||||||
'docs': docs,
|
|
||||||
'topic': topic,
|
'topic': topic,
|
||||||
|
'dt_data': json.dumps(liste),
|
||||||
}
|
}
|
||||||
|
|
||||||
@view_config(route_name='doc_edit', renderer='../templates/contents/doc_edit.pt', permission='view')
|
@view_config(route_name='doc_edit', renderer='../templates/contents/doc_edit.pt', permission='view')
|
||||||
@@ -99,17 +113,28 @@ def doc_search(request):
|
|||||||
|
|
||||||
logged_in = request.authenticated_userid
|
logged_in = request.authenticated_userid
|
||||||
critere = ''
|
critere = ''
|
||||||
docs = []
|
liste=[]
|
||||||
|
|
||||||
if 'form.submitted' in request.params:
|
if 'form.submitted' in request.params:
|
||||||
critere = request.params['critere']
|
critere = request.params['critere']
|
||||||
# si afficher tous les fiches ?
|
# si afficher tous les fiches ?
|
||||||
docs = get_docs_bycritere(request, critere, logged_in)
|
items = get_docs_bycritere(request, critere, logged_in)
|
||||||
|
|
||||||
|
# construire la liste
|
||||||
|
for item in items:
|
||||||
|
# lire le(s) tag(s) du documents
|
||||||
|
tags = get_docs_tags(request, item.doc_id)
|
||||||
|
tags_list = ''
|
||||||
|
for tag in tags:
|
||||||
|
tags_list += tag.tag + ', '
|
||||||
|
|
||||||
|
cree_le = item.cree_le.strftime('%d/%m/%Y')
|
||||||
|
d = (item.intitule, tags_list, cree_le, item.doc_id)
|
||||||
|
liste.append(d)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'page_title': "Rechercher",
|
'page_title': "Rechercher",
|
||||||
'docs': docs,
|
'dt_data': json.dumps(liste),
|
||||||
'critere': critere,
|
|
||||||
'critere': critere,
|
'critere': critere,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user