allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [38/42] git commit: [#7585] ticket:639 added lightbox popup for buttons clame, save & delete
Date Mon, 25 Aug 2014 11:33:58 GMT
[#7585] ticket:639 added lightbox popup for buttons clame, save & delete


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

Branch: refs/heads/je/42cc_7585
Commit: 52fd9034cdfb8044e1e035242909bf1ab9b2142c
Parents: f49cdb6
Author: discort <lexad-al@bk.ru>
Authored: Thu Aug 21 10:34:41 2014 +0300
Committer: discort <lexad-al@bk.ru>
Committed: Fri Aug 22 13:54:41 2014 +0300

----------------------------------------------------------------------
 Allura/allura/templates/jinja_master/lib.html |  7 ++
 Allura/allura/templates/user_prefs.html       | 95 ++++++++++++++++++++--
 2 files changed, 97 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/52fd9034/Allura/allura/templates/jinja_master/lib.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/lib.html b/Allura/allura/templates/jinja_master/lib.html
index 229c351..b3a5bf4 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -130,6 +130,13 @@
   <input type="text" id="{{name}}" name="{{name}}" class="text" value="{{value}}"/><br/>
 {% endmacro %}
 
+{% macro hidden_field(name, label, value='') %}
+  {% if label %}
+  <label for="{{name}}">{{label}}</label><br/>
+  {% endif %}
+  <input type="hidden" id="{{name}}" name="{{name}}" class="text" value="{{value}}"/><br/>
+{% endmacro %}
+
 {% macro radio_button(name, label, option, value=None) %}
   {% if label %}
     <label for="{{name}}">{{label}}</label><br/>

http://git-wip-us.apache.org/repos/asf/allura/blob/52fd9034/Allura/allura/templates/user_prefs.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_prefs.html b/Allura/allura/templates/user_prefs.html
index f76e9d6..b3cfb6e 100644
--- a/Allura/allura/templates/user_prefs.html
+++ b/Allura/allura/templates/user_prefs.html
@@ -40,7 +40,7 @@
 
     {% block edit_prefs_form %}
       {% if h.asbool(tg.config.get('auth.allow_edit_prefs', True)) %}
-      <form action="update" method="post">
+      <form action="update" method="post" name="update-email">
         <fieldset>
           <legend>General and Email Settings</legend>
           <label class="grid-4">Display Name</label>
@@ -98,7 +98,12 @@
               {% else %}
                 <td>Unknown addr obj {{a}}</td>
               {% endif %}
-              <td>{{lib.submit_button('Delete', 'addr-%s.delete' % loop.index0)}}</td>
+              <td>
+                <div class="addr-delete">
+                  {{lib.submit_button('Delete', 'addr-%s.delete' % loop.index0)}}
+                  {{lib.hidden_field('addr-%s.delete' % loop.index0, '')}}
+                </div>
+              </td>
             </tr>
             {% endfor %}
             <tr>
@@ -108,11 +113,10 @@
           </table>
           <div class="grid-22">
             <p></p>
-            <label for="password">Current password:</label>
-            <input type="password" name="password">
+            <input type="hidden" name="password">
           </div>
           <div class="grid-22">
-            {{lib.submit_button('Save')}}
+            {{lib.submit_button('Save', name='addr-save')}}
           </div>
           {{lib.csrf_token()}}
         </fieldset>
@@ -155,6 +159,18 @@
           </form>
         </fieldset>
       {% endif %}
+      {% do g.register_js('js/jquery.lightbox_me.js') %}
+      <form class="cur_password">
+        <h1><span class="log-in">Enter password</span></h1>
+        <p class="float">
+            <label for="password"><i class="icon-lock"></i>Current password:</label>
+            <input type="password" name="current_password" placeholder="Password">
+        </p>
+        <p class="clearfix">  
+            <input type="submit" name="enter_pass_submit" value="Ok">
+            <input type="button" name="cancel_lightbox" value="Cancel">
+        </p>
+      </form>
     {% endblock %}
   </div>
 {% endblock %}
@@ -181,5 +197,74 @@
     padding: 0;
     border: 0;
   }
+  .cur_password {
+    width: 250px;
+    margin: 60px auto 30px;
+    padding: 15px;
+    position: relative;
+    display:none;
+    background: #fffaf6;
+    border-radius: 4px;
+    color: #7e7975;
+    box-shadow:
+        0 2px 2px rgba(0,0,0,0.2),        
+        0 1px 5px rgba(0,0,0,0.2),        
+        0 0 0 12px rgba(255,255,255,0.4);
+  }
+  .cur_password h1 {
+    font-size: 15px;
+    font-weight: bold;
+    color: #bdb5aa;
+    padding-bottom: 8px;
+    border-bottom: 1px solid #EBE6E2;
+    text-shadow: 0 2px 0 rgba(255,255,255,0.8);
+    box-shadow: 0 1px 0 rgba(255,255,255,0.8);
+  }
 </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();
+                      }
+                  });
+                }
+
+                $("input[name='new_addr.claim'], input[name='addr-save']").click(function(e)
{
+                  if ($("input[name='password']").val() == ''){
+                    e.preventDefault();
+                  }
+                  launch();
+                });
+
+                $('input:submit', ".addr-delete").click(function(e) {
+                  if ($("input[name='password']").val() == ''){
+                    e.preventDefault();
+                  }
+                  var attr_del = $(this).attr('name')
+                  $(document.getElementById(attr_del)).val("1");
+                  launch();
+                });
+
+            });
+   </script>
+ {% endblock %}
\ No newline at end of file


Mime
View raw message