Explorar el Código

Fix ckeditor, uploader and add piwik

master
tr4ck3ur des JM2L hace 9 años
padre
commit
7838a12792
Se han modificado 14 ficheros con 53 adiciones y 37 borrados
  1. +1
    -2
      development.ini
  2. +4
    -0
      jm2l/static/css/jm2l.css
  3. BIN
      jm2l/static/vendor/fileupload/img/loading.gif
  4. +6
    -15
      jm2l/templates/Profil/Profil.mako
  5. +3
    -3
      jm2l/templates/Staff/EditPresse.mako
  6. +1
    -1
      jm2l/templates/Staff/pole.mako
  7. +1
    -1
      jm2l/templates/Staff/tasks.mako
  8. +1
    -1
      jm2l/templates/edit_event.mako
  9. +4
    -4
      jm2l/templates/edit_tiers.mako
  10. +3
    -2
      jm2l/templates/helpers.mako
  11. +1
    -1
      jm2l/templates/jm2l.mako
  12. +25
    -1
      jm2l/templates/layout.mako
  13. +2
    -2
      jm2l/templates/modals.mako
  14. +1
    -4
      jm2l/upload.py

+ 1
- 2
development.ini Ver fichero

@@ -6,8 +6,7 @@
[app:main]
use = egg:JM2L

pyramid.reload_templates = false
#true
pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false


+ 4
- 0
jm2l/static/css/jm2l.css Ver fichero

@@ -1,3 +1,7 @@
a {
cursor: pointer;
}

.borderbox {
border: 1px solid #e1e4e5;
margin: 1px 0 24px;


BIN
jm2l/static/vendor/fileupload/img/loading.gif Ver fichero

Antes Después
Anchura: 128  |  Altura: 128  |  Tamaño: 3.8 KiB

+ 6
- 15
jm2l/templates/Profil/Profil.mako Ver fichero

@@ -55,7 +55,7 @@ DicForm = {
'website': {'PlaceHolder':u"http://ma-page-web.moi","FieldStyle":"width:16em;"},
'gpg_key': {'PlaceHolder':u"Ma clé gpg", "FieldStyle":"width:90%;"},
'soc_link':{'PlaceHolder':u"#jm2l sur irc.freenode.org","FieldStyle":"width:90%;"},
'bio': {'PlaceHolder':u"Ma Bilibiographie", "FieldStyle":"width:95%;min-height:150px;", "fieldset":True },
'bio': {'PlaceHolder':u"Ma Bilibiographie", "FieldStyle":"width:95%;min-height:150px;", "fieldset":True, "ckeditor":1 },
'tiersship': {'Ignore':True}
}
%>
@@ -63,20 +63,21 @@ DicForm = {

<fieldset>
<legend>Activité</legend>
Si vous ne trouvez pas l'entité que vous souhaitez promouvoir (Association, GULL, Entreprise, Logiciel, ...).
Vous pouvez <a href="/entity"> en ajouter une. </a>

<div class="repeat">
<table class="wrapper table table-striped table-bordered" width="100%">
<thead>
<tr class="row">
##<th></th>
<th style="width:4em;text-align:center;">Année</th>
<th style="width:19em;">Entitée</th>
<th style="width:19em;">Entité</th>
<th>Rôle</th>
<th style="width:6em;">Action</th>
</tr>
</thead>
<tbody class="container">
<tr class="row template" style="line-height:2.2em;">
##<td><span class="move btn btn-mini btn-info">Move</span></td>
<td style="text-align:center;">
<input type="hidden" style="width:20em;" class="form-control" name="tiersship-{{row-count-placeholder}}-year_uid"
value="2015" /> 2015
@@ -99,7 +100,6 @@ DicForm = {
</tr>
% for num, dicdata in enumerate(profil_form._fields.get("tiersship").data):
<tr class="row" style="padding:5px;line-height:2.2em;">
##<td><span class="move btn btn-mini btn-info">Move</span></td>
<td style="text-align:center;">
<input type="hidden" class="form-control" name="tiersship-${num}-year_uid"
value="${dicdata.get('year_uid')}" style="width:4em;" />
@@ -141,17 +141,8 @@ DicForm = {
</div>
</fieldset>


<input type="submit" value="Enregistrer !" />
<input class="btn" type="submit" value="Enregistrer !" />
</form>



## Handle Popover of this form
##<script type="text/javascript">
## % for field in profil_form._fields.keys():
## $('#${field}-help').popover();
## %endfor
##</script>
</%def>

+ 3
- 3
jm2l/templates/Staff/EditPresse.mako Ver fichero

@@ -16,7 +16,7 @@
<%
DicForm = {
'year_uid': {'PlaceHolder':u"Mon Nom", "FieldStyle":"width:16em;", 'ContainerStyle':"float:left;"},
'doss_presse': {'PlaceHolder':u"Dossier de presse", "FieldStyle":"width:95%;min-height:600px;"},
'doss_presse': {'PlaceHolder':u"Dossier de presse", "FieldStyle":"width:95%;min-height:600px;", "ckeditor":"1"},
}
%>
<div>
@@ -29,6 +29,6 @@ DicForm = {

<br><br>
<script>
var editor = CKEDITOR.replace( 'doss_presse', { autoGrow_onStartup: true, language: 'fr' } );
## var editor = CKEDITOR.replace( 'doss_presse', { autoGrow_onStartup: true, language: 'fr' } );
</script>
${helpers.uploader_js()}
##${helpers.uploader_js()}

+ 1
- 1
jm2l/templates/Staff/pole.mako Ver fichero

@@ -40,5 +40,5 @@ DicForm = {
${helpers.uploader("poles", form.uid.data, u"Attachement" )}
%endif
<script>
var editor = CKEDITOR.replace( 'description', { autoGrow_onStartup: true, language: 'fr' } );
## var editor = CKEDITOR.replace( 'description', { autoGrow_onStartup: true, language: 'fr' } );
</script>

+ 1
- 1
jm2l/templates/Staff/tasks.mako Ver fichero

@@ -44,5 +44,5 @@ DicForm = {
${helpers.uploader("tasks", form.uid.data, u"Attachement" )}
%endif
<script>
var editor = CKEDITOR.replace( 'description', { autoGrow_onStartup: true, language: 'fr' } );
## var editor = CKEDITOR.replace( 'description', { autoGrow_onStartup: true, language: 'fr' } );
</script>

+ 1
- 1
jm2l/templates/edit_event.mako Ver fichero

@@ -216,5 +216,5 @@ if formAdd:
for jsitem in formAdd._fields.keys():
context._kwargs['postpone_js'].append( "$('#%s-help').popover();" % jsitem )
%>
${helpers.uploader_js()}
##${helpers.uploader_js()}
% endif

+ 4
- 4
jm2l/templates/edit_tiers.mako Ver fichero

@@ -144,9 +144,9 @@ DicForm = {
<br>
<br>
% if 'uid' in form._fields:
${helpers.uploader_js()}
% endif
##% if 'uid' in form._fields:
## ${helpers.uploader_js()}
##% endif
<%def name="jsAddOn()">
<script src="/vendor/select2/js/select2.js"></script>
@@ -154,7 +154,7 @@ DicForm = {
<script src="/vendor/ckeditor/ckeditor.js"></script>
<script type="text/javascript">
var year_data = Array();
var editor = CKEDITOR.replace('description', { autoGrow_onStartup: true, language: 'fr' } );
##var editor = CKEDITOR.replace('description', { autoGrow_onStartup: true, language: 'fr' } );
for (var i=2005;i<2015;i++)
{ year_data[i.toString()] = i.toString(); };


+ 3
- 2
jm2l/templates/helpers.mako Ver fichero

@@ -245,8 +245,9 @@ TabJs = {'select':[], 'desc':[]}
{% } %}
</script>
%if 1:
<script src="/vendor/fileupload/js/jquery-uploader.min.js"></script>
<script src="/js/main.js"></script>
##<script src="/vendor/fileupload/js/jquery-uploader.min.js"></script>
##<script src="/js/main.js"></script>
plop
% else:
<script src="/static/jquery.min.js"></script>
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->


+ 1
- 1
jm2l/templates/jm2l.mako Ver fichero

@@ -150,4 +150,4 @@
</div>
</div>
</div>
${h.uploader_js()}
##${h.uploader_js()}

+ 25
- 1
jm2l/templates/layout.mako Ver fichero

@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html>
<%namespace name="helpers" file="jm2l:templates/helpers.mako"/>
<head>
<title>JM2L 2015</title>
<meta charset="utf-8">
@@ -20,6 +21,8 @@
<link rel="stylesheet" href="/static/ie6.css" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
<script src="/vendor/modernizr-2.8.3-respond-1.4.2.min.js"></script>
##<script id="template-download" type="text/x-tmpl" src="/vendor/fileupload/template/template-download.js"></script>
##<script id="template-upload" type="text/x-tmpl" src="/vendor/fileupload/template/template-upload.js"></script>
</head>
<body>
<%
@@ -28,6 +31,8 @@ DisplayYear = request.session.get('year', 2015)
%>
<%def name="jsAddOn()"></%def>
<%def name="cssAddOn()"></%def>
${helpers.uploader_js()}

<div id="wrap">
<div id="top" style="background: url( ${"/img/%s/headerbg.png" % DisplayYear} ) repeat-x scroll 0 top #ffffff;">
<div class="align-center">
@@ -68,7 +73,7 @@ DisplayYear = request.session.get('year', 2015)
<li><a href="/sign/out">Me déconnecter</a></li>
% else:
<li><a href="/participer-l-evenement#inscription">Je m'inscris</a></li>
<li><a href="/sign/login">Je m'identifier</a></li>
<li><a href="/sign/login">Je m'identifie</a></li>
% endif
</ul>
</div>
@@ -109,6 +114,7 @@ DisplayYear = request.session.get('year', 2015)
<script src="/vendor/jquery.min.js"></script>
<script src="/vendor/bootstrap.min.js"></script>
<script src="/vendor/fileupload/js/jquery-uploader.min.js"></script>
<script src="/vendor/ckeditor/ckeditor.js"></script>
${self.jsAddOn()}
## Then Handle Javascript
<script>
@@ -150,5 +156,23 @@ $.each( $('.fileupload'),
}
);
</script>

<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//stats.style-python.fr/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 4]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//stats.style-python.fr/piwik.php?idsite=4" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

</body>
</html>

+ 2
- 2
jm2l/templates/modals.mako Ver fichero

@@ -125,7 +125,7 @@
</div>

</div>
${helpers.uploader_js()}
##${helpers.uploader_js()}
<script>
$("#place_type").select2({});
</script>
@@ -150,7 +150,7 @@
Les images de taille supérieure à 300x300 pixels seront redimensionnés.
</div>
${helpers.uploader("users", uid, "une Photo")}
${helpers.uploader_js()}
##${helpers.uploader_js()}
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Annuler</button>


+ 1
- 4
jm2l/upload.py Ver fichero

@@ -97,7 +97,7 @@ class MediaPath():
p = IMAGEPATH + [ media_table ] + [ linked_id ]
elif media_table=='tasks':
# Use Current Year
p = IMAGEPATH + [ 2015, media_table ] + [ linked_id ]
p = IMAGEPATH + [ str(2015), media_table ] + [ linked_id ]
elif media_table in ['RIB', 'Justif']:
slug = User.by_id(linked_id).slug
p = IMAGEPATH + ['users'] + [ slug ] + [ self.media_table ]
@@ -143,7 +143,6 @@ class MediaUpload(MediaPath):
if RealMime!=result['type']:
result['error'] = 'l\'extension du fichier ne correspond pas à son contenu - '
result['error'] += "( %s vs %s )" % (RealMime, result['type'])
print "%s != %s" % (RealMime, result['type'])
return False
# Accept images and mime types listed
if not RealMime in ACCEPTED_MIMES:
@@ -343,7 +342,6 @@ class MediaUpload(MediaPath):
result['name'] = os.path.basename(fieldStorage.filename)
result['type'] = fieldStorage.type
result['size'] = self.get_file_size(fieldStorage.file)
print result
if self.validate(result, fieldStorage.file):
with open( self.mediapath(result['name'] + '.type'), 'w') as f:
f.write(result['type'])
@@ -391,7 +389,6 @@ class MediaView(MediaPath):
test = f.read()
self.request.response.content_type = test
except IOError:
print os.path.basename(name)+".type file not found"
pass
#try:
if 1:


Cargando…
Cancelar
Guardar