]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/_sidebar.rhtml
Set the OpenLayers locale when creating a map.
[rails.git] / app / views / site / _sidebar.rhtml
index 8cf1ce62c114f5828101147a3902a78999bcc21b..dd15ef7ba64b2e00ac17de7da3066d3a11c38f0f 100644 (file)
@@ -1,8 +1,8 @@
 <div id="sidebar">
   <table class="sidebar_title" width="100%">
     <tr>
-      <td align="left" id="sidebar_title">Search Results</td>
-      <td align="right"><a href="javascript:closeSidebar()">Close</a></td>
+      <td align="left" id="sidebar_title"><% t 'site.sidebar.search_results' %></td>
+      <td align="right"><a href="javascript:closeSidebar()"><%= t 'site.sidebar.close' %></a></td>
     </tr>
   </table>
   <div id="sidebar_content">
 
 <script type="text/javascript">
 <!--
-  function openSidebar() {
-       if (arguments.length) { $("sidebar").style.width = arguments[0]; }
-                        else { $("sidebar").style.width = "30%"; }
+  var onclose;
+
+  function openSidebar(options) {
+    options = 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) {
     $("sidebar_title").innerHTML = title;
     $("sidebar_content").innerHTML = content;
   }
+
+  function sidebarOpen(title) {
+    return $("sidebar").style.display == "block" &&
+           $("sidebar_title").innerHTML == title;
+  }
 // -->
 </script>