You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2014/09/12 12:29:18 UTC

[04/28] git commit: [#7585] ticket:639 added widget for enter password

[#7585] ticket:639 added widget for enter password


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/ce6c4aa3
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/ce6c4aa3
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/ce6c4aa3

Branch: refs/heads/je/42cc_4905
Commit: ce6c4aa3bb8ffa32bcfff9f04fc3126af2bc9db4
Parents: 2b781a4
Author: discort <le...@bk.ru>
Authored: Fri Aug 22 13:52:03 2014 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Aug 26 19:24:58 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py       |   3 +-
 Allura/allura/templates/user_prefs.html | 120 +++++++++++----------------
 2 files changed, 49 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/ce6c4aa3/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index f05a0cc..247a94b 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -44,7 +44,7 @@ from allura.lib.widgets import (
     LoginForm,
     ForgottenPasswordForm,
     DisableAccountForm)
-from allura.lib.widgets import forms
+from allura.lib.widgets import forms, form_fields as ffw
 from allura.lib import mail_util
 from allura.controllers import BaseController
 
@@ -392,6 +392,7 @@ class PreferencesController(BaseController):
     @with_trailing_slash
     @expose('jinja:allura:templates/user_prefs.html')
     def index(self, **kw):
+        c.enter_password = ffw.Lightbox(name='enter_password')
         c.password_change_form = F.password_change_form
         c.upload_key_form = F.upload_key_form
         provider = plugin.AuthenticationProvider.get(request)

http://git-wip-us.apache.org/repos/asf/allura/blob/ce6c4aa3/Allura/allura/templates/user_prefs.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_prefs.html b/Allura/allura/templates/user_prefs.html
index 9c477f6..b4dcc85 100644
--- a/Allura/allura/templates/user_prefs.html
+++ b/Allura/allura/templates/user_prefs.html
@@ -161,16 +161,18 @@
         </fieldset>
       {% endif %}
       
-      <form class="cur_password">
-        <h1>Enter password</h1>
-        <p>
-          {{lib.password_field('current_password', 'Current password:')}}
-        </p>
-        <p>  
+      <form class="cur_password" style="display:none">
+        <div class="grid-13"> 
+          <p>{{lib.password_field('current_password', 'Current password:')}}</p>
+        </div>
+        <div class="grid-13">
+          <p>  
           <input type="submit" name="enter_pass_submit" value="Ok">
           <input type="button" name="cancel_lightbox" value="Cancel">
-        </p>
+          </p>
+        </div>
       </form>
+      {{c.enter_password.display(content='<h1>Enter password</h1>')}}
     {% endblock %}
   </div>
 {% endblock %}
@@ -197,84 +199,56 @@
     padding: 0;
     border: 0;
   }
-  .cur_password {
-    display:none;
-    width: 500px;
-    float: left;
-    overflow: hidden;
-    margin: 0 10px;
-    padding: 15px;
-
-    left: 50%;
-    margin-left: -311px;
-    z-index: 1002;
-    position: fixed;
-    top: 40px;
-    margin-top: 0px;
-    background: #636363;
-    border-radius: 4px;
-    color: #ffffff;
-    box-shadow:
-        0 1px 2px rgba(0,0,0,0.2),        
-        0 1px 5px rgba(0,0,0,0.2),        
-        0 0 0 5px rgba(0,0,0,0.4); 
-  }
-  .cur_password h1 {
-    font-size: 18px;
-    line-height: 36px;
-    font-weight: bold;
-    color: #ffffff;
-    padding-bottom: 8px;
-    border-bottom: 1px solid #EBE6E2;
-  }
 </style>
 {% endblock %}
 
 {% block extra_js %}
   <script type="text/javascript">
       $(function() {
-          $("input[name='enter_pass_submit']").click(function (e) {
-            $("input[name='password']").val(
-                $("input[name='current_password']").val()
-              );
-            $("form[name='update-email']").submit();
-            e.preventDefault();
-          });
-
-          $("input[name='cancel_lightbox']").click(function(){
-            $('.cur_password').trigger('close');
-            return false;
-          });
 
-          function launch() {
-               $('.cur_password').lightbox_me({
-                centered: true, 
-                onLoad: function() { 
-                  $('.cur_password').find('input:first').focus();
-                }
-            });
-          }
+        function launch() {
+          var enter_password_popup = $('#lightbox_enter_password');
+          var enter_password_form = $('.cur_password');
 
-          $("input[name='new_addr.claim'], input[name='addr-save']").click(function(e) {
-            if ($("input[name='password']").val() == ''){
-              e.preventDefault();
-            }
-            if ($("input[name='new_addr.addr']").val().length != 0){
-              launch();
+          enter_password_popup.append(enter_password_form.show());
+          enter_password_popup.lightbox_me({
+            onLoad: function() { 
+            $('.cur_password').find('input:first').focus();
             }
           });
-
-          $('input:submit', ".addr-delete").click(function(e) {
-            if ($("input[name='password']").val() == ''){
-              e.preventDefault();
-            }
-            $('input:hidden', ".addr-delete").val("");
-            var attr_del = $(this).attr('name')
-            $(document.getElementById(attr_del)).val("1");
-            //$('#' + attr_del).val("1");
+        };
+
+        $("input[name='enter_pass_submit']").click(function (e) {
+          $("input[name='password']").val(
+              $("input[name='current_password']").val()
+            );
+          $("form[name='update-email']").submit();
+          e.preventDefault();
+        });
+
+        $("input[name='cancel_lightbox']").click(function(){
+          $('.cur_password').trigger('close');
+          return false;
+        });
+
+        $("input[name='new_addr.claim'], input[name='addr-save']").click(function(e) {
+          if ($("input[name='password']").val() == ''){
+            e.preventDefault();
+          }
+          if ($("input[name='new_addr.addr']").val().length != 0){
             launch();
-          });
+          }
+        });
 
+        $('input:submit', ".addr-delete").click(function(e) {
+          if ($("input[name='password']").val() == ''){
+            e.preventDefault();
+          }
+          $('input:hidden', ".addr-delete").val("");
+          var attr_del = $(this).attr('name')
+          $(document.getElementById(attr_del)).val("1");
+          launch();
+        });
       });
   </script>
  {% endblock %}
\ No newline at end of file