display images_list in table
This commit is contained in:
@@ -26,9 +26,13 @@ class BlogRecordService(object):
|
|||||||
search = "%{}%".format(criteria)
|
search = "%{}%".format(criteria)
|
||||||
query = request.dbsession.query(BlogRecord).filter(or_(BlogRecord.title.like(search),
|
query = request.dbsession.query(BlogRecord).filter(or_(BlogRecord.title.like(search),
|
||||||
BlogRecord.body.like(search)))
|
BlogRecord.body.like(search)))
|
||||||
|
# import pdb;pdb.set_trace()
|
||||||
|
if request.authenticated_userid == None:
|
||||||
|
# if user is anonym, display only published posts
|
||||||
|
query = query.filter(BlogRecord.status == 'publié')
|
||||||
if request.authenticated_userid != 'admin':
|
if request.authenticated_userid != 'admin':
|
||||||
# if user is not 'admin', hide admin posts
|
# if user is not 'admin', hide admin posts
|
||||||
query = query.filter(BlogRecord.tag != 'admin')
|
query = query.filter(BlogRecord.topic_id != '_admin')
|
||||||
return query.order_by(BlogRecord.title).all()
|
return query.order_by(BlogRecord.title).all()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -170,50 +170,6 @@ blockquote {
|
|||||||
border-left: 5px solid #df4937;
|
border-left: 5px solid #df4937;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TJ Gallery */
|
|
||||||
.pictures{
|
|
||||||
font-size: 0px;
|
|
||||||
}
|
|
||||||
.pictures .item{
|
|
||||||
position:relative;
|
|
||||||
display:inline-block;
|
|
||||||
}
|
|
||||||
.pictures .item img{
|
|
||||||
position:relative;
|
|
||||||
z-index: 11;
|
|
||||||
}
|
|
||||||
.pictures .item .item_description{
|
|
||||||
position:absolute;
|
|
||||||
z-index: 10;
|
|
||||||
left: -15px;
|
|
||||||
top: -15px;
|
|
||||||
right: -15px;
|
|
||||||
bottom: -60px;
|
|
||||||
|
|
||||||
-webkit-box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.4);
|
|
||||||
-moz-box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.4);
|
|
||||||
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.4);
|
|
||||||
|
|
||||||
background:#962d21;
|
|
||||||
padding: 15px;
|
|
||||||
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
.pictures .item .item_description span{
|
|
||||||
color:#ffffff;
|
|
||||||
font-size: 13px;
|
|
||||||
display:block;
|
|
||||||
position:absolute;
|
|
||||||
bottom: 15px;
|
|
||||||
height: 30px;
|
|
||||||
}
|
|
||||||
.pictures .item:hover{
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
.pictures .tjGalleryItem .item:hover .item_description{
|
|
||||||
display:block;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* https://web-eau.net/blog/10-exemples-de-footer-pour-vous-inspirer */
|
/* https://web-eau.net/blog/10-exemples-de-footer-pour-vous-inspirer */
|
||||||
|
|
||||||
.footer-dark {
|
.footer-dark {
|
||||||
|
|||||||
@@ -7,16 +7,15 @@
|
|||||||
|
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<div class="pictures">
|
<table id="images_list" class="table table-striped table-bordered table-condensed">
|
||||||
{% for item in images_list %}
|
{% for entry in images_list %}
|
||||||
<div class="item">
|
<tr>
|
||||||
<div class="item_description"><span>{{ item[1] }}</span></div>
|
<td><a href="{{ entry[2] }}">{{ entry[0] }}</a></td>
|
||||||
<a href="{{ request.route_url('image_edit', filename=item[1]) }}">
|
<td class="text-right">{{ entry[1] }}</td>
|
||||||
<img src="{{ item[0] }}" alt="" />
|
<td class="text-center"><a href="{{request.route_url('image_edit', filename=entry[0])}}">[ Modifier ]</a></td>
|
||||||
</a>
|
</tr>
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</table>
|
||||||
|
|
||||||
<!-- Modal : Confirmation AJOUT -->
|
<!-- Modal : Confirmation AJOUT -->
|
||||||
<div id="confirmAdd" class="modal" role="dialog">
|
<div id="confirmAdd" class="modal" role="dialog">
|
||||||
@@ -50,18 +49,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="{{ request.static_url('cao_sunyata:static/js/jquery-tjgallery.min.js')}}"></script>
|
|
||||||
<script>
|
|
||||||
// waiting for loading page
|
|
||||||
$(window).on('load', function(){
|
|
||||||
$('.pictures').tjGallery({
|
|
||||||
selector: '.item',
|
|
||||||
margin: 10
|
|
||||||
});
|
|
||||||
$('.pictures').tjGallery({
|
|
||||||
row_min_height: 180
|
|
||||||
});
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -359,8 +359,7 @@ def tag_edit(request):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@view_config(route_name='images',
|
@view_config(route_name='images', renderer='cao_sunyata:templates/images.jinja2')
|
||||||
renderer='cao_sunyata:templates/images.jinja2')
|
|
||||||
def images(request):
|
def images(request):
|
||||||
|
|
||||||
message = ''
|
message = ''
|
||||||
@@ -369,10 +368,13 @@ def images(request):
|
|||||||
images_list = []
|
images_list = []
|
||||||
# lire tous les fichiers du dossier
|
# lire tous les fichiers du dossier
|
||||||
for f in os.scandir(folder_path):
|
for f in os.scandir(folder_path):
|
||||||
image = []
|
file = []
|
||||||
image.append(request.static_url('cao_sunyata:static/img/') + f.name)
|
file_url = request.static_url('cao_sunyata:static/img/') + f.name
|
||||||
image.append(f.name)
|
file_path = folder_path + f.name
|
||||||
images_list.append(image)
|
file.append(f.name)
|
||||||
|
file.append('%s Ko' % round(os.path.getsize(file_path) / 1024))
|
||||||
|
file.append(file_url)
|
||||||
|
images_list.append(file)
|
||||||
|
|
||||||
if 'form.submitted' in request.params:
|
if 'form.submitted' in request.params:
|
||||||
if request.POST['uploadfile'] != b'':
|
if request.POST['uploadfile'] != b'':
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pyramid.includes =
|
|||||||
|
|
||||||
sqlalchemy.url = sqlite:///%(here)s/cao_sunyata.sqlite
|
sqlalchemy.url = sqlite:///%(here)s/cao_sunyata.sqlite
|
||||||
# images location
|
# images location
|
||||||
images_dir = /pyramid10/cao_sunyata/cao_sunyata/static/img/
|
images_dir = /pyramid/cao_sunyata/cao_sunyata/static/img/
|
||||||
|
|
||||||
# reCaptcha keys
|
# reCaptcha keys
|
||||||
site_key = 6LeDvVUgAAAAAOqD_-h93kd5aW8CmpeVvKYu-m0p
|
site_key = 6LeDvVUgAAAAAOqD_-h93kd5aW8CmpeVvKYu-m0p
|
||||||
|
|||||||
Reference in New Issue
Block a user