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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
<h2><%= t 'browse.changeset.changeset', :id => @changeset.id %> <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> </h2>
<div class="browse-section"> <div class="browse-section">
<p> <p>

View file

@ -4,7 +4,7 @@
%> %>
<h2><%= t'browse.node.node_title', :node_name => @name %> <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> </h2>
<%= render :partial => "node_details", :object => @node %> <%= 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) %> <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> </h2>
<% @node.old_nodes.reverse.each do |node| %> <% @node.old_nodes.reverse.each do |node| %>

View file

@ -1,5 +1,5 @@
<h2><%= t "browse.note.#{@note.status}_title", :note_name => @note.id %> <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> </h2>
<div class="browse-section"> <div class="browse-section">
<span> <span>

View file

@ -4,7 +4,7 @@
%> %>
<h2><%= t'browse.relation.relation_title', :relation_name => @name %> <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> </h2>
<%= render :partial => "relation_details", :object => @relation %> <%= 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) %> <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> </h2>
<% @relation.old_relations.reverse.each do |relation| %> <% @relation.old_relations.reverse.each do |relation| %>

View file

@ -3,7 +3,7 @@
@title = t('browse.way.way') + ' | ' + @name @title = t('browse.way.way') + ' | ' + @name
%> %>
<h2><%= t'browse.way.way_title', :way_name => @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> </h2>
<%= render :partial => "way_details", :object => @way %> <%= 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) %> <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> </h2>
<% @way.old_ways.reverse.each do |way| %> <% @way.old_ways.reverse.each do |way| %>

View file

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

View file

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

View file

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

View file

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

View file

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