page.pushstate = page.popstate = function(path) {
$("#content").addClass("overlay-sidebar");
map.invalidateSize();
- $('#sidebar_content').load(path);
+ $('#sidebar_content').load(path, function(a, b, xhr) {
+ if (xhr.getResponseHeader('X-Page-Title')) {
+ document.title = xhr.getResponseHeader('X-Page-Title');
+ }
+ });
};
page.unload = function() {
var page = {};
page.pushstate = page.popstate = function(path, type, id) {
- $('#sidebar_content').load(path, function() {
+ $('#sidebar_content').load(path, function(a, b, xhr) {
+ if (xhr.getResponseHeader('X-Page-Title')) {
+ document.title = xhr.getResponseHeader('X-Page-Title');
+ }
page.load(path, type, id);
});
};
page.pushstate = page.popstate = function(path) {
$("#export_tab").addClass("current");
- $("#sidebar_content").load(path, page.load);
+ $("#sidebar_content").load(path, function(a, b, xhr) {
+ if (xhr.getResponseHeader('X-Page-Title')) {
+ document.title = xhr.getResponseHeader('X-Page-Title');
+ }
+ page.load();
+ });
};
page.load = function() {
url: window.location.pathname,
method: "GET",
data: {bbox: map.getBounds().toBBoxString()},
- success: function(html) {
+ success: function(html, status, xhr) {
$('#sidebar_content .changesets').html(html);
updateMap();
}
page.pushstate = page.popstate = function(path) {
$("#history_tab").addClass("current");
- $("#sidebar_content").load(path, page.load);
+ $("#sidebar_content").load(path, function(a, b, xhr) {
+ if (xhr.getResponseHeader('X-Page-Title')) {
+ document.title = xhr.getResponseHeader('X-Page-Title');
+ }
+ page.load();
+ });
};
page.load = function() {
page.pushstate = page.popstate = function(path) {
var params = querystring.parse(path.substring(path.indexOf('?') + 1));
$("#query").val(params.query);
- $("#sidebar_content").load(path, page.load);
+ $("#sidebar_content").load(path, function() {
+ if (xhr.getResponseHeader('X-Page-Title')) {
+ document.title = xhr.getResponseHeader('X-Page-Title');
+ }
+ page.load();
+ });
};
page.load = function() {
@way_pages, @ways = paginate(:old_ways, :conditions => {:changeset_id => @changeset.id}, :per_page => 10, :parameter => 'way_page')
@relation_pages, @relations = paginate(:old_relations, :conditions => {:changeset_id => @changeset.id}, :per_page => 10, :parameter => 'relation_page')
- @title = "#{I18n.t('browse.changeset.title')} | #{@changeset.id}"
@next = Changeset.where("id > ?", @changeset.id).order(:id => :asc).first
@prev = Changeset.where("id < ?", @changeset.id).order(:id => :desc).first
def note
@type = "note"
@note = Note.find(params[:id])
- @title = "#{I18n.t('browse.note.title')} | #{@note.id}"
@next = Note.visible.where("id > ?", @note.id).order(:id => :asc).first
@prev = Note.visible.where("id < ?", @note.id).order(:id => :desc).first
rescue ActiveRecord::RecordNotFound
--- /dev/null
+module TitleHelper
+ def set_title(title = false)
+ if title
+ title = t('layouts.project_name.title') + ' | ' + title
+ else
+ title = t('layouts.project_name.title')
+ end
+ response.headers["X-Page-Title"] = title
+ @title = title
+ end
+end
+<% set_title("#{t('browse.changeset.title')} | #{@changeset.id}") %>
+
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t 'browse.changeset.changeset', :id => @changeset.id %>
<%
@name = printable_name @node
-@title = t('browse.node.node') + ' | ' + @name
+set_title(t('browse.node.node') + ' | ' + @name)
%>
<h2>
<%
@name = printable_name @node
-@title = t('browse.node_history.node_history') + ' | ' + @name
+set_title(t('browse.node_history.node_history') + ' | ' + @name)
%>
<h2>
+<% set_title("#{t('browse.note.title')} | #{@note.id}") %>
+
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t "browse.note.#{@note.status}_title", :note_name => @note.id %>
<%
@name = printable_name @relation
-@title = t('browse.relation.relation') + ' | ' + @name
+set_title(t('browse.relation.relation') + ' | ' + @name)
%>
<h2>
<%
@name = printable_name @relation
-@title = t('browse.relation_history.relation_history') + ' | ' + @name
+set_title(t('browse.relation_history.relation_history') + ' | ' + @name)
%>
<h2>
<%
@name = printable_name @way
-@title = t('browse.way.way') + ' | ' + @name
+set_title(t('browse.way.way') + ' | ' + @name)
%>
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%
@name = printable_name @way
-@title = t('browse.way_history.way_history') + ' | ' + @name
+set_title(t('browse.way_history.way_history') + ' | ' + @name)
%>
<h2>
<%
if params[:friends] and @user
- @title = t 'changeset.list.title_friend'
+ set_title(t 'changeset.list.title_friend')
@heading = t 'changeset.list.title_friend'
elsif params[:nearby] and @user
- @title = t 'changeset.list.title_nearby'
+ set_title(t 'changeset.list.title_nearby')
@heading = t 'changeset.list.title_nearby'
elsif params[:display_name]
- @title = t 'changeset.list.title_user', :user => params[:display_name]
+ set_title(t 'changeset.list.title_user', :user => params[:display_name])
@heading = t('changeset.list.title_user', :user => link_to(params[:display_name], :controller => "user", :action => "view", :display_name => params[:display_name])).html_safe
else
- @title = t 'changeset.list.title'
+ set_title(t 'changeset.list.title')
@heading = t 'changeset.list.title'
end
%>
OSM.oauth_consumer_secret = "<%= @oauth.client_application.secret %>";
<% end -%>
</script>
- <title><%= t 'layouts.project_name.title' %><%= ' | '+ @title if @title %></title>
+ <title><%= @title %></title>
</head>
+<% set_title(t('export.title')) %>
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t 'export.start_rjs.export' %>
-<% content_for(:content_class) { "overlay-sidebar" } %>
+<%
+ set_title()
+ content_for(:content_class) { "overlay-sidebar" }
+%>
<% unless @user %>
<div class="welcome">
newer_comments: "Newer Comments"
older_comments: "Older Comments"
export:
+ title: "Export"
start:
area_to_export: "Area to Export"
manually_select: "Manually select a different area"