From 85c284aaa6e9ba8488de9d488f17fda4cd565d9c Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sun, 14 Jan 2024 02:05:36 +0300 Subject: [PATCH 01/14] Add node version pages --- app/abilities/ability.rb | 1 + app/assets/javascripts/index.js | 11 ++++++++ app/controllers/old_nodes_controller.rb | 19 ++++++++++++++ app/views/browse/_common_details.html.erb | 4 +-- app/views/browse/_node.html.erb | 6 ++--- app/views/browse/_tag_details.html.erb | 2 +- app/views/old_nodes/not_found.html.erb | 7 +++++ app/views/old_nodes/show.html.erb | 5 ++++ config/locales/en.yml | 3 +++ config/routes.rb | 1 + test/controllers/old_nodes_controller_test.rb | 26 +++++++++++++++++++ 11 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 app/controllers/old_nodes_controller.rb create mode 100644 app/views/old_nodes/not_found.html.erb create mode 100644 app/views/old_nodes/show.html.erb create mode 100644 test/controllers/old_nodes_controller_test.rb diff --git a/app/abilities/ability.rb b/app/abilities/ability.rb index c7080595c..b601e66f0 100644 --- a/app/abilities/ability.rb +++ b/app/abilities/ability.rb @@ -6,6 +6,7 @@ class Ability def initialize(user) can [:relation, :relation_history, :way, :way_history, :node, :node_history, :changeset, :query], :browse + can [:show], OldNode can [:show, :new], Note can :search, :direction can [:index, :permalink, :edit, :help, :fixthemap, :offline, :export, :about, :communities, :preview, :copyright, :key, :id], :site diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 706647ef5..621054caf 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -355,6 +355,16 @@ $(document).ready(function () { return page; }; + OSM.OldBrowse = function () { + var page = {}; + + page.pushstate = page.popstate = function (path) { + OSM.loadSidebarContent(path); + }; + + return page; + }; + var history = OSM.History(map); OSM.router = OSM.Router(map, { @@ -369,6 +379,7 @@ $(document).ready(function () { "/user/:display_name/history": history, "/note/:id": OSM.Note(map), "/node/:id(/history)": OSM.Browse(map, "node"), + "/node/:id/history/:version": OSM.OldBrowse(), "/way/:id(/history)": OSM.Browse(map, "way"), "/relation/:id(/history)": OSM.Browse(map, "relation"), "/changeset/:id": OSM.Changeset(map), diff --git a/app/controllers/old_nodes_controller.rb b/app/controllers/old_nodes_controller.rb new file mode 100644 index 000000000..a5b9cf563 --- /dev/null +++ b/app/controllers/old_nodes_controller.rb @@ -0,0 +1,19 @@ +class OldNodesController < ApplicationController + layout :map_layout + + before_action :authorize_web + before_action :set_locale + before_action -> { check_database_readable(:need_api => true) } + before_action :require_oauth + + authorize_resource + + around_action :web_timeout + + def show + @type = "node" + @feature = OldNode.preload(:old_tags, :changeset => [:changeset_tags, :user]).find([params[:id], params[:version]]) + rescue ActiveRecord::RecordNotFound + render :action => "not_found", :status => :not_found + end +end diff --git a/app/views/browse/_common_details.html.erb b/app/views/browse/_common_details.html.erb index 4726799e7..b28e72c75 100644 --- a/app/views/browse/_common_details.html.erb +++ b/app/views/browse/_common_details.html.erb @@ -19,7 +19,7 @@
  • <%= t "browse.in_changeset" %> - #<%= link_to common_details.changeset_id, :action => :changeset, :id => common_details.changeset_id %> + #<%= link_to common_details.changeset_id, changeset_path(common_details.changeset) %>
  • <% if @type == "node" and common_details.visible? %> @@ -33,4 +33,4 @@ <% end %> -<%= render :partial => "tag_details", :object => common_details.tags %> +<%= render :partial => "browse/tag_details", :object => common_details.tags %> diff --git a/app/views/browse/_node.html.erb b/app/views/browse/_node.html.erb index 152223ae7..cc8597292 100644 --- a/app/views/browse/_node.html.erb +++ b/app/views/browse/_node.html.erb @@ -8,7 +8,7 @@ <% else %>
    - <%= render :partial => "common_details", :object => node %> + <%= render :partial => "browse/common_details", :object => node %> <% unless node.ways.empty? and node.containing_relation_members.empty? %>

    <%= t "browse.part_of" %>

    @@ -17,7 +17,7 @@ <%= t "browse.part_of_ways", :count => node.ways.uniq.count %> @@ -26,7 +26,7 @@
    > <%= t "browse.part_of_relations", :count => node.containing_relation_members.uniq.count %>
      - <%= render :partial => "containing_relation", :collection => node.containing_relation_members.uniq %> + <%= render :partial => "browse/containing_relation", :collection => node.containing_relation_members.uniq %>
    <% end %> diff --git a/app/views/browse/_tag_details.html.erb b/app/views/browse/_tag_details.html.erb index 9129ddaf5..cc08fe16a 100644 --- a/app/views/browse/_tag_details.html.erb +++ b/app/views/browse/_tag_details.html.erb @@ -2,7 +2,7 @@

    <%= t ".tags" %>

    - <%= render :partial => "tag", :collection => tag_details.sort %> + <%= render :partial => "browse/tag", :collection => tag_details.sort %>
    <% end %> diff --git a/app/views/old_nodes/not_found.html.erb b/app/views/old_nodes/not_found.html.erb new file mode 100644 index 000000000..1ee5d9d3f --- /dev/null +++ b/app/views/old_nodes/not_found.html.erb @@ -0,0 +1,7 @@ +<% set_title(t("browse.not_found.title")) %> + +<%= render "sidebar_header", :title => t("browse.not_found.title") %> + +
    +

    <%= t ".sorry", :id => params[:id], :version => params[:version] %>

    +
    diff --git a/app/views/old_nodes/show.html.erb b/app/views/old_nodes/show.html.erb new file mode 100644 index 000000000..d3d09892e --- /dev/null +++ b/app/views/old_nodes/show.html.erb @@ -0,0 +1,5 @@ +<% set_title t("browse.node.title_html", :name => printable_name(@feature)) %> + +<%= render "sidebar_header", :title => t("browse.node.title_html", :name => printable_name(@feature)) %> + +<%= render :partial => "browse/node", :object => @feature %> diff --git a/config/locales/en.yml b/config/locales/en.yml index a2347d4bc..6df0260cd 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -428,6 +428,9 @@ en: introduction: "Click on the map to find nearby features." nearby: "Nearby features" enclosing: "Enclosing features" + old_nodes: + not_found: + sorry: "Sorry, node #%{id} version %{version} could not be found." changesets: changeset_paging_nav: showing_page: "Page %{page}" diff --git a/config/routes.rb b/config/routes.rb index a38f8450f..29c260c9e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -113,6 +113,7 @@ OpenStreetMap::Application.routes.draw do get "/way/:id/history" => "browse#way_history", :id => /\d+/, :as => :way_history get "/node/:id" => "browse#node", :id => /\d+/, :as => :node get "/node/:id/history" => "browse#node_history", :id => /\d+/, :as => :node_history + resources :old_nodes, :path => "/node/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show get "/relation/:id" => "browse#relation", :id => /\d+/, :as => :relation get "/relation/:id/history" => "browse#relation_history", :id => /\d+/, :as => :relation_history get "/changeset/:id" => "browse#changeset", :as => :changeset, :id => /\d+/ diff --git a/test/controllers/old_nodes_controller_test.rb b/test/controllers/old_nodes_controller_test.rb new file mode 100644 index 000000000..80b8da946 --- /dev/null +++ b/test/controllers/old_nodes_controller_test.rb @@ -0,0 +1,26 @@ +require "test_helper" + +class OldNodesControllerTest < ActionDispatch::IntegrationTest + def test_routes + assert_routing( + { :path => "/node/1/history/2", :method => :get }, + { :controller => "old_nodes", :action => "show", :id => "1", :version => "2" } + ) + end + + def test_visible + node = create(:node, :with_history) + get old_node_path(node, 1) + assert_response :success + assert_template "old_nodes/show" + assert_template :layout => "map" + end + + def test_not_found + get old_node_path(0, 0) + assert_response :not_found + assert_template "old_nodes/not_found" + assert_template :layout => "map" + assert_select "#sidebar_content", /node #0 version 0 could not be found/ + end +end From 2f222c49dd60ea505f2c1631efa02fbd9f0f5667 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Mon, 15 Jan 2024 18:20:23 +0300 Subject: [PATCH 02/14] Add way version pages --- app/abilities/ability.rb | 1 + app/assets/javascripts/index.js | 1 + app/controllers/old_ways_controller.rb | 19 ++++++++++ app/views/browse/_way.html.erb | 6 +-- app/views/old_ways/not_found.html.erb | 7 ++++ app/views/old_ways/show.html.erb | 5 +++ config/locales/en.yml | 3 ++ config/routes.rb | 1 + test/controllers/old_ways_controller_test.rb | 40 ++++++++++++++++++++ 9 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 app/controllers/old_ways_controller.rb create mode 100644 app/views/old_ways/not_found.html.erb create mode 100644 app/views/old_ways/show.html.erb create mode 100644 test/controllers/old_ways_controller_test.rb diff --git a/app/abilities/ability.rb b/app/abilities/ability.rb index b601e66f0..643465c54 100644 --- a/app/abilities/ability.rb +++ b/app/abilities/ability.rb @@ -7,6 +7,7 @@ class Ability can [:relation, :relation_history, :way, :way_history, :node, :node_history, :changeset, :query], :browse can [:show], OldNode + can [:show], OldWay can [:show, :new], Note can :search, :direction can [:index, :permalink, :edit, :help, :fixthemap, :offline, :export, :about, :communities, :preview, :copyright, :key, :id], :site diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 621054caf..bb471490a 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -381,6 +381,7 @@ $(document).ready(function () { "/node/:id(/history)": OSM.Browse(map, "node"), "/node/:id/history/:version": OSM.OldBrowse(), "/way/:id(/history)": OSM.Browse(map, "way"), + "/way/:id/history/:version": OSM.OldBrowse(), "/relation/:id(/history)": OSM.Browse(map, "relation"), "/changeset/:id": OSM.Changeset(map), "/query": OSM.Query(map) diff --git a/app/controllers/old_ways_controller.rb b/app/controllers/old_ways_controller.rb new file mode 100644 index 000000000..d18121e6f --- /dev/null +++ b/app/controllers/old_ways_controller.rb @@ -0,0 +1,19 @@ +class OldWaysController < ApplicationController + layout :map_layout + + before_action :authorize_web + before_action :set_locale + before_action -> { check_database_readable(:need_api => true) } + before_action :require_oauth + + authorize_resource + + around_action :web_timeout + + def show + @type = "way" + @feature = OldWay.preload(:old_tags, :changeset => [:changeset_tags, :user], :old_nodes => { :node => [:node_tags, :ways] }).find([params[:id], params[:version]]) + rescue ActiveRecord::RecordNotFound + render :action => "not_found", :status => :not_found + end +end diff --git a/app/views/browse/_way.html.erb b/app/views/browse/_way.html.erb index 4fdcd035e..26403f3fd 100644 --- a/app/views/browse/_way.html.erb +++ b/app/views/browse/_way.html.erb @@ -8,7 +8,7 @@
    <% else %>
    - <%= render :partial => "common_details", :object => way %> + <%= render :partial => "browse/common_details", :object => way %> <% unless way.containing_relation_members.empty? %>

    <%= t "browse.part_of" %>

    @@ -27,10 +27,10 @@
    <% else %>
    - <%= render :partial => "common_details", :object => relation %> + <%= render :partial => "browse/common_details", :object => relation %> <% unless relation.containing_relation_members.empty? %>

    <%= t "browse.part_of" %>

    @@ -25,7 +25,7 @@
    > <%= t ".members_count", :count => relation.relation_members.count %>
      - <%= render :partial => "relation_member", :collection => relation.relation_members %> + <%= render :partial => "browse/relation_member", :collection => relation.relation_members %>
    <% end %> diff --git a/app/views/browse/_relation_member.html.erb b/app/views/browse/_relation_member.html.erb index 5c96dadaf..5e52c04e8 100644 --- a/app/views/browse/_relation_member.html.erb +++ b/app/views/browse/_relation_member.html.erb @@ -1,5 +1,5 @@ <% member_class = link_class(relation_member.member_type.downcase, relation_member.member) - linked_name = link_to printable_name(relation_member.member), { :action => relation_member.member_type.downcase, :id => relation_member.member_id.to_s }, { :title => link_title(relation_member.member), :rel => link_follow(relation_member.member) } + linked_name = link_to printable_name(relation_member.member), { :controller => :browse, :action => relation_member.member_type.downcase, :id => relation_member.member_id.to_s }, { :title => link_title(relation_member.member), :rel => link_follow(relation_member.member) } type_str = t ".type.#{relation_member.member_type.downcase}" %>
  • <%= if relation_member.member_role.blank? diff --git a/app/views/old_relations/not_found.html.erb b/app/views/old_relations/not_found.html.erb new file mode 100644 index 000000000..1ee5d9d3f --- /dev/null +++ b/app/views/old_relations/not_found.html.erb @@ -0,0 +1,7 @@ +<% set_title(t("browse.not_found.title")) %> + +<%= render "sidebar_header", :title => t("browse.not_found.title") %> + +
    +

    <%= t ".sorry", :id => params[:id], :version => params[:version] %>

    +
    diff --git a/app/views/old_relations/show.html.erb b/app/views/old_relations/show.html.erb new file mode 100644 index 000000000..360011ca2 --- /dev/null +++ b/app/views/old_relations/show.html.erb @@ -0,0 +1,5 @@ +<% set_title t("browse.relation.title_html", :name => printable_name(@feature)) %> + +<%= render "sidebar_header", :title => t("browse.relation.title_html", :name => printable_name(@feature)) %> + +<%= render :partial => "browse/relation", :object => @feature %> diff --git a/config/locales/en.yml b/config/locales/en.yml index e819aaa9c..069efb4a4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -434,6 +434,9 @@ en: old_ways: not_found: sorry: "Sorry, way #%{id} version %{version} could not be found." + old_relations: + not_found: + sorry: "Sorry, relation #%{id} version %{version} could not be found." changesets: changeset_paging_nav: showing_page: "Page %{page}" diff --git a/config/routes.rb b/config/routes.rb index b2a9918b3..09afe8fd9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -117,6 +117,7 @@ OpenStreetMap::Application.routes.draw do resources :old_nodes, :path => "/node/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show get "/relation/:id" => "browse#relation", :id => /\d+/, :as => :relation get "/relation/:id/history" => "browse#relation_history", :id => /\d+/, :as => :relation_history + resources :old_relations, :path => "/relation/:id/history", :id => /\d+/, :version => /\d+/, :param => :version, :only => :show get "/changeset/:id" => "browse#changeset", :as => :changeset, :id => /\d+/ get "/changeset/:id/comments/feed" => "changeset_comments#index", :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => "rss" } resources :notes, :path => "note", :only => [:show, :new] diff --git a/test/controllers/old_relations_controller_test.rb b/test/controllers/old_relations_controller_test.rb new file mode 100644 index 000000000..87ee50db4 --- /dev/null +++ b/test/controllers/old_relations_controller_test.rb @@ -0,0 +1,35 @@ +require "test_helper" + +class OldRelationsControllerTest < ActionDispatch::IntegrationTest + def test_routes + assert_routing( + { :path => "/relation/1/history/2", :method => :get }, + { :controller => "old_relations", :action => "show", :id => "1", :version => "2" } + ) + end + + def test_visible + relation = create(:relation, :with_history) + get old_relation_path(relation, 1) + assert_response :success + assert_template "old_relations/show" + assert_template :layout => "map" + end + + def test_visible_with_members + relation = create(:relation, :with_history) + create(:old_relation_member, :old_relation => relation.old_relations.first) + get old_relation_path(relation, 1) + assert_response :success + assert_template "old_relations/show" + assert_template :layout => "map" + end + + def test_not_found + get old_relation_path(0, 0) + assert_response :not_found + assert_template "old_relations/not_found" + assert_template :layout => "map" + assert_select "#sidebar_content", /relation #0 version 0 could not be found/ + end +end From 81c11988f58fa54664d60c22f4f6b82f5af5ce1d Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 16 Jan 2024 04:35:28 +0300 Subject: [PATCH 04/14] Add links to element versions from version headings --- app/views/browse/_common_details.html.erb | 2 +- test/controllers/browse_controller_test.rb | 38 +++++++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/app/views/browse/_common_details.html.erb b/app/views/browse/_common_details.html.erb index b28e72c75..fa8eeb3a5 100644 --- a/app/views/browse/_common_details.html.erb +++ b/app/views/browse/_common_details.html.erb @@ -1,6 +1,6 @@

    <%= t "browse.version" %> - #<%= common_details.version %> + #<%= link_to common_details.version, :controller => "old_#{@type.pluralize}", :action => :show, :version => common_details.version %>

    diff --git a/test/controllers/browse_controller_test.rb b/test/controllers/browse_controller_test.rb index 674a318ed..ed71e83fc 100644 --- a/test/controllers/browse_controller_test.rb +++ b/test/controllers/browse_controller_test.rb @@ -39,35 +39,63 @@ class BrowseControllerTest < ActionDispatch::IntegrationTest end def test_read_relation - browse_check :relation_path, create(:relation).id, "browse/feature" + relation = create(:relation) + browse_check :relation_path, relation.id, "browse/feature" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_relation_path relation, 1}']", :text => "1", :count => 1 + end + assert_select "a[href='#{api_relation_path relation}']", :count => 1 end def test_read_relation_history - browse_check :relation_history_path, create(:relation, :with_history).id, "browse/history" + relation = create(:relation, :with_history) + browse_check :relation_history_path, relation.id, "browse/history" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_relation_path relation, 1}']", :text => "1", :count => 1 + end end def test_read_way - browse_check :way_path, create(:way).id, "browse/feature" + way = create(:way) + browse_check :way_path, way.id, "browse/feature" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_way_path way, 1}']", :text => "1", :count => 1 + end + assert_select "a[href='#{api_way_path way}']", :count => 1 end def test_read_way_history - browse_check :way_history_path, create(:way, :with_history).id, "browse/history" + way = create(:way, :with_history) + browse_check :way_history_path, way.id, "browse/history" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_way_path way, 1}']", :text => "1", :count => 1 + end end def test_read_node node = create(:node) browse_check :node_path, node.id, "browse/feature" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_node_path node, 1}']", :text => "1", :count => 1 + end assert_select "a[href='#{api_node_path node}']", :count => 1 end def test_read_deleted_node node = create(:node, :visible => false) browse_check :node_path, node.id, "browse/feature" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_node_path node, 1}']", :text => "1", :count => 1 + end assert_select "a[href='#{api_node_path node}']", :count => 0 end def test_read_node_history - browse_check :node_history_path, create(:node, :with_history).id, "browse/history" + node = create(:node, :with_history) + browse_check :node_history_path, node.id, "browse/history" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_node_path node, 1}']", :text => "1", :count => 1 + end end def test_read_changeset From 3a5c72986517ae11c8f225c1134bf869819a84e3 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 17 Jan 2024 03:34:42 +0300 Subject: [PATCH 05/14] Don't link to self from element version pages --- app/views/browse/_common_details.html.erb | 2 +- test/controllers/old_nodes_controller_test.rb | 3 +++ test/controllers/old_relations_controller_test.rb | 3 +++ test/controllers/old_ways_controller_test.rb | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/views/browse/_common_details.html.erb b/app/views/browse/_common_details.html.erb index fa8eeb3a5..7d3f8e829 100644 --- a/app/views/browse/_common_details.html.erb +++ b/app/views/browse/_common_details.html.erb @@ -1,6 +1,6 @@

    <%= t "browse.version" %> - #<%= link_to common_details.version, :controller => "old_#{@type.pluralize}", :action => :show, :version => common_details.version %> + #<%= link_to_unless_current common_details.version, :controller => "old_#{@type.pluralize}", :action => :show, :version => common_details.version %>

    diff --git a/test/controllers/old_nodes_controller_test.rb b/test/controllers/old_nodes_controller_test.rb index 80b8da946..68a6c1f3e 100644 --- a/test/controllers/old_nodes_controller_test.rb +++ b/test/controllers/old_nodes_controller_test.rb @@ -14,6 +14,9 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "old_nodes/show" assert_template :layout => "map" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_node_path node, 1}']", :count => 0 + end end def test_not_found diff --git a/test/controllers/old_relations_controller_test.rb b/test/controllers/old_relations_controller_test.rb index 87ee50db4..2e791f227 100644 --- a/test/controllers/old_relations_controller_test.rb +++ b/test/controllers/old_relations_controller_test.rb @@ -14,6 +14,9 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "old_relations/show" assert_template :layout => "map" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0 + end end def test_visible_with_members diff --git a/test/controllers/old_ways_controller_test.rb b/test/controllers/old_ways_controller_test.rb index 897bdba1f..022e4e820 100644 --- a/test/controllers/old_ways_controller_test.rb +++ b/test/controllers/old_ways_controller_test.rb @@ -14,6 +14,9 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "old_ways/show" assert_template :layout => "map" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_way_path way, 1}']", :count => 0 + end end def test_visible_with_shared_nodes From 88e72be5b1ca6c25395d30a82d9624ebb2af2b0b Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 17 Jan 2024 04:01:43 +0300 Subject: [PATCH 06/14] Add links to api element version xml downloads --- app/views/old_nodes/show.html.erb | 4 ++++ app/views/old_relations/show.html.erb | 4 ++++ app/views/old_ways/show.html.erb | 4 ++++ test/controllers/old_nodes_controller_test.rb | 1 + test/controllers/old_relations_controller_test.rb | 1 + test/controllers/old_ways_controller_test.rb | 1 + 6 files changed, 15 insertions(+) diff --git a/app/views/old_nodes/show.html.erb b/app/views/old_nodes/show.html.erb index d3d09892e..6a16c789c 100644 --- a/app/views/old_nodes/show.html.erb +++ b/app/views/old_nodes/show.html.erb @@ -3,3 +3,7 @@ <%= render "sidebar_header", :title => t("browse.node.title_html", :name => printable_name(@feature)) %> <%= render :partial => "browse/node", :object => @feature %> + +

    + <%= link_to t("browse.download_xml"), node_version_path(*@feature.id) %> +
    diff --git a/app/views/old_relations/show.html.erb b/app/views/old_relations/show.html.erb index 360011ca2..1a34e9ade 100644 --- a/app/views/old_relations/show.html.erb +++ b/app/views/old_relations/show.html.erb @@ -3,3 +3,7 @@ <%= render "sidebar_header", :title => t("browse.relation.title_html", :name => printable_name(@feature)) %> <%= render :partial => "browse/relation", :object => @feature %> + +
    + <%= link_to t("browse.download_xml"), relation_version_path(*@feature.id) %> +
    diff --git a/app/views/old_ways/show.html.erb b/app/views/old_ways/show.html.erb index fa6987157..c7826a511 100644 --- a/app/views/old_ways/show.html.erb +++ b/app/views/old_ways/show.html.erb @@ -3,3 +3,7 @@ <%= render "sidebar_header", :title => t("browse.way.title_html", :name => printable_name(@feature)) %> <%= render :partial => "browse/way", :object => @feature %> + +
    + <%= link_to t("browse.download_xml"), way_version_path(*@feature.id) %> +
    diff --git a/test/controllers/old_nodes_controller_test.rb b/test/controllers/old_nodes_controller_test.rb index 68a6c1f3e..2e27983d0 100644 --- a/test/controllers/old_nodes_controller_test.rb +++ b/test/controllers/old_nodes_controller_test.rb @@ -17,6 +17,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_node_path node, 1}']", :count => 0 end + assert_select "a[href='#{node_version_path node, 1}']", :count => 1 end def test_not_found diff --git a/test/controllers/old_relations_controller_test.rb b/test/controllers/old_relations_controller_test.rb index 2e791f227..488852ed9 100644 --- a/test/controllers/old_relations_controller_test.rb +++ b/test/controllers/old_relations_controller_test.rb @@ -17,6 +17,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0 end + assert_select "a[href='#{relation_version_path relation, 1}']", :count => 1 end def test_visible_with_members diff --git a/test/controllers/old_ways_controller_test.rb b/test/controllers/old_ways_controller_test.rb index 022e4e820..f32fdde77 100644 --- a/test/controllers/old_ways_controller_test.rb +++ b/test/controllers/old_ways_controller_test.rb @@ -17,6 +17,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_way_path way, 1}']", :count => 0 end + assert_select "a[href='#{way_version_path way, 1}']", :count => 1 end def test_visible_with_shared_nodes From 7c55a5cb3b07f40ab1897a7d746de27317255c42 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 17 Jan 2024 19:57:49 +0300 Subject: [PATCH 07/14] Don't link to xml download from redacted element versions --- app/views/old_nodes/show.html.erb | 8 +++++--- app/views/old_relations/show.html.erb | 8 +++++--- app/views/old_ways/show.html.erb | 8 +++++--- test/controllers/old_nodes_controller_test.rb | 12 ++++++++++++ test/controllers/old_relations_controller_test.rb | 12 ++++++++++++ test/controllers/old_ways_controller_test.rb | 12 ++++++++++++ 6 files changed, 51 insertions(+), 9 deletions(-) diff --git a/app/views/old_nodes/show.html.erb b/app/views/old_nodes/show.html.erb index 6a16c789c..b5758b44a 100644 --- a/app/views/old_nodes/show.html.erb +++ b/app/views/old_nodes/show.html.erb @@ -4,6 +4,8 @@ <%= render :partial => "browse/node", :object => @feature %> -
    - <%= link_to t("browse.download_xml"), node_version_path(*@feature.id) %> -
    +<% unless @feature.redacted? %> +
    + <%= link_to t("browse.download_xml"), node_version_path(*@feature.id) %> +
    +<% end %> diff --git a/app/views/old_relations/show.html.erb b/app/views/old_relations/show.html.erb index 1a34e9ade..cfa27c1ad 100644 --- a/app/views/old_relations/show.html.erb +++ b/app/views/old_relations/show.html.erb @@ -4,6 +4,8 @@ <%= render :partial => "browse/relation", :object => @feature %> -
    - <%= link_to t("browse.download_xml"), relation_version_path(*@feature.id) %> -
    +<% unless @feature.redacted? %> +
    + <%= link_to t("browse.download_xml"), relation_version_path(*@feature.id) %> +
    +<% end %> diff --git a/app/views/old_ways/show.html.erb b/app/views/old_ways/show.html.erb index c7826a511..6e66fa515 100644 --- a/app/views/old_ways/show.html.erb +++ b/app/views/old_ways/show.html.erb @@ -4,6 +4,8 @@ <%= render :partial => "browse/way", :object => @feature %> -
    - <%= link_to t("browse.download_xml"), way_version_path(*@feature.id) %> -
    +<% unless @feature.redacted? %> +
    + <%= link_to t("browse.download_xml"), way_version_path(*@feature.id) %> +
    +<% end %> diff --git a/test/controllers/old_nodes_controller_test.rb b/test/controllers/old_nodes_controller_test.rb index 2e27983d0..dc1a5cce8 100644 --- a/test/controllers/old_nodes_controller_test.rb +++ b/test/controllers/old_nodes_controller_test.rb @@ -20,6 +20,18 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_select "a[href='#{node_version_path node, 1}']", :count => 1 end + def test_redacted + node = create(:node, :with_history, :deleted, :version => 2) + node_v1 = node.old_nodes.find_by(:version => 1) + node_v1.redact!(create(:redaction)) + get old_node_path(node, 1) + assert_response :success + assert_template "old_nodes/show" + assert_template :layout => "map" + assert_select "a[href='#{old_node_path node, 1}']", :count => 0 + assert_select "a[href='#{node_version_path node, 1}']", :count => 0 + end + def test_not_found get old_node_path(0, 0) assert_response :not_found diff --git a/test/controllers/old_relations_controller_test.rb b/test/controllers/old_relations_controller_test.rb index 488852ed9..87c4926ef 100644 --- a/test/controllers/old_relations_controller_test.rb +++ b/test/controllers/old_relations_controller_test.rb @@ -29,6 +29,18 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_template :layout => "map" end + def test_redacted + relation = create(:relation, :with_history, :deleted, :version => 2) + relation_v1 = relation.old_relations.find_by(:version => 1) + relation_v1.redact!(create(:redaction)) + get old_relation_path(relation, 1) + assert_response :success + assert_template "old_relations/show" + assert_template :layout => "map" + assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0 + assert_select "a[href='#{relation_version_path relation, 1}']", :count => 0 + end + def test_not_found get old_relation_path(0, 0) assert_response :not_found diff --git a/test/controllers/old_ways_controller_test.rb b/test/controllers/old_ways_controller_test.rb index f32fdde77..67c4fb000 100644 --- a/test/controllers/old_ways_controller_test.rb +++ b/test/controllers/old_ways_controller_test.rb @@ -34,6 +34,18 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_template :layout => "map" end + def test_redacted + way = create(:way, :with_history, :deleted, :version => 2) + way_v1 = way.old_ways.find_by(:version => 1) + way_v1.redact!(create(:redaction)) + get old_way_path(way, 1) + assert_response :success + assert_template "old_ways/show" + assert_template :layout => "map" + assert_select "a[href='#{old_way_path way, 1}']", :count => 0 + assert_select "a[href='#{way_version_path way, 1}']", :count => 0 + end + def test_not_found get old_way_path(0, 0) assert_response :not_found From 18899f2867c85ea4bff8ecb188f57768300b4f8d Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 17 Jan 2024 20:32:56 +0300 Subject: [PATCH 08/14] Link to first and last versions from element pages --- app/views/browse/feature.html.erb | 15 +++++++-- test/controllers/browse_controller_test.rb | 36 ++++++++++++++++++++-- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/app/views/browse/feature.html.erb b/app/views/browse/feature.html.erb index 86b9020a2..3b7c64a8d 100644 --- a/app/views/browse/feature.html.erb +++ b/app/views/browse/feature.html.erb @@ -4,10 +4,19 @@ <%= render :partial => @type, :object => @feature %> -
    - <% if @feature.visible? %> +<% if @feature.visible? %> +
    <%= link_to(t("browse.download_xml"), :controller => "api/#{@type.pluralize}", :action => :show) %> +
    +<% end %> +
    + <% if @feature.version > 1 %> + <%= link_to "<< #{t('browse.version')} #1", :controller => "old_#{@type.pluralize}", :action => :show, :version => 1 %> · <% end %> - <%= link_to(t("browse.view_history"), :action => "#{@type}_history") %> + <%= link_to t("browse.view_history"), :action => "#{@type}_history" %> + <% if @feature.version > 1 %> + · + <%= link_to "#{t('browse.version')} ##{@feature.version} >>", :controller => "old_#{@type.pluralize}", :action => :show, :version => @feature.version %> + <% end %>
    diff --git a/test/controllers/browse_controller_test.rb b/test/controllers/browse_controller_test.rb index ed71e83fc..7df246c57 100644 --- a/test/controllers/browse_controller_test.rb +++ b/test/controllers/browse_controller_test.rb @@ -44,7 +44,17 @@ class BrowseControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_relation_path relation, 1}']", :text => "1", :count => 1 end - assert_select "a[href='#{api_relation_path relation}']", :count => 1 + assert_select ".secondary-actions a[href='#{api_relation_path relation}']", :count => 1 + assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0 + end + + def test_multiple_version_relation_links + relation = create(:relation, :with_history, :version => 2) + browse_check :relation_path, relation.id, "browse/feature" + assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_relation_path relation, 2}']", :count => 1 end def test_read_relation_history @@ -61,7 +71,17 @@ class BrowseControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_way_path way, 1}']", :text => "1", :count => 1 end - assert_select "a[href='#{api_way_path way}']", :count => 1 + assert_select ".secondary-actions a[href='#{api_way_path way}']", :count => 1 + assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0 + end + + def test_multiple_version_way_links + way = create(:way, :with_history, :version => 2) + browse_check :way_path, way.id, "browse/feature" + assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_way_path way, 2}']", :count => 1 end def test_read_way_history @@ -78,7 +98,17 @@ class BrowseControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_node_path node, 1}']", :text => "1", :count => 1 end - assert_select "a[href='#{api_node_path node}']", :count => 1 + assert_select ".secondary-actions a[href='#{api_node_path node}']", :count => 1 + assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 0 + end + + def test_multiple_version_node_links + node = create(:node, :with_history, :version => 2) + browse_check :node_path, node.id, "browse/feature" + assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_node_path node, 2}']", :count => 1 end def test_read_deleted_node From a39d997cf4195d040efdbf322ca6e2775220f0b0 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 17 Jan 2024 21:10:26 +0300 Subject: [PATCH 09/14] Link to previous/next versions from node version pages --- app/views/old_nodes/show.html.erb | 12 +++++++ test/controllers/old_nodes_controller_test.rb | 34 ++++++++++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/app/views/old_nodes/show.html.erb b/app/views/old_nodes/show.html.erb index b5758b44a..ba7c10ecb 100644 --- a/app/views/old_nodes/show.html.erb +++ b/app/views/old_nodes/show.html.erb @@ -9,3 +9,15 @@ <%= link_to t("browse.download_xml"), node_version_path(*@feature.id) %>
    <% end %> + +
    + <% if @feature.version > 1 %> + <%= link_to "<< #{t('browse.version')} ##{@feature.version - 1}", old_node_path(@feature.node_id, @feature.version - 1) %> + · + <% end %> + <%= link_to t("browse.view_history"), node_history_path(@feature.node_id) %> + <% if @feature.version < @feature.current_node.version %> + · + <%= link_to "#{t('browse.version')} ##{@feature.version + 1} >>", old_node_path(@feature.node_id, @feature.version + 1) %> + <% end %> +
    diff --git a/test/controllers/old_nodes_controller_test.rb b/test/controllers/old_nodes_controller_test.rb index dc1a5cce8..4263077c8 100644 --- a/test/controllers/old_nodes_controller_test.rb +++ b/test/controllers/old_nodes_controller_test.rb @@ -8,7 +8,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest ) end - def test_visible + def test_visible_with_one_version node = create(:node, :with_history) get old_node_path(node, 1) assert_response :success @@ -17,7 +17,33 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_node_path node, 1}']", :count => 0 end - assert_select "a[href='#{node_version_path node, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1 + end + + def test_visible_with_two_versions + node = create(:node, :with_history, :version => 2) + get old_node_path(node, 1) + assert_response :success + assert_template "old_nodes/show" + assert_template :layout => "map" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_node_path node, 1}']", :count => 0 + end + assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_node_path node, 2}']", :count => 1 + + get old_node_path(node, 2) + assert_response :success + assert_template "old_nodes/show" + assert_template :layout => "map" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_node_path node, 2}']", :count => 0 + end + assert_select ".secondary-actions a[href='#{node_version_path node, 2}']", :count => 1 + assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 1 end def test_redacted @@ -28,8 +54,8 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "old_nodes/show" assert_template :layout => "map" - assert_select "a[href='#{old_node_path node, 1}']", :count => 0 - assert_select "a[href='#{node_version_path node, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 0 end def test_not_found From d951e4f82e50c48b6783493d735d90d99ed41637 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 17 Jan 2024 21:20:43 +0300 Subject: [PATCH 10/14] Link to previous/next versions from way version pages --- app/views/old_ways/show.html.erb | 12 +++++++ test/controllers/old_ways_controller_test.rb | 34 +++++++++++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/app/views/old_ways/show.html.erb b/app/views/old_ways/show.html.erb index 6e66fa515..d4e82b8a4 100644 --- a/app/views/old_ways/show.html.erb +++ b/app/views/old_ways/show.html.erb @@ -9,3 +9,15 @@ <%= link_to t("browse.download_xml"), way_version_path(*@feature.id) %>
  • <% end %> + +
    + <% if @feature.version > 1 %> + <%= link_to "<< #{t('browse.version')} ##{@feature.version - 1}", old_way_path(@feature.way_id, @feature.version - 1) %> + · + <% end %> + <%= link_to t("browse.view_history"), way_history_path(@feature.way_id) %> + <% if @feature.version < @feature.current_way.version %> + · + <%= link_to "#{t('browse.version')} ##{@feature.version + 1} >>", old_way_path(@feature.way_id, @feature.version + 1) %> + <% end %> +
    diff --git a/test/controllers/old_ways_controller_test.rb b/test/controllers/old_ways_controller_test.rb index 67c4fb000..3e1113475 100644 --- a/test/controllers/old_ways_controller_test.rb +++ b/test/controllers/old_ways_controller_test.rb @@ -8,7 +8,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest ) end - def test_visible + def test_visible_with_one_version way = create(:way, :with_history) get old_way_path(way, 1) assert_response :success @@ -17,7 +17,33 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_way_path way, 1}']", :count => 0 end - assert_select "a[href='#{way_version_path way, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1 + end + + def test_visible_with_two_versions + way = create(:way, :with_history, :version => 2) + get old_way_path(way, 1) + assert_response :success + assert_template "old_ways/show" + assert_template :layout => "map" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_way_path way, 1}']", :count => 0 + end + assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_way_path way, 2}']", :count => 1 + + get old_way_path(way, 2) + assert_response :success + assert_template "old_ways/show" + assert_template :layout => "map" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_way_path way, 2}']", :count => 0 + end + assert_select ".secondary-actions a[href='#{way_version_path way, 2}']", :count => 1 + assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 1 end def test_visible_with_shared_nodes @@ -42,8 +68,8 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "old_ways/show" assert_template :layout => "map" - assert_select "a[href='#{old_way_path way, 1}']", :count => 0 - assert_select "a[href='#{way_version_path way, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 0 end def test_not_found From bfc021edf3566982671bd2bd09db3c8667fc756a Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 17 Jan 2024 21:25:07 +0300 Subject: [PATCH 11/14] Link to previous/next versions from relation version pages --- app/views/old_relations/show.html.erb | 12 +++++++ .../old_relations_controller_test.rb | 34 ++++++++++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/app/views/old_relations/show.html.erb b/app/views/old_relations/show.html.erb index cfa27c1ad..dd52b3833 100644 --- a/app/views/old_relations/show.html.erb +++ b/app/views/old_relations/show.html.erb @@ -9,3 +9,15 @@ <%= link_to t("browse.download_xml"), relation_version_path(*@feature.id) %> <% end %> + +
    + <% if @feature.version > 1 %> + <%= link_to "<< #{t('browse.version')} ##{@feature.version - 1}", old_relation_path(@feature.relation_id, @feature.version - 1) %> + · + <% end %> + <%= link_to t("browse.view_history"), relation_history_path(@feature.relation_id) %> + <% if @feature.version < @feature.current_relation.version %> + · + <%= link_to "#{t('browse.version')} ##{@feature.version + 1} >>", old_relation_path(@feature.relation_id, @feature.version + 1) %> + <% end %> +
    diff --git a/test/controllers/old_relations_controller_test.rb b/test/controllers/old_relations_controller_test.rb index 87c4926ef..5b7a67bf0 100644 --- a/test/controllers/old_relations_controller_test.rb +++ b/test/controllers/old_relations_controller_test.rb @@ -8,7 +8,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest ) end - def test_visible + def test_visible_with_one_version relation = create(:relation, :with_history) get old_relation_path(relation, 1) assert_response :success @@ -17,7 +17,33 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_select "h4", /^Version/ do assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0 end - assert_select "a[href='#{relation_version_path relation, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1 + end + + def test_visible_with_two_versions + relation = create(:relation, :with_history, :version => 2) + get old_relation_path(relation, 1) + assert_response :success + assert_template "old_relations/show" + assert_template :layout => "map" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0 + end + assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_relation_path relation, 2}']", :count => 1 + + get old_relation_path(relation, 2) + assert_response :success + assert_template "old_relations/show" + assert_template :layout => "map" + assert_select "h4", /^Version/ do + assert_select "a[href='#{old_relation_path relation, 2}']", :count => 0 + end + assert_select ".secondary-actions a[href='#{relation_version_path relation, 2}']", :count => 1 + assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1 + assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 1 end def test_visible_with_members @@ -37,8 +63,8 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "old_relations/show" assert_template :layout => "map" - assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0 - assert_select "a[href='#{relation_version_path relation, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0 + assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 0 end def test_not_found From e119200c1f6d372673d40f778c1561fa3b1358eb Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 17 Jan 2024 21:32:57 +0300 Subject: [PATCH 12/14] Link to details from node version pages --- app/views/old_nodes/show.html.erb | 10 ++++++---- test/controllers/old_nodes_controller_test.rb | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/views/old_nodes/show.html.erb b/app/views/old_nodes/show.html.erb index ba7c10ecb..b69c29723 100644 --- a/app/views/old_nodes/show.html.erb +++ b/app/views/old_nodes/show.html.erb @@ -4,11 +4,13 @@ <%= render :partial => "browse/node", :object => @feature %> -<% unless @feature.redacted? %> -
    +
    + <% unless @feature.redacted? %> <%= link_to t("browse.download_xml"), node_version_path(*@feature.id) %> -
    -<% end %> + · + <% end %> + <%= link_to t("browse.view_details"), node_path(@feature.node_id) %> +
    <% if @feature.version > 1 %> diff --git a/test/controllers/old_nodes_controller_test.rb b/test/controllers/old_nodes_controller_test.rb index 4263077c8..3f2958bd3 100644 --- a/test/controllers/old_nodes_controller_test.rb +++ b/test/controllers/old_nodes_controller_test.rb @@ -18,6 +18,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_select "a[href='#{old_node_path node, 1}']", :count => 0 end assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1 end @@ -31,6 +32,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_select "a[href='#{old_node_path node, 1}']", :count => 0 end assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{old_node_path node, 2}']", :count => 1 @@ -42,6 +44,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_select "a[href='#{old_node_path node, 2}']", :count => 0 end assert_select ".secondary-actions a[href='#{node_version_path node, 2}']", :count => 1 + assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 1 end @@ -54,6 +57,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "old_nodes/show" assert_template :layout => "map" + assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1 assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 0 assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 0 end From a0a269b206ed1f1ca096b17eee35815091cdbfc5 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 17 Jan 2024 21:36:48 +0300 Subject: [PATCH 13/14] Link to details from way version pages --- app/views/old_ways/show.html.erb | 10 ++++++---- test/controllers/old_ways_controller_test.rb | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/views/old_ways/show.html.erb b/app/views/old_ways/show.html.erb index d4e82b8a4..e9976dd78 100644 --- a/app/views/old_ways/show.html.erb +++ b/app/views/old_ways/show.html.erb @@ -4,11 +4,13 @@ <%= render :partial => "browse/way", :object => @feature %> -<% unless @feature.redacted? %> -
    +
    + <% unless @feature.redacted? %> <%= link_to t("browse.download_xml"), way_version_path(*@feature.id) %> -
    -<% end %> + · + <% end %> + <%= link_to t("browse.view_details"), way_path(@feature.way_id) %> +
    <% if @feature.version > 1 %> diff --git a/test/controllers/old_ways_controller_test.rb b/test/controllers/old_ways_controller_test.rb index 3e1113475..d428605c5 100644 --- a/test/controllers/old_ways_controller_test.rb +++ b/test/controllers/old_ways_controller_test.rb @@ -18,6 +18,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_select "a[href='#{old_way_path way, 1}']", :count => 0 end assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1 end @@ -31,6 +32,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_select "a[href='#{old_way_path way, 1}']", :count => 0 end assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{old_way_path way, 2}']", :count => 1 @@ -42,6 +44,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_select "a[href='#{old_way_path way, 2}']", :count => 0 end assert_select ".secondary-actions a[href='#{way_version_path way, 2}']", :count => 1 + assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 1 end @@ -68,6 +71,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "old_ways/show" assert_template :layout => "map" + assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1 assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0 assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 0 end From 8f1ffeb5c8de75a6e1434986665808781ebcc22a Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 17 Jan 2024 21:41:09 +0300 Subject: [PATCH 14/14] Link to details from relation version pages --- app/views/old_relations/show.html.erb | 10 ++++++---- test/controllers/old_relations_controller_test.rb | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/views/old_relations/show.html.erb b/app/views/old_relations/show.html.erb index dd52b3833..29d0b0079 100644 --- a/app/views/old_relations/show.html.erb +++ b/app/views/old_relations/show.html.erb @@ -4,11 +4,13 @@ <%= render :partial => "browse/relation", :object => @feature %> -<% unless @feature.redacted? %> -
    +
    + <% unless @feature.redacted? %> <%= link_to t("browse.download_xml"), relation_version_path(*@feature.id) %> -
    -<% end %> + · + <% end %> + <%= link_to t("browse.view_details"), relation_path(@feature.relation_id) %> +
    <% if @feature.version > 1 %> diff --git a/test/controllers/old_relations_controller_test.rb b/test/controllers/old_relations_controller_test.rb index 5b7a67bf0..311e5958a 100644 --- a/test/controllers/old_relations_controller_test.rb +++ b/test/controllers/old_relations_controller_test.rb @@ -18,6 +18,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0 end assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1 end @@ -31,6 +32,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0 end assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 1 + assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{old_relation_path relation, 2}']", :count => 1 @@ -42,6 +44,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_select "a[href='#{old_relation_path relation, 2}']", :count => 0 end assert_select ".secondary-actions a[href='#{relation_version_path relation, 2}']", :count => 1 + assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 1 end @@ -63,6 +66,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "old_relations/show" assert_template :layout => "map" + assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1 assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0 assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 0 end