]> git.openstreetmap.org Git - rails.git/commitdiff
Fix feed link for pushState loaded history page
authorJohn Firebaugh <john.firebaugh@gmail.com>
Mon, 25 Nov 2013 23:46:14 +0000 (15:46 -0800)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Mon, 25 Nov 2013 23:47:42 +0000 (15:47 -0800)
app/assets/javascripts/index.js
app/controllers/application_controller.rb
app/views/changeset/history.html.erb
app/views/layouts/_head.html.erb
app/views/layouts/xhr.html.erb [new file with mode: 0644]

index f90dca7bf01ecfefab86692bece3e112b6309cee..5ddd1bba11e2d084e78625cdc669982451a85be5 100644 (file)
         clearTimeout(loaderTimeout);
         $('#flash').empty();
         $('#sidebar_loader').hide();
-        $('#sidebar_content').html(xhr.responseText);
+
+        var content = $(xhr.responseText);
+
         if (xhr.getResponseHeader('X-Page-Title')) {
           document.title = xhr.getResponseHeader('X-Page-Title');
         }
+
+        $('head')
+          .find('link[type="application/atom+xml"]')
+          .remove();
+
+        $('head')
+          .append(content.filter('link[type="application/atom+xml"]'));
+
+        $('#sidebar_content').html(content.not('link[type="application/atom+xml"]'));
+
         if (callback) {
           callback();
         }
index 67e25c6a7b86520bb1526f0ef8236e897f984bab..7754f72fde350d57ac27c638d24a7b83194ed412 100644 (file)
@@ -419,7 +419,7 @@ class ApplicationController < ActionController::Base
   end
 
   def map_layout
-    request.xhr? ? false : 'map'
+    request.xhr? ? 'xhr' : 'map'
   end
 
   def preferred_editor
index 8aac76b75a9a388f547a7ed8075e2bdb12e838de..77118b4b4b5214c9183ded9af5af5dd4c8cfc041 100644 (file)
@@ -1,6 +1,6 @@
-<% content_for :head do -%>
+<% content_for :auto_discovery_link_tag do -%>
   <% unless params[:friends] or params[:nearby] -%>
-    <%= auto_discovery_link_tag :atom, params.merge({ :max_id => nil, :action => :feed }) %>
+    <%= auto_discovery_link_tag :atom, params.merge(:max_id => nil, :xhr => nil, :action => :feed) %>
   <% end -%>
 <% end -%>
 
index 9e603abab03f6bbf9e910c0baab376abad6235bd..13f70708162dc311c92249d38f3779b3ff3d0b64 100644 (file)
@@ -26,6 +26,7 @@
   <% end -%>  
   <%= style_rules %>
   <%= yield :head %>
+  <%= yield :auto_discovery_link_tag %>
   <%= csrf_meta_tag %>
   <script type="text/javascript">
     I18n.defaultLocale = "<%= I18n.default_locale %>";
diff --git a/app/views/layouts/xhr.html.erb b/app/views/layouts/xhr.html.erb
new file mode 100644 (file)
index 0000000..ab33aae
--- /dev/null
@@ -0,0 +1,2 @@
+<%= content_for :auto_discovery_link_tag %>
+<%= yield %>