diff options
author | tr4ck3ur <tr4ck3ur@style-python.fr> | 2015-02-15 14:46:19 +0100 |
---|---|---|
committer | tr4ck3ur <tr4ck3ur@style-python.fr> | 2015-02-15 14:46:19 +0100 |
commit | 7838a12792be197628ab7f34910f1c87dd113295 (patch) | |
tree | 0874b52059bf4ef3156f2e1495ce34743c0d8b36 | |
parent | e3d6c9839f41796a4870d8e9dea50ed2b657f014 (diff) | |
download | jm2l-7838a12792be197628ab7f34910f1c87dd113295.tar.gz jm2l-7838a12792be197628ab7f34910f1c87dd113295.tar.bz2 jm2l-7838a12792be197628ab7f34910f1c87dd113295.tar.xz jm2l-7838a12792be197628ab7f34910f1c87dd113295.zip |
Fix ckeditor, uploader and add piwik
-rw-r--r-- | development.ini | 3 | ||||
-rw-r--r-- | jm2l/static/css/jm2l.css | 4 | ||||
-rw-r--r-- | jm2l/static/vendor/fileupload/img/loading.gif | bin | 0 -> 3897 bytes | |||
-rw-r--r-- | jm2l/templates/Profil/Profil.mako | 21 | ||||
-rw-r--r-- | jm2l/templates/Staff/EditPresse.mako | 6 | ||||
-rw-r--r-- | jm2l/templates/Staff/pole.mako | 2 | ||||
-rw-r--r-- | jm2l/templates/Staff/tasks.mako | 2 | ||||
-rw-r--r-- | jm2l/templates/edit_event.mako | 2 | ||||
-rw-r--r-- | jm2l/templates/edit_tiers.mako | 8 | ||||
-rw-r--r-- | jm2l/templates/helpers.mako | 5 | ||||
-rw-r--r-- | jm2l/templates/jm2l.mako | 2 | ||||
-rw-r--r-- | jm2l/templates/layout.mako | 26 | ||||
-rw-r--r-- | jm2l/templates/modals.mako | 4 | ||||
-rw-r--r-- | jm2l/upload.py | 5 |
14 files changed, 53 insertions, 37 deletions
diff --git a/development.ini b/development.ini index e36ed74..2621409 100644 --- a/development.ini +++ b/development.ini @@ -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 diff --git a/jm2l/static/css/jm2l.css b/jm2l/static/css/jm2l.css index 5a3de2f..de94fbf 100644 --- a/jm2l/static/css/jm2l.css +++ b/jm2l/static/css/jm2l.css @@ -1,3 +1,7 @@ +a { + cursor: pointer; +} + .borderbox { border: 1px solid #e1e4e5; margin: 1px 0 24px; diff --git a/jm2l/static/vendor/fileupload/img/loading.gif b/jm2l/static/vendor/fileupload/img/loading.gif Binary files differnew file mode 100644 index 0000000..90f28cb --- /dev/null +++ b/jm2l/static/vendor/fileupload/img/loading.gif diff --git a/jm2l/templates/Profil/Profil.mako b/jm2l/templates/Profil/Profil.mako index 8bd87d7..4a20282 100644 --- a/jm2l/templates/Profil/Profil.mako +++ b/jm2l/templates/Profil/Profil.mako @@ -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> diff --git a/jm2l/templates/Staff/EditPresse.mako b/jm2l/templates/Staff/EditPresse.mako index 3b9b700..590f5b8 100644 --- a/jm2l/templates/Staff/EditPresse.mako +++ b/jm2l/templates/Staff/EditPresse.mako @@ -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()}
\ No newline at end of file +##${helpers.uploader_js()}
\ No newline at end of file diff --git a/jm2l/templates/Staff/pole.mako b/jm2l/templates/Staff/pole.mako index c8cfb1a..909c4d1 100644 --- a/jm2l/templates/Staff/pole.mako +++ b/jm2l/templates/Staff/pole.mako @@ -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>
\ No newline at end of file diff --git a/jm2l/templates/Staff/tasks.mako b/jm2l/templates/Staff/tasks.mako index d3d9ded..9ff75eb 100644 --- a/jm2l/templates/Staff/tasks.mako +++ b/jm2l/templates/Staff/tasks.mako @@ -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>
\ No newline at end of file diff --git a/jm2l/templates/edit_event.mako b/jm2l/templates/edit_event.mako index fee9f33..9639396 100644 --- a/jm2l/templates/edit_event.mako +++ b/jm2l/templates/edit_event.mako @@ -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
\ No newline at end of file diff --git a/jm2l/templates/edit_tiers.mako b/jm2l/templates/edit_tiers.mako index 5b7a49c..58d300a 100644 --- a/jm2l/templates/edit_tiers.mako +++ b/jm2l/templates/edit_tiers.mako @@ -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(); };
diff --git a/jm2l/templates/helpers.mako b/jm2l/templates/helpers.mako index aaa1274..5987a90 100644 --- a/jm2l/templates/helpers.mako +++ b/jm2l/templates/helpers.mako @@ -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 --> diff --git a/jm2l/templates/jm2l.mako b/jm2l/templates/jm2l.mako index 99a9bb7..fc2043b 100644 --- a/jm2l/templates/jm2l.mako +++ b/jm2l/templates/jm2l.mako @@ -150,4 +150,4 @@ </div> </div> </div> -${h.uploader_js()} +##${h.uploader_js()} diff --git a/jm2l/templates/layout.mako b/jm2l/templates/layout.mako index 4e1023b..8988c4c 100644 --- a/jm2l/templates/layout.mako +++ b/jm2l/templates/layout.mako @@ -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> diff --git a/jm2l/templates/modals.mako b/jm2l/templates/modals.mako index e41cc4c..6ee1556 100644 --- a/jm2l/templates/modals.mako +++ b/jm2l/templates/modals.mako @@ -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> diff --git a/jm2l/upload.py b/jm2l/upload.py index e063dc4..f0fe718 100644 --- a/jm2l/upload.py +++ b/jm2l/upload.py @@ -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: |