]> git.openstreetmap.org Git - rails.git/commitdiff
Make browse not found pages consistent
authorAnton Khorev <tony29@yandex.ru>
Mon, 6 Jan 2025 17:15:08 +0000 (20:15 +0300)
committerAnton Khorev <tony29@yandex.ru>
Mon, 6 Jan 2025 17:15:57 +0000 (20:15 +0300)
19 files changed:
app/controllers/old_nodes_controller.rb
app/controllers/old_relations_controller.rb
app/controllers/old_ways_controller.rb
app/views/browse/not_found.html.erb
app/views/changesets/_not_found_message.html.erb [new file with mode: 0644]
app/views/nodes/_not_found_message.html.erb [new file with mode: 0644]
app/views/notes/_not_found_message.html.erb [new file with mode: 0644]
app/views/old_nodes/_not_found_message.html.erb [new file with mode: 0644]
app/views/old_nodes/not_found.html.erb [deleted file]
app/views/old_relations/_not_found_message.html.erb [new file with mode: 0644]
app/views/old_relations/not_found.html.erb [deleted file]
app/views/old_ways/_not_found_message.html.erb [new file with mode: 0644]
app/views/old_ways/not_found.html.erb [deleted file]
app/views/relations/_not_found_message.html.erb [new file with mode: 0644]
app/views/ways/_not_found_message.html.erb [new file with mode: 0644]
config/locales/en.yml
test/controllers/old_nodes_controller_test.rb
test/controllers/old_relations_controller_test.rb
test/controllers/old_ways_controller_test.rb

index 288322eea4155e40947ffe7902b9f3c0d593e3e6..3b187e4abff31d2d3c74574b9839073777a5b25d 100644 (file)
@@ -10,6 +10,6 @@ class OldNodesController < OldElementsController
     @type = "node"
     @feature = OldNode.preload(:old_tags, :changeset => [:changeset_tags, :user]).find([params[:id], params[:version]])
   rescue ActiveRecord::RecordNotFound
     @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
+    render "browse/not_found", :status => :not_found
   end
 end
   end
 end
index 8c73eba24d40fad552b78e47ec15c6900ea09896..ec256d6af680caaf10b39f4b20c453d1885b16da 100644 (file)
@@ -10,6 +10,6 @@ class OldRelationsController < OldElementsController
     @type = "relation"
     @feature = OldRelation.preload(:old_tags, :changeset => [:changeset_tags, :user], :old_members => :member).find([params[:id], params[:version]])
   rescue ActiveRecord::RecordNotFound
     @type = "relation"
     @feature = OldRelation.preload(:old_tags, :changeset => [:changeset_tags, :user], :old_members => :member).find([params[:id], params[:version]])
   rescue ActiveRecord::RecordNotFound
-    render :action => "not_found", :status => :not_found
+    render "browse/not_found", :status => :not_found
   end
 end
   end
 end
index e7b0fed6edf3e51f0dd4e9ae619f1b1874f26a7b..1b3ebd747147d18e1502b51a6dd5eac08550499a 100644 (file)
@@ -10,6 +10,6 @@ class OldWaysController < OldElementsController
     @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
     @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
+    render "browse/not_found", :status => :not_found
   end
 end
   end
 end
index 36ee4c883769ee3b28da09693c025bb499ffb7a5..47b299e0310f6ed3baacd6138edfc95e29f8e314 100644 (file)
@@ -2,6 +2,4 @@
 
 <%= render "sidebar_header", :title => t(".title") %>
 
 
 <%= render "sidebar_header", :title => t(".title") %>
 
-<div>
-  <p><%= t ".sorry", :type => t(".type.#{@type}"), :id => params[:id] %>
-</div>
+<%= render "not_found_message" %>
diff --git a/app/views/changesets/_not_found_message.html.erb b/app/views/changesets/_not_found_message.html.erb
new file mode 100644 (file)
index 0000000..9297f3b
--- /dev/null
@@ -0,0 +1,3 @@
+<div>
+  <p><%= t ".sorry", :id => params[:id] %></p>
+</div>
diff --git a/app/views/nodes/_not_found_message.html.erb b/app/views/nodes/_not_found_message.html.erb
new file mode 100644 (file)
index 0000000..9297f3b
--- /dev/null
@@ -0,0 +1,3 @@
+<div>
+  <p><%= t ".sorry", :id => params[:id] %></p>
+</div>
diff --git a/app/views/notes/_not_found_message.html.erb b/app/views/notes/_not_found_message.html.erb
new file mode 100644 (file)
index 0000000..9297f3b
--- /dev/null
@@ -0,0 +1,3 @@
+<div>
+  <p><%= t ".sorry", :id => params[:id] %></p>
+</div>
diff --git a/app/views/old_nodes/_not_found_message.html.erb b/app/views/old_nodes/_not_found_message.html.erb
new file mode 100644 (file)
index 0000000..402905a
--- /dev/null
@@ -0,0 +1,7 @@
+<div>
+  <% if params[:version] %>
+    <p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
+  <% else %>
+    <p><%= t "nodes.not_found_message.sorry", :id => params[:id] %></p>
+  <% end %>
+</div>
diff --git a/app/views/old_nodes/not_found.html.erb b/app/views/old_nodes/not_found.html.erb
deleted file mode 100644 (file)
index 1ee5d9d..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<% set_title(t("browse.not_found.title")) %>
-
-<%= render "sidebar_header", :title => t("browse.not_found.title") %>
-
-<div>
-  <p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
-</div>
diff --git a/app/views/old_relations/_not_found_message.html.erb b/app/views/old_relations/_not_found_message.html.erb
new file mode 100644 (file)
index 0000000..a4598eb
--- /dev/null
@@ -0,0 +1,7 @@
+<div>
+  <% if params[:version] %>
+    <p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
+  <% else %>
+    <p><%= t "relations.not_found_message.sorry", :id => params[:id] %></p>
+  <% end %>
+</div>
diff --git a/app/views/old_relations/not_found.html.erb b/app/views/old_relations/not_found.html.erb
deleted file mode 100644 (file)
index 1ee5d9d..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<% set_title(t("browse.not_found.title")) %>
-
-<%= render "sidebar_header", :title => t("browse.not_found.title") %>
-
-<div>
-  <p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
-</div>
diff --git a/app/views/old_ways/_not_found_message.html.erb b/app/views/old_ways/_not_found_message.html.erb
new file mode 100644 (file)
index 0000000..09c97ac
--- /dev/null
@@ -0,0 +1,7 @@
+<div>
+  <% if params[:version] %>
+    <p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
+  <% else %>
+    <p><%= t "ways.not_found_message.sorry", :id => params[:id] %></p>
+  <% end %>
+</div>
diff --git a/app/views/old_ways/not_found.html.erb b/app/views/old_ways/not_found.html.erb
deleted file mode 100644 (file)
index 1ee5d9d..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<% set_title(t("browse.not_found.title")) %>
-
-<%= render "sidebar_header", :title => t("browse.not_found.title") %>
-
-<div>
-  <p><%= t ".sorry", :id => params[:id], :version => params[:version] %></p>
-</div>
diff --git a/app/views/relations/_not_found_message.html.erb b/app/views/relations/_not_found_message.html.erb
new file mode 100644 (file)
index 0000000..9297f3b
--- /dev/null
@@ -0,0 +1,3 @@
+<div>
+  <p><%= t ".sorry", :id => params[:id] %></p>
+</div>
diff --git a/app/views/ways/_not_found_message.html.erb b/app/views/ways/_not_found_message.html.erb
new file mode 100644 (file)
index 0000000..9297f3b
--- /dev/null
@@ -0,0 +1,3 @@
+<div>
+  <p><%= t ".sorry", :id => params[:id] %></p>
+</div>
index b60549894ebb131546284f2c29e69745141ef598..fcaf6ddfe8ddd0f27a3b5d2256f7adb3240624cc 100644 (file)
@@ -354,13 +354,6 @@ en:
       entry_role_html: "%{relation_name} (as %{relation_role})"
     not_found:
       title: Not Found
       entry_role_html: "%{relation_name} (as %{relation_role})"
     not_found:
       title: Not Found
-      sorry: "Sorry, %{type} #%{id} could not be found."
-      type:
-        node: node
-        way: way
-        relation: relation
-        changeset: changeset
-        note: note
     timeout:
       title: Timeout Error
       sorry: "Sorry, the data for the %{type} with the id %{id} took too long to retrieve."
     timeout:
       title: Timeout Error
       sorry: "Sorry, the data for the %{type} with the id %{id} took too long to retrieve."
@@ -409,26 +402,32 @@ en:
       view_redacted_data: "View Redacted Data"
       view_redaction_message: "View Redaction Message"
   nodes:
       view_redacted_data: "View Redacted Data"
       view_redaction_message: "View Redaction Message"
   nodes:
+    not_found_message:
+      sorry: "Sorry, node #%{id} could not be found."
     timeout:
       sorry: "Sorry, the data for the node with the id %{id} took too long to retrieve."
   old_nodes:
     timeout:
       sorry: "Sorry, the data for the node with the id %{id} took too long to retrieve."
   old_nodes:
-    not_found:
+    not_found_message:
       sorry: "Sorry, node #%{id} version %{version} could not be found."
     timeout:
       sorry: "Sorry, the history of the node with the id %{id} took too long to retrieve."
   ways:
       sorry: "Sorry, node #%{id} version %{version} could not be found."
     timeout:
       sorry: "Sorry, the history of the node with the id %{id} took too long to retrieve."
   ways:
+    not_found_message:
+      sorry: "Sorry, way #%{id} could not be found."
     timeout:
       sorry: "Sorry, the data for the way with the id %{id} took too long to retrieve."
   old_ways:
     timeout:
       sorry: "Sorry, the data for the way with the id %{id} took too long to retrieve."
   old_ways:
-    not_found:
+    not_found_message:
       sorry: "Sorry, way #%{id} version %{version} could not be found."
     timeout:
       sorry: "Sorry, the history of the way with the id %{id} took too long to retrieve."
   relations:
       sorry: "Sorry, way #%{id} version %{version} could not be found."
     timeout:
       sorry: "Sorry, the history of the way with the id %{id} took too long to retrieve."
   relations:
+    not_found_message:
+      sorry: "Sorry, relation #%{id} could not be found."
     timeout:
       sorry: "Sorry, the data for the relation with the id %{id} took too long to retrieve."
   old_relations:
     timeout:
       sorry: "Sorry, the data for the relation with the id %{id} took too long to retrieve."
   old_relations:
-    not_found:
+    not_found_message:
       sorry: "Sorry, relation #%{id} version %{version} could not be found."
     timeout:
       sorry: "Sorry, the history of the relation with the id %{id} took too long to retrieve."
       sorry: "Sorry, relation #%{id} version %{version} could not be found."
     timeout:
       sorry: "Sorry, the history of the relation with the id %{id} took too long to retrieve."
@@ -504,6 +503,8 @@ en:
       ways_paginated: "Ways (%{x}-%{y} of %{count})"
       relations: "Relations (%{count})"
       relations_paginated: "Relations (%{x}-%{y} of %{count})"
       ways_paginated: "Ways (%{x}-%{y} of %{count})"
       relations: "Relations (%{count})"
       relations_paginated: "Relations (%{x}-%{y} of %{count})"
+    not_found_message:
+      sorry: "Sorry, changeset #%{id} could not be found."
     timeout:
       sorry: "Sorry, the list of changesets you requested took too long to retrieve."
   dashboards:
     timeout:
       sorry: "Sorry, the list of changesets you requested took too long to retrieve."
   dashboards:
@@ -3096,6 +3097,8 @@ en:
       showing_page: "Page %{page}"
       next: "Next"
       previous: "Previous"
       showing_page: "Page %{page}"
       next: "Next"
       previous: "Previous"
+    not_found_message:
+      sorry: "Sorry, note #%{id} could not be found."
   javascripts:
     close: Close
     share:
   javascripts:
     close: Close
     share:
index dea54631628bab70db2d95b0f803f435cea4dbae..8e3a14ab6c8717a5860dbb7a1d8ed2284ce9bad2 100644 (file)
@@ -213,7 +213,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest
   def test_not_found
     get old_node_path(0, 0)
     assert_response :not_found
   def test_not_found
     get old_node_path(0, 0)
     assert_response :not_found
-    assert_template "old_nodes/not_found"
+    assert_template "browse/not_found"
     assert_template :layout => "map"
     assert_select "#sidebar_content", /node #0 version 0 could not be found/
   end
     assert_template :layout => "map"
     assert_select "#sidebar_content", /node #0 version 0 could not be found/
   end
index 395c89c2c93a01a91e8002c30c3465721ba37c2b..3ede1842b5d35137602c92dde30a3ddf1e83f9b2 100644 (file)
@@ -172,7 +172,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
   def test_not_found
     get old_relation_path(0, 0)
     assert_response :not_found
   def test_not_found
     get old_relation_path(0, 0)
     assert_response :not_found
-    assert_template "old_relations/not_found"
+    assert_template "browse/not_found"
     assert_template :layout => "map"
     assert_select "#sidebar_content", /relation #0 version 0 could not be found/
   end
     assert_template :layout => "map"
     assert_select "#sidebar_content", /relation #0 version 0 could not be found/
   end
index 57be1943f2241422938c4654e3de732aaef4fd6b..c7b383202bb45081f2396b4a916e93108f9ab606 100644 (file)
@@ -177,7 +177,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest
   def test_not_found
     get old_way_path(0, 0)
     assert_response :not_found
   def test_not_found
     get old_way_path(0, 0)
     assert_response :not_found
-    assert_template "old_ways/not_found"
+    assert_template "browse/not_found"
     assert_template :layout => "map"
     assert_select "#sidebar_content", /way #0 version 0 could not be found/
   end
     assert_template :layout => "map"
     assert_select "#sidebar_content", /way #0 version 0 could not be found/
   end