amélioration de la page Accueil

This commit is contained in:
2021-12-02 16:27:56 +01:00
parent 384848f422
commit 4ac11291a7
9 changed files with 66 additions and 48 deletions

View File

@@ -32,8 +32,8 @@ def get_docs_bytopic(request, topic, logged_in):
anon = "AND statut = 'public' "
else:
anon = ""
if topic == 'BLOG':
query = "SELECT * FROM docs WHERE topic=:topic %s ORDER BY cree_le DESC LIMIT 10;" % anon
if topic == 'home':
query = "SELECT * FROM docs WHERE topic='blog' %s ORDER BY cree_le DESC LIMIT 10;" % anon
else:
query = "SELECT * FROM docs WHERE topic=:topic ORDER BY intitule;"
results = request.dbsession.execute(query, {'topic': topic}).fetchall()

View File

@@ -9,9 +9,9 @@
<table id="folder_list" class="table">
<thead>
<tr>
<th>Date</th>
<th>Titre</th>
<th>Tags</th>
<th>Date</th>
<th></th>
</tr>
</thead>
@@ -24,7 +24,7 @@
var dataSet = ${dt_data};
$(document).ready(function() {
$.fn.dataTable.moment('DD/MM/YYYY - HH:mm');
$.fn.dataTable.moment('DD.MM.YY');
$('#folder_list').DataTable({
data: dataSet,
pageLength: 50,
@@ -32,8 +32,9 @@
language: {
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
},
order: [[ 0, "desc" ]],
columnDefs: [
{ "targets": 0,
{ "targets": 1,
"render": function (data, type, row, meta) {
// ajouter un link vers le formulaire
return '<a href="/doc_view/' + row[3] + '">' + data + '</a>';

View File

@@ -4,15 +4,15 @@
<div class="row">
<div class="col-sm-4">
<br />
<br />
<img src="${request.static_url('caotek_mesavoirs:static/img/cover_image_540max.jpg')}" alt="cover_image" /><br />
<img src="${request.static_url('caotek_mesavoirs:static/img/cover_image_540max.jpg')}" alt="cover_image"
class = "img-responsive" width = "100%" /><br />
</div>
<div class="col-sm-8">
<h3>Derniers posts</h3>
<table class="table">
<tr tal:repeat="ligne items">
<td>${ligne.cree_le.strftime("%d %b")}</td>
<td>${ligne.modif_le.strftime("%d %b %y")}</td>
<td><a href="/doc_view/${ligne.doc_id}"><b>${ligne.intitule}</b></a></td>
</tr>
</table>

View File

@@ -35,8 +35,8 @@ def folder(request):
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)
modif_le = item.cree_le.strftime('%d.%m.%y')
d = (modif_le, item.intitule, tags_list, item.doc_id)
liste.append(d)
return {
@@ -134,7 +134,8 @@ def doc_search(request):
return {
'page_title': "Rechercher",
'dt_data': json.dumps(liste),
'dt_data': json.dumps(liste),
'critere': critere,
}
@view_config(route_name='doc_view', renderer='../templates/contents/doc_view.pt')

View File

@@ -72,7 +72,7 @@ def home(request):
id_photo = member.photo_instagram
# lire toutes les docs
items = get_docs_bytopic(request, 'blog', logged_in)
items = get_docs_bytopic(request, 'home', logged_in)
return {
'page_title': "Méditer, cest ouvrir la cage",