Browse Source

Fix display justif issue

master
tr4ck3ur des JM2L 9 years ago
parent
commit
1cd333acc0
3 changed files with 25 additions and 20 deletions
  1. +5
    -9
      jm2l/templates/Staff/compta.mako
  2. +7
    -3
      jm2l/templates/helpers.mako
  3. +13
    -8
      jm2l/upload.py

+ 5
- 9
jm2l/templates/Staff/compta.mako View File

@@ -3,9 +3,6 @@
<%namespace name="helpers" file="jm2l:templates/helpers.mako"/> <%namespace name="helpers" file="jm2l:templates/helpers.mako"/>
<%namespace name="h" file="jm2l:templates/helpers.mako"/> <%namespace name="h" file="jm2l:templates/helpers.mako"/>
<%def name="jsAddOn()"> <%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>
<%def name="cssAddOn()"> <%def name="cssAddOn()">
<link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload.css"> <link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload.css">
@@ -58,19 +55,18 @@
</td> </td>
% if one_dic.has_key("Justif"): % if one_dic.has_key("Justif"):
<td style="text-align:center;"> <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> </td>
% else: % else:
<td><i>Rien</i></td>
<td style="text-align:center;"><i>Rien</i></td>
% endif % endif
</tr>
<tr>

% if one_dic.has_key("RIB"): % if one_dic.has_key("RIB"):
<td style="text-align:center;"> <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> </td>
% else: % else:
<td><i>Rien</i></td>
<td style="text-align:center;"><i>Rien</i></td>
% endif % endif
</tr> </tr>
% endfor % endfor


+ 7
- 3
jm2l/templates/helpers.mako View File

@@ -217,13 +217,17 @@ TabJs = {'select':[], 'desc':[]}
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## Wrapper pour uploader ## 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 --> <!-- 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 --> <!-- Redirect browsers with JavaScript disabled to the origin page -->
<noscript><input type="hidden" name="redirect" value="/"></noscript> <noscript><input type="hidden" name="redirect" value="/"></noscript>
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --> <!-- 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 --> <!-- The fileinput-button span is used to style the file input field as button -->
<span class="btn btn-success fileinput-button"> <span class="btn btn-success fileinput-button">
<i class="icon-plus icon-white"></i> <i class="icon-plus icon-white"></i>


+ 13
- 8
jm2l/upload.py View File

@@ -186,6 +186,10 @@ class MediaUpload(MediaPath):
def __init__(self, request): def __init__(self, request):
self.request = request self.request = request
self.media_table = self.request.matchdict.get('media_table') 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') self.linked_id = self.request.matchdict.get('uid')
if not self.linked_id.isdigit(): if not self.linked_id.isdigit():
raise HTTPBadRequest('Wrong Parameter') raise HTTPBadRequest('Wrong Parameter')
@@ -398,14 +402,15 @@ class MediaUpload(MediaPath):
info['thumbnailUrl'] = self.ExtMimeIcon(mime) info['thumbnailUrl'] = self.ExtMimeIcon(mime)
else: else:
info['thumbnailUrl'] = self.ExtMimeIcon(mime) info['thumbnailUrl'] = self.ExtMimeIcon(mime)
info['deleteType'] = DELETEMETHOD
info['deleteUrl'] = self.request.route_url('media_upload',
sep='',
name='',
media_table=self.media_table,
uid=self.linked_id) + '/' + name
if DELETEMETHOD != 'DELETE':
info['deleteUrl'] += '&_method=DELETE'
if not self.display_only:
info['deleteType'] = DELETEMETHOD
info['deleteUrl'] = self.request.route_url('media_upload',
sep='',
name='',
media_table=self.media_table,
uid=self.linked_id) + '/' + name
if DELETEMETHOD != 'DELETE':
info['deleteUrl'] += '&_method=DELETE'
return info return info
else: else:
return None return None


Loading…
Cancel
Save