Sidebar close reverts to 'view' state

This commit is contained in:
Aaron Lidman 2013-11-06 16:59:14 -08:00
parent 774aa0c875
commit e7d200c4a6
17 changed files with 19 additions and 25 deletions

View file

@ -231,7 +231,7 @@ $(document).ready(function () {
initializeNotes(map);
OSM.Index = function(map) {
var page = {}, minimized = false;
var page = {}, minimized = $('#sidebar').hasClass('minimized');
page.pushstate = page.popstate = function(path) {
if (minimized) $("#sidebar").addClass("minimized");
@ -244,14 +244,6 @@ $(document).ready(function () {
$("#view_tab").removeClass("current");
};
page.minimizeSidebar = function() {
$("#sidebar").addClass("minimized");
map.invalidateSize();
minimized = true;
};
$(document).on("click", "#sidebar_content .close", page.minimizeSidebar);
return page;
};

View file

@ -52,16 +52,18 @@ OSM.Export = function(map) {
$("#export_tab").addClass("current");
$("#sidebar").removeClass("minimized");
map.invalidateSize();
$('#sidebar_content').load(path, page.load);
$("#sidebar_content").load(path, page.load);
};
page.load = function() {
$("#sidebar").removeClass("minimized");
map
.addLayer(locationFilter)
.on("moveend", update);
$("#maxlat, #minlon, #maxlon, #minlat").change(boundsChanged);
$("#drag_box").click(enableFilter);
$("#sidebar_content .close").on("click", page.minimizeSidebar);
update();
};

View file

@ -99,12 +99,12 @@ OSM.History = function(map) {
page.pushstate = page.popstate = function(path) {
$("#history_tab").addClass("current");
$("#sidebar").removeClass("minimized");
map.invalidateSize();
$("#sidebar_content").load(path, page.load);
};
page.load = function() {
$("#sidebar").removeClass("minimized");
map
.on("moveend", loadData)
.addLayer(group);

View file

@ -49,12 +49,12 @@ OSM.Search = function(map) {
page.pushstate = page.popstate = function(path) {
var params = querystring.parse(path.substring(path.indexOf('?') + 1));
$("#query").val(params.query);
$("#sidebar").removeClass("minimized");
map.invalidateSize();
$("#sidebar_content").load(path, page.load);
};
page.load = function() {
$("#sidebar").removeClass("minimized");
$(".search_results_entry").each(function() {
var entry = $(this);
$.ajax({

View file

@ -1,5 +1,5 @@
<h2><%= t 'browse.changeset.changeset', :id => @changeset.id %>
<span class="icon close"></span>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
</h2>
<div class="browse-section">
<p>

View file

@ -4,7 +4,7 @@
%>
<h2><%= t'browse.node.node_title', :node_name => @name %>
<span class="icon close"></span>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
</h2>
<%= render :partial => "node_details", :object => @node %>

View file

@ -4,7 +4,7 @@
%>
<h2><%= raw t'browse.node_history.node_history_title', :node_name => link_to(h(@name), :action => "node", :id => @node.id) %>
<span class="icon close"></span>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
</h2>
<% @node.old_nodes.reverse.each do |node| %>

View file

@ -1,5 +1,5 @@
<h2><%= t "browse.note.#{@note.status}_title", :note_name => @note.id %>
<span class="icon close"></span>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
</h2>
<div class="browse-section">
<span>

View file

@ -4,7 +4,7 @@
%>
<h2><%= t'browse.relation.relation_title', :relation_name => @name %>
<span class="icon close"></span>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
</h2>
<%= render :partial => "relation_details", :object => @relation %>

View file

@ -4,7 +4,7 @@
%>
<h2><%= raw t'browse.relation_history.relation_history_title', :relation_name => link_to(h(@name), :action => "relation", :id => @relation.id) %>
<span class="icon close"></span>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
</h2>
<% @relation.old_relations.reverse.each do |relation| %>

View file

@ -3,7 +3,7 @@
@title = t('browse.way.way') + ' | ' + @name
%>
<h2><%= t'browse.way.way_title', :way_name => @name %>
<span class="icon close"></span>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
</h2>
<%= render :partial => "way_details", :object => @way %>

View file

@ -4,7 +4,7 @@
%>
<h2><%= raw t'browse.way_history.way_history_title', :way_name => link_to(h(@name), :action => "way", :id => @way.id) %>
<span class="icon close"></span>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
</h2>
<% @way.old_ways.reverse.each do |way| %>

View file

@ -21,7 +21,7 @@
%>
<h2><%= @heading %>
<span class="icon close"></span>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
</h2>
<div class="changesets">

View file

@ -1,6 +1,6 @@
<h2>
<%= t('site.sidebar.search_results') %>
<span class="icon close"></span>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
</h2>
<% @sources.each do |source| %>
<h4 class="inner12"><%= raw(t "geocoder.search.title.#{source}") %></h4>

View file

@ -17,7 +17,7 @@
<% end %>
<% content_for :content do %>
<div id="sidebar">
<div id="sidebar" class="<%= 'minimized' if @user %>">
<%= form_tag search_path, :id => "search_form" do %>
<%= submit_tag t('site.search.submit_text') %>
<div id='query_wrapper'>

View file

@ -1,5 +1,5 @@
<h2><%= t 'export.start_rjs.export' %>
<span class="icon close"></span>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
</h2>
<%= form_tag :controller => "export", :action => "finish" do %>

View file

@ -2,7 +2,7 @@
<% if !@user %>
<%= t 'layouts.intro_header' %>
<% else %>
<span class="icon close"></span>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<% end %>
</h2>