From 4557654ba63392f0db4aa5c002be692395eb8cee Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 3 Oct 2013 14:10:21 -0700 Subject: [PATCH] Simplify layouting --- app/controllers/browse_controller.rb | 7 +- app/controllers/changeset_controller.rb | 2 +- app/controllers/site_controller.rb | 5 +- app/views/browse/changeset.html.erb | 104 ++++++++++----------- app/views/browse/node.html.erb | 16 ++-- app/views/browse/node_history.html.erb | 18 ++-- app/views/browse/note.html.erb | 86 ++++++++--------- app/views/browse/relation.html.erb | 16 ++-- app/views/browse/relation_history.html.erb | 18 ++-- app/views/browse/way.html.erb | 16 ++-- app/views/browse/way_history.html.erb | 18 ++-- app/views/changeset/list.html.erb | 34 +++---- app/views/layouts/map.html.erb | 4 +- app/views/site/export.html.erb | 79 ++++++++-------- app/views/site/index.html.erb | 40 ++++---- 15 files changed, 212 insertions(+), 251 deletions(-) diff --git a/app/controllers/browse_controller.rb b/app/controllers/browse_controller.rb index 0103516ff..638cb7302 100644 --- a/app/controllers/browse_controller.rb +++ b/app/controllers/browse_controller.rb @@ -1,14 +1,15 @@ class BrowseController < ApplicationController - layout 'site', :except => [ :start ] + layout 'map' before_filter :authorize_web before_filter :set_locale before_filter { |c| c.check_database_readable(true) } around_filter :web_timeout, :except => [:start] - def start + def start + render :layout => false end - + def relation @type = "relation" @relation = Relation.find(params[:id]) diff --git a/app/controllers/changeset_controller.rb b/app/controllers/changeset_controller.rb index b07ca36ca..727522510 100644 --- a/app/controllers/changeset_controller.rb +++ b/app/controllers/changeset_controller.rb @@ -321,7 +321,7 @@ class ChangesetController < ApplicationController @edits = changesets.order("changesets.created_at DESC").offset((@page - 1) * @page_size).limit(@page_size).preload(:user, :changeset_tags) - render :action => :list + render :action => :list, :layout => 'map' end end diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index f4564100c..cb57ddc3a 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -1,6 +1,6 @@ class SiteController < ApplicationController - layout 'site', :except => [:key, :permalink] - layout false, :only => [:key, :permalink] + layout 'site' + layout 'map', :only => [:index, :export] before_filter :authorize_web before_filter :set_locale @@ -34,6 +34,7 @@ class SiteController < ApplicationController def key expires_in 7.days, :public => true + render :layout => false end def edit diff --git a/app/views/browse/changeset.html.erb b/app/views/browse/changeset.html.erb index 05e3d4391..6c60349dd 100644 --- a/app/views/browse/changeset.html.erb +++ b/app/views/browse/changeset.html.erb @@ -2,70 +2,66 @@ <%= stylesheet_link_tag 'browse' %> <% end %> -<% content_for :sidebar do %> -

<%= t 'browse.changeset.changeset', :id => @changeset.id %>

+

<%= t 'browse.changeset.changeset', :id => @changeset.id %>

-
-
-

<%= t 'browse.changeset_details.created_at' %>

-

<%= l @changeset.created_at %>

-
+
+
+

<%= t 'browse.changeset_details.created_at' %>

+

<%= l @changeset.created_at %>

+
+
+

<%= t 'browse.changeset_details.closed_at' %>

+

<%= l @changeset.closed_at %>

+
+ + <% if @changeset.user.data_public? %>
-

<%= t 'browse.changeset_details.closed_at' %>

-

<%= l @changeset.closed_at %>

+

<%= t 'browse.changeset_details.belongs_to' %>

+

<%= link_to h(@changeset.user.display_name), :controller => "user", :action => "view", :display_name => @changeset.user.display_name %>

+ <% end %> +
- <% if @changeset.user.data_public? %> -
-

<%= t 'browse.changeset_details.belongs_to' %>

-

<%= link_to h(@changeset.user.display_name), :controller => "user", :action => "view", :display_name => @changeset.user.display_name %>

-
- <% end %> -
+<%= render :partial => "tag_details", :object => @changeset %> - <%= render :partial => "tag_details", :object => @changeset %> +<% unless @nodes.empty? %> +
+

<%= t 'browse.changeset_details.has_nodes', :count => @node_pages.item_count %>

+ +
+ <%= render :partial => 'paging_nav', :locals => { :pages => @node_pages, :page_param => "node_page"} %> +<% end %> - <% unless @nodes.empty? %> -
-

<%= t 'browse.changeset_details.has_nodes', :count => @node_pages.item_count %>

- -
- <%= render :partial => 'paging_nav', :locals => { :pages => @node_pages, :page_param => "node_page"} %> - <% end %> +<% unless @ways.empty? %> +
+

<%= t 'browse.changeset_details.has_ways', :count => @way_pages.item_count %>

+ +
+ <%= render :partial => 'paging_nav', :locals => { :pages => @way_pages, :page_param => "way_page" } %> +<% end %> - <% unless @ways.empty? %> -
-

<%= t 'browse.changeset_details.has_ways', :count => @way_pages.item_count %>

+<% unless @relations.empty? %> +
+

<%= t 'browse.changeset_details.has_relations', :count => @relation_pages.item_count %>

    - <% @ways.each do |way| %> -
  • <%= link_to h(printable_name(way, true)), { :action => "way", :id => way.way_id.to_s }, :class => link_class('way', way), :title => link_title(way) %>
  • + <% @relations.each do |relation| %> +
  • <%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.relation_id.to_s }, :class => link_class('relation', relation), :title => link_title(relation) %>
  • <% end %>
-
- <%= render :partial => 'paging_nav', :locals => { :pages => @way_pages, :page_param => "way_page" } %> - <% end %> - - <% unless @relations.empty? %> -
-

<%= t 'browse.changeset_details.has_relations', :count => @relation_pages.item_count %>

-
    - <% @relations.each do |relation| %> -
  • <%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.relation_id.to_s }, :class => link_class('relation', relation), :title => link_title(relation) %>
  • - <% end %> -
-
- <%= render :partial => 'paging_nav', :locals => { :pages => @relation_pages, :page_param => "relation_page" } %> - <% end %> - - +
+ <%= render :partial => 'paging_nav', :locals => { :pages => @relation_pages, :page_param => "relation_page" } %> <% end %> -<%= render :template => 'layouts/map' %> + diff --git a/app/views/browse/node.html.erb b/app/views/browse/node.html.erb index 92ccb775d..a395b95ea 100644 --- a/app/views/browse/node.html.erb +++ b/app/views/browse/node.html.erb @@ -7,15 +7,11 @@ <%= stylesheet_link_tag 'browse' %> <% end %> -<% content_for :sidebar do %> -

<%= t'browse.node.node_title', :node_name => @name %>

+

<%= t'browse.node.node_title', :node_name => @name %>

- <%= render :partial => "node_details", :object => @node %> +<%= render :partial => "node_details", :object => @node %> - -<% end %> - -<%= render :template => 'layouts/map' %> + diff --git a/app/views/browse/node_history.html.erb b/app/views/browse/node_history.html.erb index 6f1a3f0b7..687dc4f9b 100644 --- a/app/views/browse/node_history.html.erb +++ b/app/views/browse/node_history.html.erb @@ -7,17 +7,13 @@ <%= stylesheet_link_tag 'browse' %> <% end %> -<% content_for :sidebar do %> -

<%= raw t'browse.node_history.node_history_title', :node_name => link_to(h(@name), :action => "node", :id => @node.id) %>

+

<%= raw t'browse.node_history.node_history_title', :node_name => link_to(h(@name), :action => "node", :id => @node.id) %>

- <% @node.old_nodes.reverse.each do |node| %> - <%= render :partial => "node_details", :object => node %> - <% end %> - - +<% @node.old_nodes.reverse.each do |node| %> + <%= render :partial => "node_details", :object => node %> <% end %> -<%= render :template => 'layouts/map' %> + diff --git a/app/views/browse/note.html.erb b/app/views/browse/note.html.erb index 8ccd525a3..c18fd40b3 100644 --- a/app/views/browse/note.html.erb +++ b/app/views/browse/note.html.erb @@ -2,57 +2,53 @@ <%= stylesheet_link_tag 'browse' %> <% end %> -<% content_for :sidebar do %> -

<%= t "browse.note.#{@note.status}_title", :note_name => @note.id %>

- - <% if @note.comments.find { |comment| comment.author.nil? } -%> -
-

<%= t "javascripts.notes.show.anonymous_warning" %>

+

<%= t "browse.note.#{@note.status}_title", :note_name => @note.id %>

+ +<% if @note.comments.find { |comment| comment.author.nil? } -%> +
+

<%= t "javascripts.notes.show.anonymous_warning" %>

+
+<% end -%> + +
+
+

<%= t "browse.note.opened" %>

+

<%= note_event(@note.created_at, @note.author) %>

- <% end -%> -
+ <% if @note.status == "closed" %>
-

<%= t "browse.note.opened" %>

-

<%= note_event(@note.created_at, @note.author) %>

-
- - <% if @note.status == "closed" %> -
-

<%= t "browse.note.closed" %>

-

<%= note_event(@note.closed_at, @note.comments.last.author) %>

-
- <% elsif @note.comments.length > 1 %> -
-

<%= t "browse.note.last_modified" %>

-

<%= note_event(@note.updated_at, @note.comments.last.author) %>

-
- <% end %> - -
-

<%= t "browse.note.description" %>

-

<%= h(@note.comments.first.body.to_html) %>

+

<%= t "browse.note.closed" %>

+

<%= note_event(@note.closed_at, @note.comments.last.author) %>

- + <% elsif @note.comments.length > 1 %>
-

<%= t "browse.node_details.coordinates" %>

-

<%= link_to ("#{number_with_delimiter(@note.lat)}, #{number_with_delimiter(@note.lon)}".html_safe), {:controller => 'site', :action => 'index', :lat => h(@note.lat), :lon => h(@note.lon), :zoom => "18"} %>

+

<%= t "browse.note.last_modified" %>

+

<%= note_event(@note.updated_at, @note.comments.last.author) %>

+ <% end %> + +
+

<%= t "browse.note.description" %>

+

<%= h(@note.comments.first.body.to_html) %>

- <% if @note.comments.length > 1 %> -
-

<%= t "browse.note.comments" %>

-
    - <% @note.comments[1..-1].each do |comment| %> -
  • - <%= comment.body.to_html %> - <%= note_event(comment.created_at, comment.author) %> -
  • - <% end %> -
-
- <% end %> +
+

<%= t "browse.node_details.coordinates" %>

+

<%= link_to ("#{number_with_delimiter(@note.lat)}, #{number_with_delimiter(@note.lon)}".html_safe), {:controller => 'site', :action => 'index', :lat => h(@note.lat), :lon => h(@note.lon), :zoom => "18"} %>

+
+
+ +<% if @note.comments.length > 1 %> +
+

<%= t "browse.note.comments" %>

+
    + <% @note.comments[1..-1].each do |comment| %> +
  • + <%= comment.body.to_html %> + <%= note_event(comment.created_at, comment.author) %> +
  • + <% end %> +
+
<% end %> - -<%= render :template => 'layouts/map' %> diff --git a/app/views/browse/relation.html.erb b/app/views/browse/relation.html.erb index 1e3af0df2..dc634e3af 100644 --- a/app/views/browse/relation.html.erb +++ b/app/views/browse/relation.html.erb @@ -7,15 +7,11 @@ <%= stylesheet_link_tag 'browse' %> <% end %> -<% content_for :sidebar do %> -

<%= t'browse.relation.relation_title', :relation_name => @name %>

+

<%= t'browse.relation.relation_title', :relation_name => @name %>

- <%= render :partial => "relation_details", :object => @relation %> +<%= render :partial => "relation_details", :object => @relation %> -
    -
  • <%= link_to(t('browse.relation.download_xml'), :controller => "relation", :action => "read") %>
  • -
  • <%= link_to(t('browse.relation.view_history'), :action => "relation_history") %>
  • -
-<% end %> - -<%= render :template => 'layouts/map' %> +
    +
  • <%= link_to(t('browse.relation.download_xml'), :controller => "relation", :action => "read") %>
  • +
  • <%= link_to(t('browse.relation.view_history'), :action => "relation_history") %>
  • +
diff --git a/app/views/browse/relation_history.html.erb b/app/views/browse/relation_history.html.erb index 5f419e6c7..486ada5c9 100644 --- a/app/views/browse/relation_history.html.erb +++ b/app/views/browse/relation_history.html.erb @@ -7,17 +7,13 @@ <%= stylesheet_link_tag 'browse' %> <% end %> -<% content_for :sidebar do %> -

<%= raw t'browse.relation_history.relation_history_title', :relation_name => link_to(h(@name), :action => "relation", :id => @relation.id) %>

+

<%= raw t'browse.relation_history.relation_history_title', :relation_name => link_to(h(@name), :action => "relation", :id => @relation.id) %>

- <% @relation.old_relations.reverse.each do |relation| %> - <%= render :partial => "relation_details", :object => relation %> - <% end %> - -
    -
  • <%= link_to(t('browse.relation_history.download_xml'), :controller => "old_relation", :action => "history") %>
  • -
  • <%= link_to(t('browse.relation_history.view_details'), :action => "relation") %>
  • -
+<% @relation.old_relations.reverse.each do |relation| %> + <%= render :partial => "relation_details", :object => relation %> <% end %> -<%= render :template => 'layouts/map' %> +
    +
  • <%= link_to(t('browse.relation_history.download_xml'), :controller => "old_relation", :action => "history") %>
  • +
  • <%= link_to(t('browse.relation_history.view_details'), :action => "relation") %>
  • +
diff --git a/app/views/browse/way.html.erb b/app/views/browse/way.html.erb index e5493d3f9..598e04728 100644 --- a/app/views/browse/way.html.erb +++ b/app/views/browse/way.html.erb @@ -7,15 +7,11 @@ <%= stylesheet_link_tag 'browse' %> <% end %> -<% content_for :sidebar do %> -

<%= t'browse.way.way_title', :way_name => @name %>

+

<%= t'browse.way.way_title', :way_name => @name %>

- <%= render :partial => "way_details", :object => @way %> +<%= render :partial => "way_details", :object => @way %> -
    -
  • <%= link_to(t('browse.way.download_xml'), :controller => "way", :action => "read") %>
  • -
  • <%= link_to(t('browse.way.view_history'), :action => "way_history") %>
  • -
-<% end %> - -<%= render :template => 'layouts/map' %> +
    +
  • <%= link_to(t('browse.way.download_xml'), :controller => "way", :action => "read") %>
  • +
  • <%= link_to(t('browse.way.view_history'), :action => "way_history") %>
  • +
diff --git a/app/views/browse/way_history.html.erb b/app/views/browse/way_history.html.erb index 7fe4feeb2..ddb8e288a 100644 --- a/app/views/browse/way_history.html.erb +++ b/app/views/browse/way_history.html.erb @@ -7,17 +7,13 @@ <%= stylesheet_link_tag 'browse' %> <% end %> -<% content_for :sidebar do %> -

<%= raw t'browse.way_history.way_history_title', :way_name => link_to(h(@name), :action => "way", :id => @way.id) %>

+

<%= raw t'browse.way_history.way_history_title', :way_name => link_to(h(@name), :action => "way", :id => @way.id) %>

- <% @way.old_ways.reverse.each do |way| %> - <%= render :partial => "way_details", :object => way %> - <% end %> - -
    -
  • <%= link_to(t('browse.way_history.download_xml'), :controller => "old_way", :action => "history") %>
  • -
  • <%= link_to(t('browse.way_history.view_details'), :action => "way") %>
  • -
+<% @way.old_ways.reverse.each do |way| %> + <%= render :partial => "way_details", :object => way %> <% end %> -<%= render :template => 'layouts/map' %> +
    +
  • <%= link_to(t('browse.way_history.download_xml'), :controller => "old_way", :action => "history") %>
  • +
  • <%= link_to(t('browse.way_history.view_details'), :action => "way") %>
  • +
diff --git a/app/views/changeset/list.html.erb b/app/views/changeset/list.html.erb index 965b66484..fc135c6ca 100644 --- a/app/views/changeset/list.html.erb +++ b/app/views/changeset/list.html.erb @@ -6,26 +6,22 @@ <% end -%> <% end -%> -<% content_for :sidebar do %> -

<%= @heading %>

+

<%= @heading %>

- <% if @edits.size > 0 %> -
    - <%= render :partial => 'changeset', - :collection => @edits %> -
+<% if @edits.size > 0 %> +
    + <%= render :partial => 'changeset', + :collection => @edits %> +
-
-
- <%= link_to t('geocoder.results.more_results'), '#', :class => "button" %> -
- <%= image_tag "searching.gif", :class => ["search_searching", "hidden"] %> +
+
+ <%= link_to t('geocoder.results.more_results'), '#', :class => "button" %>
- <% elsif @user and @user.display_name == params[:display_name] %> -

<%= t('changeset.list.empty_user_html') %>

- <% else %> -

<%= t('changeset.list.empty_anon_html') %>

- <% end %> + <%= image_tag "searching.gif", :class => ["search_searching", "hidden"] %> +
+<% elsif @user and @user.display_name == params[:display_name] %> +

<%= t('changeset.list.empty_user_html') %>

+<% else %> +

<%= t('changeset.list.empty_anon_html') %>

<% end %> - -<%= render :template => 'layouts/map' %> diff --git a/app/views/layouts/map.html.erb b/app/views/layouts/map.html.erb index 701922486..d5666ed09 100644 --- a/app/views/layouts/map.html.erb +++ b/app/views/layouts/map.html.erb @@ -22,7 +22,7 @@

<%= t 'layouts.osm_read_only' %>

<% end %> - <%= content_for :sidebar %> + <%= yield %>
@@ -51,3 +51,5 @@
<% end %> + +<%= render :template => 'layouts/site' %> diff --git a/app/views/site/export.html.erb b/app/views/site/export.html.erb index 63afa3dd0..c8d964a59 100644 --- a/app/views/site/export.html.erb +++ b/app/views/site/export.html.erb @@ -1,53 +1,50 @@ -<% content_for :sidebar do %> -

<%= t 'export.start_rjs.export' %>

- <%= form_tag :controller => "export", :action => "finish" do %> - <%= hidden_field_tag 'format', 'osm' %> - -
-
- <%= text_field_tag('maxlat', nil, :size => 10, :class => "export_bound") %> -
- <%= text_field_tag('minlon', nil, :size => 10, :class => "export_bound") %> - <%= text_field_tag('maxlon', nil, :size => 10, :class => "export_bound") %> -
- <%= text_field_tag('minlat', nil, :size => 10, :class => "export_bound") %> -
- <%= t'export.start.manually_select' %> +

<%= t 'export.start_rjs.export' %>

+ +<%= form_tag :controller => "export", :action => "finish" do %> + <%= hidden_field_tag 'format', 'osm' %> + +
+
+ <%= text_field_tag('maxlat', nil, :size => 10, :class => "export_bound") %> +
+ <%= text_field_tag('minlon', nil, :size => 10, :class => "export_bound") %> + <%= text_field_tag('maxlon', nil, :size => 10, :class => "export_bound") %> +
+ <%= text_field_tag('minlat', nil, :size => 10, :class => "export_bound") %>
+ <%= t'export.start.manually_select' %> +
-
-

<%= t'export.start.licence' %>

+
+

<%= t'export.start.licence' %>

-
-

<%= raw t'export.start.export_details' %>

-
+
+

<%= raw t'export.start.export_details' %>

+
-
-

<%= t'export.start.too_large.heading' %>

+
+

<%= t'export.start.too_large.heading' %>

-
-

<%= t'export.start.too_large.body' %>

-
-
<%= t'export.start.too_large.planet.title' %>
-
<%= t'export.start.too_large.planet.description' %>
+
+

<%= t'export.start.too_large.body' %>

+
+
<%= t'export.start.too_large.planet.title' %>
+
<%= t'export.start.too_large.planet.description' %>
-
<%= t'export.start.too_large.geofabrik.title' %>
-
<%= t'export.start.too_large.geofabrik.description' %>
+
<%= t'export.start.too_large.geofabrik.title' %>
+
<%= t'export.start.too_large.geofabrik.description' %>
-
<%= t'export.start.too_large.metro.title' %>
-
<%= t'export.start.too_large.metro.description' %>
+
<%= t'export.start.too_large.metro.title' %>
+
<%= t'export.start.too_large.metro.description' %>
-
<%= t'export.start.too_large.other.title' %>
-
<%= t'export.start.too_large.other.description' %>
-
-
+
<%= t'export.start.too_large.other.title' %>
+
<%= t'export.start.too_large.other.description' %>
+
+
-
- <%= submit_tag t('export.start.export_button'), :id => "export_commit" %> -
- <% end %> +
+ <%= submit_tag t('export.start.export_button'), :id => "export_commit" %> +
<% end %> - -<%= render :template => 'layouts/map' %> diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb index a98810172..fa3f31c1a 100644 --- a/app/views/site/index.html.erb +++ b/app/views/site/index.html.erb @@ -1,25 +1,21 @@ -<% content_for :sidebar do %> -

- <%= t 'layouts.intro_header' %> - -

+

+ <%= t 'layouts.intro_header' %> + +

-

<%= t 'layouts.intro_text' %>

+

<%= t 'layouts.intro_text' %>

- -- 2.39.5