display images_list in table
This commit is contained in:
@@ -26,9 +26,13 @@ class BlogRecordService(object):
|
||||
search = "%{}%".format(criteria)
|
||||
query = request.dbsession.query(BlogRecord).filter(or_(BlogRecord.title.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 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()
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -170,50 +170,6 @@ blockquote {
|
||||
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 */
|
||||
|
||||
.footer-dark {
|
||||
|
||||
@@ -7,16 +7,15 @@
|
||||
|
||||
</p>
|
||||
<br />
|
||||
<div class="pictures">
|
||||
{% for item in images_list %}
|
||||
<div class="item">
|
||||
<div class="item_description"><span>{{ item[1] }}</span></div>
|
||||
<a href="{{ request.route_url('image_edit', filename=item[1]) }}">
|
||||
<img src="{{ item[0] }}" alt="" />
|
||||
</a>
|
||||
</div>
|
||||
<table id="images_list" class="table table-striped table-bordered table-condensed">
|
||||
{% for entry in images_list %}
|
||||
<tr>
|
||||
<td><a href="{{ entry[2] }}">{{ entry[0] }}</a></td>
|
||||
<td class="text-right">{{ entry[1] }}</td>
|
||||
<td class="text-center"><a href="{{request.route_url('image_edit', filename=entry[0])}}">[ Modifier ]</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<!-- Modal : Confirmation AJOUT -->
|
||||
<div id="confirmAdd" class="modal" role="dialog">
|
||||
@@ -50,18 +49,4 @@
|
||||
</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 %}
|
||||
@@ -359,8 +359,7 @@ def tag_edit(request):
|
||||
}
|
||||
|
||||
|
||||
@view_config(route_name='images',
|
||||
renderer='cao_sunyata:templates/images.jinja2')
|
||||
@view_config(route_name='images', renderer='cao_sunyata:templates/images.jinja2')
|
||||
def images(request):
|
||||
|
||||
message = ''
|
||||
@@ -369,10 +368,13 @@ def images(request):
|
||||
images_list = []
|
||||
# lire tous les fichiers du dossier
|
||||
for f in os.scandir(folder_path):
|
||||
image = []
|
||||
image.append(request.static_url('cao_sunyata:static/img/') + f.name)
|
||||
image.append(f.name)
|
||||
images_list.append(image)
|
||||
file = []
|
||||
file_url = request.static_url('cao_sunyata:static/img/') + f.name
|
||||
file_path = folder_path + f.name
|
||||
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 request.POST['uploadfile'] != b'':
|
||||
|
||||
@@ -16,7 +16,7 @@ pyramid.includes =
|
||||
|
||||
sqlalchemy.url = sqlite:///%(here)s/cao_sunyata.sqlite
|
||||
# images location
|
||||
images_dir = /pyramid10/cao_sunyata/cao_sunyata/static/img/
|
||||
images_dir = /pyramid/cao_sunyata/cao_sunyata/static/img/
|
||||
|
||||
# reCaptcha keys
|
||||
site_key = 6LeDvVUgAAAAAOqD_-h93kd5aW8CmpeVvKYu-m0p
|
||||
|
||||
Reference in New Issue
Block a user