Fix display justif issue

This commit is contained in:
2015-12-05 14:01:03 +01:00
parent 27cf4dd24f
commit 1cd333acc0
3 changed files with 25 additions and 20 deletions
+5 -9
View File
@@ -3,9 +3,6 @@
<%namespace name="helpers" file="jm2l:templates/helpers.mako"/>
<%namespace name="h" file="jm2l:templates/helpers.mako"/>
<%def name="jsAddOn()">
<script src="/js/jm2l.js"></script>
<script src="/vendor/ckeditor/ckeditor.js"></script>
<script src="/vendor/select2/js/select2.js"></script>
</%def>
<%def name="cssAddOn()">
<link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload.css">
@@ -58,19 +55,18 @@
</td>
% if one_dic.has_key("Justif"):
<td style="text-align:center;">
${h.uploader("Justif", one_dic["User"]["uid"], "Justif")}
${h.uploader("Justif", one_dic["User"]["uid"], "Justif_"+one_dic["User"]["slug"], True)}
</td>
% else:
<td><i>Rien</i></td>
<td style="text-align:center;"><i>Rien</i></td>
% endif
</tr>
<tr>
% if one_dic.has_key("RIB"):
<td style="text-align:center;">
${h.uploader("RIB", one_dic["User"]["uid"], "RIB")}
${h.uploader("RIB", one_dic["User"]["uid"], "RIB_"+one_dic["User"]["slug"], True)}
</td>
% else:
<td><i>Rien</i></td>
<td style="text-align:center;"><i>Rien</i></td>
% endif
</tr>
% endfor
+7 -3
View File
@@ -217,13 +217,17 @@ TabJs = {'select':[], 'desc':[]}
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## Wrapper pour uploader
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
<%def name="uploader(MediaType, UID, desc=None)"> \
<%def name="uploader(MediaType, UID, desc=None, disp_only=False)"> \
<!-- The file upload form used as target for the file upload widget -->
<form class="fileupload" id="fileupload_${MediaType}" action="/uploader/${MediaType}/${UID}/proceed" method="POST" enctype="multipart/form-data">
% if disp_only:
<form class="fileupload" id="fileupload_${MediaType}_${UID}" action="/uploader/_${MediaType}/${UID}/proceed" method="POST" enctype="multipart/form-data">
% else:
<form class="fileupload" id="fileupload_${MediaType}_${UID}" action="/uploader/${MediaType}/${UID}/proceed" method="POST" enctype="multipart/form-data">
% endif
<!-- Redirect browsers with JavaScript disabled to the origin page -->
<noscript><input type="hidden" name="redirect" value="/"></noscript>
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
<div class="fileupload-buttonbar">
<div class="fileupload-buttonbar" ${["","style=display:none"][disp_only]}>
<!-- The fileinput-button span is used to style the file input field as button -->
<span class="btn btn-success fileinput-button">
<i class="icon-plus icon-white"></i>
+5
View File
@@ -186,6 +186,10 @@ class MediaUpload(MediaPath):
def __init__(self, request):
self.request = request
self.media_table = self.request.matchdict.get('media_table')
self.display_only = False
if self.media_table.startswith('_'):
self.display_only = True
self.media_table = self.media_table[1:]
self.linked_id = self.request.matchdict.get('uid')
if not self.linked_id.isdigit():
raise HTTPBadRequest('Wrong Parameter')
@@ -398,6 +402,7 @@ class MediaUpload(MediaPath):
info['thumbnailUrl'] = self.ExtMimeIcon(mime)
else:
info['thumbnailUrl'] = self.ExtMimeIcon(mime)
if not self.display_only:
info['deleteType'] = DELETEMETHOD
info['deleteUrl'] = self.request.route_url('media_upload',
sep='',