]> git.openstreetmap.org Git - rails.git/blob - app/views/site/_sidebar.rhtml
Improve the layout of the browse sidebar a bit.
[rails.git] / app / views / site / _sidebar.rhtml
1 <div id="sidebar">
2   <table class="sidebar_title" width="100%">
3     <tr>
4       <td align="left" id="sidebar_title">Search Results</td>
5       <td align="right"><a href="javascript:closeSidebar()">Close</a></td>
6     </tr>
7   </table>
8   <div id="sidebar_content">
9   </div>
10 </div>
11
12 <script type="text/javascript">
13 <!--
14   var onclose;
15
16   function openSidebar(options) {
17     options = options || {};
18
19     if (onclose) {
20        onclose();
21        onclose = null;
22     }
23
24     if (options.width) { $("sidebar").style.width = options.width; }
25     else { $("sidebar").style.width = "30%"; }
26
27     $("sidebar").style.display = "block";
28
29     <%= onopen %>
30
31     onclose = options.onclose;
32   }
33
34   function closeSidebar() {
35     $("sidebar").style.display = "none";
36
37     <%= onclose %>
38
39     if (onclose) {
40        onclose();
41        onclose = null;
42     }
43   }
44
45   function updateSidebar(title, content) {
46     $("sidebar_title").innerHTML = title;
47     $("sidebar_content").innerHTML = content;
48   }
49
50   function sidebarOpen(title) {
51     return $("sidebar").style.display == "block" &&
52            $("sidebar_title").innerHTML == title;
53   }
54 // -->
55 </script>