Add functions to lock and unlock a Sone.
[Sone.git] / src / main / resources / templates / include / head.html
index 7b6cc28..0f46054 100644 (file)
        </script>
 
        <script language="javascript">
-               /* convert all “follow”, “unfollow”, “block”, and “unblock” links to something nicer. */
+               /* convert all “follow”, “unfollow”, “lock”, and “unlock” links to something nicer. */
                $(document).ready(function() {
                        $("#sone .follow").submit(function() {
                                var followElement = this;
                                });
                                return false;
                        });
+                       $("#sone .lock").submit(function() {
+                               var lockElement = this;
+                               $.getJSON("ajax/lockSone.ajax", { "sone" : getSoneId(this), "formPassword" : getFormPassword() }, function() {
+                                       $(lockElement).addClass("hidden");
+                                       $(lockElement).parent().find(".unlock").removeClass("hidden");
+                               });
+                               return false;
+                       });
+                       $("#sone .unlock").submit(function() {
+                               var unlockElement = this;
+                               $.getJSON("ajax/unlockSone.ajax", { "sone" : getSoneId(this), "formPassword" : getFormPassword() }, function() {
+                                       $(unlockElement).addClass("hidden");
+                                       $(unlockElement).parent().find(".lock").removeClass("hidden");
+                               });
+                               return false;
+                       });
                });
        </script>