diff options
Diffstat (limited to 'jm2l/templates')
-rw-r--r-- | jm2l/templates/Profil/Profil.mako | 37 | ||||
-rw-r--r-- | jm2l/templates/helpers.mako | 41 | ||||
-rw-r--r-- | jm2l/templates/layout.mako | 37 | ||||
-rw-r--r-- | jm2l/templates/modals.mako | 34 | ||||
-rw-r--r-- | jm2l/templates/modals_js.mako | 11 |
5 files changed, 63 insertions, 97 deletions
diff --git a/jm2l/templates/Profil/Profil.mako b/jm2l/templates/Profil/Profil.mako index 4a20282..f8dc229 100644 --- a/jm2l/templates/Profil/Profil.mako +++ b/jm2l/templates/Profil/Profil.mako @@ -1,40 +1,9 @@ <%namespace name="Modals" file="jm2l:templates/modals.mako"/> <%namespace name="helpers" file="jm2l:templates/helpers.mako"/> <%def name="profil_wrapper(uprofil, profil_form)"> - <div class="profile-icon" style="float:right;height:250px;width:250px;"> - <% photos = uprofil.PhotosLinks %> - <div id="MyPictureCarousel" class="carousel slide"> - <div style="text-align: center;line-height:20px;"> - <a data-target="#AjaxModal" Myhref="/2015/modal/Password/1" role="button" handle="modal">Changer mon mot de passe</a> - </div> - % if len(photos)>1: - <!-- Carousel nav --> - <a class="Ucarousel-control left" href="#MyPictureCarousel" data-slide="prev">‹</a> - <a class="Ucarousel-control right" href="#MyPictureCarousel" data-slide="next">›</a> - % endif - <div style="text-align: center;line-height:20px;"> - <a data-target="#AjaxModal" Myhref="/2015/modal/UserPicture/${uprofil.uid}" handle="modal">Changer ma photo</a> - </div> - <!-- Carousel items --> - <div class="carousel-inner" style="height: 220px;"> - % if len(photos): - % for num, link in enumerate(photos): - <div class="${['','active '][num==0]}item" id="UserPic${num}"> - <div style="margin:auto;"> - <img src="${link}" class="img-polaroid" style="max-height:205px;max-width:235px;" alt="Photo ${uprofil.slug}" /> - </div> - </div> - % endfor - % else: - <div class="active item" id="UserPic0"> - <div style="margin:auto;width:170px;"> - <img src="/img/default-user.png" class="img-polaroid" alt="Photo ${uprofil.slug}" style="max-height:205px;" /> - </div> - </div> - % endif - </div> - </div> - </div> +<div id="Photos"> + ${helpers.show_my_pictures(uprofil)} +</div> <a href="/sign/jm2l/${uprofil.my_hash}">Mon lien</a> <h3>${profil_form.prenom.data} ${profil_form.nom.data}</h3> diff --git a/jm2l/templates/helpers.mako b/jm2l/templates/helpers.mako index 5987a90..b1409b8 100644 --- a/jm2l/templates/helpers.mako +++ b/jm2l/templates/helpers.mako @@ -159,7 +159,7 @@ TabJs = {'select':[], 'desc':[]} <div class="fileupload-progress fade" style="float:right;"> <!-- The global progress bar --> <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100"> - <div class="progress-bar progress-bar-success" style="width:0%;"></div> + <div class="bar progress-bar progress-bar-success" style="width:0%;"></div> </div> <!-- The extended global progress state --> <div class="progress-extended"> </div> @@ -184,7 +184,7 @@ TabJs = {'select':[], 'desc':[]} <p class="name">{%=file.name%}</p> <strong class="error text-danger"></strong> <p class="size">Processing...</p> - <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div> + <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar progress-bar progress-bar-success" style="width:0%;"></div></div> </td> <td style="width: 85px;"> {% if (!i && !o.options.autoUpload) { %} @@ -395,6 +395,43 @@ plop ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## Wrapper pour les photos ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +<%def name="show_my_pictures(uprofil)"> \ + <div class="profile-icon" style="float:right;height:250px;width:250px;"> + <% photos = uprofil.PhotosLinks %> + <div style="text-align: center;line-height:20px;"> + <a data-target="#AjaxModal" Myhref="/2015/modal/Password/1" role="button" handle="modal">Changer mon mot de passe</a> + </div> + <div style="text-align: center;line-height:20px;"> + <a data-target="#AjaxModal" Myhref="/2015/modal/UserPicture/${uprofil.uid}" handle="modal">Changer ma photo</a> + </div> + <div id="MyPictureCarousel" class="carousel slide"> + % if len(photos)>1: + <!-- Carousel nav --> + <a class="Ucarousel-control left" href="#MyPictureCarousel" data-slide="prev">‹</a> + <a class="Ucarousel-control right" href="#MyPictureCarousel" data-slide="next">›</a> + % endif + <!-- Carousel items --> + <div class="carousel-inner" style="height: 220px;"> + % if len(photos): + % for num, link in enumerate(photos): + <div class="${['','active '][num==0]}item" id="UserPic${num}"> + <div style="margin:auto;"> + <img src="${link}" class="img-polaroid" style="max-height:205px;max-width:235px;" alt="Photo ${uprofil.slug}" /> + </div> + </div> + % endfor + % else: + <div class="active item" id="UserPic0"> + <div style="margin:auto;width:170px;"> + <img src="/img/default-user.png" class="img-polaroid" alt="Photo ${uprofil.slug}" style="max-height:205px;" /> + </div> + </div> + % endif + </div> + </div> + </div> +</%def> \ +## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <%def name="show_pictures(uprofil)"> \ <div class="profile-icon pull-right"> <% photos = uprofil.PhotosLinks %> diff --git a/jm2l/templates/layout.mako b/jm2l/templates/layout.mako index 64b60a8..415b5a3 100644 --- a/jm2l/templates/layout.mako +++ b/jm2l/templates/layout.mako @@ -113,46 +113,15 @@ ${helpers.uploader_js()} <script src="/vendor/bootstrap.min.js"></script> <script src="/vendor/fileupload/js/jquery-uploader.min.js"></script> <script src="/vendor/ckeditor/ckeditor.js"></script> + <script src="/js/plugins.js"></script> ${self.jsAddOn()} ## Then Handle Javascript <script> % for jsitem in context._kwargs['postpone_js']: ${jsitem | n} % endfor -$.each( $('.fileupload'), - function( NumCtrl, Ctrl ) { - $("#"+Ctrl.id).fileupload({ - // Uncomment the following to send cross-domain cookies: - //xhrFields: {withCredentials: true}, - //url: '/uploader/proceed/' - url: this.action - }); - // Enable iframe cross-domain access via redirect option: - $("#"+Ctrl.id).fileupload( - 'option', - 'redirect', - window.location.href.replace( - /\/[^\/]*$/, - '/cors/result.html?%s' - ) - ); - $("#"+Ctrl.id).addClass('fileupload-processing'); - $.ajax({ - // Uncomment the following to send cross-domain cookies: - //xhrFields: {withCredentials: true}, - //url: this.action, - url: $("#"+Ctrl.id).fileupload('option', 'url'), - //url: "uploader/proceed/", - dataType: 'json', - context: $("#"+Ctrl.id)[0] - }).always(function () { - $(this).removeClass('fileupload-processing'); - }).done(function (result) { - $(this).fileupload('option', 'done') - .call(this, $.Event('done'), {result: result}); //$(this)}); - }); - } -); +## Call Control Handler +HandleControls(); </script> <!-- Piwik --> diff --git a/jm2l/templates/modals.mako b/jm2l/templates/modals.mako index 6ee1556..5848be6 100644 --- a/jm2l/templates/modals.mako +++ b/jm2l/templates/modals.mako @@ -150,11 +150,10 @@ Les images de taille supérieure à 300x300 pixels seront redimensionnés. </div> ${helpers.uploader("users", uid, "une Photo")} - ##${helpers.uploader_js()} </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">Annuler</button> - <button class="btn btn-primary">Enregistrer les modifications</button> + <button class="btn btn-primary" onclick="javascript:DoPost('/2015/modal/UserPicture/${uid}');">Enregistrer les modifications</button> </div> </div> </%def> \ @@ -166,33 +165,12 @@ <h3>Changer mon mot de passe</h3> </div> <div class="modal-body"> - + <form id="ModalForm" action="javascript:DoPost('/2015/modal/Password/${uid}');" style='margin:0;'> <div class="description">Pour modifier le mot de passe actuel, entrez un nouveau mot de passe dans chacune des deux zones de texte. </div> - <div class="password-strength" style="float:right;"> - <div class="password-strength-text" aria-live="assertive">Faible</div> - <div class="password-strength-title">Sécurité du mot de passe :</div> - <div class="password-indicator"> - <div style="width: 0%;" class="indicator"></div> - </div> - </div> - - <div class="form-item form-type-password-confirm form-item-pass"> - <label for="edit-pass-pass1">Mot de passe </label> - <input - id="edit-pass-pass1" name="pass" size="25" maxlength="128" type="password"> - </div> - - <div class="form-item form-type-password form-item-pass-pass2 confirm-parent"> - <div style="visibility: hidden;" class="password-confirm"> - Concordance des mots de passe : <span></span> - </div> - <label for="edit-pass-pass2">Confirmer le mot de passe </label> - <input class="password-confirm form-text" - id="edit-pass-pass2" name="pass2" size="25" maxlength="128" type="password"> - </div> + ${ helpers.DisplayForm(form, {}) } <div id="pswd_info" style="display: block;"> Pour renforcer la sécurité de votre mot de passe : @@ -204,6 +182,7 @@ <li id="ponctu" class="invalid">Ajoutez des caractères de ponctuation</li> </ul> </div> + </form> <script> $('input[type=password]').keyup(function() { // set password variable @@ -240,13 +219,13 @@ $('#ponctu').removeClass('invalid').addClass('valid'); } else { $('#ponctu').removeClass('valid').addClass('invalid'); - } + } }); </script> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">Annuler</button> - <button class="btn btn-primary">Changer</button> + <button class="btn btn-primary" onclick="javascript:document.forms['ModalForm'].submit();">Changer</button> </div> </div> </%def> \ @@ -284,4 +263,5 @@ context._kwargs['postpone_js']=[] % for jsitem in context._kwargs['postpone_js']: ${jsitem | n} % endfor +HandleControls(); </script> diff --git a/jm2l/templates/modals_js.mako b/jm2l/templates/modals_js.mako index 6afb826..9e1395d 100644 --- a/jm2l/templates/modals_js.mako +++ b/jm2l/templates/modals_js.mako @@ -63,4 +63,15 @@ $.ajax({ alert(error); }, }); +% elif modtype=='UserPicture': +$.ajax({ + url:'/user_picture', + success:function(result, status, jqXHR){ + var pictureresult = $('<div />').append(result).find('#MyPictureCarousel').html(); + $('#MyPictureCarousel').html(pictureresult); + }, + error:function(result, error){ + alert(error); + }, +}); % endif |