]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/_sidebar.rhtml
Ajaxify the export tab.
[rails.git] / app / views / site / _sidebar.rhtml
index 7addbe177a19fe40d100ce7f259480a187fe484f..d813635905971a9c86a69b8c2b69aed017bca886 100644 (file)
 
 <script type="text/javascript">
 <!--
-  function openSidebar() {
-    if (arguments.length) { $("sidebar").style.width = arguments[0]; }
+  var onclose;
+
+  function openSidebar(options) {
+    if (onclose) {
+       onclose();
+       onclose = null;
+    }
+
+    if (options.width) { $("sidebar").style.width = options.width; }
     else { $("sidebar").style.width = "30%"; }
 
     $("sidebar").style.display = "block";
 
     <%= onopen %>
+
+    onclose = options.onclose;
   }
 
   function closeSidebar() {
     $("sidebar").style.display = "none";
 
     <%= onclose %>
+
+    if (onclose) {
+       onclose();
+       onclose = null;
+    }
   }
 
   function updateSidebar(title, content) {