From 01d48694b4ca854f1599361a0a2e4e908d48bf6d Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Thu, 22 Sep 2022 14:51:31 +0300 Subject: [PATCH] Don't show 'Download XML' link for deleted elements --- app/views/browse/feature.html.erb | 6 ++++-- test/controllers/browse_controller_test.rb | 10 +++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/views/browse/feature.html.erb b/app/views/browse/feature.html.erb index c5c26330e..86b9020a2 100644 --- a/app/views/browse/feature.html.erb +++ b/app/views/browse/feature.html.erb @@ -5,7 +5,9 @@ <%= render :partial => @type, :object => @feature %>
- <%= link_to(t("browse.download_xml"), :controller => "api/#{@type.pluralize}", :action => :show) %> - · + <% if @feature.visible? %> + <%= link_to(t("browse.download_xml"), :controller => "api/#{@type.pluralize}", :action => :show) %> + · + <% end %> <%= link_to(t("browse.view_history"), :action => "#{@type}_history") %>
diff --git a/test/controllers/browse_controller_test.rb b/test/controllers/browse_controller_test.rb index 7ad16dcd9..cde9403d0 100644 --- a/test/controllers/browse_controller_test.rb +++ b/test/controllers/browse_controller_test.rb @@ -63,7 +63,15 @@ class BrowseControllerTest < ActionDispatch::IntegrationTest end def test_read_node - browse_check :node_path, create(:node).id, "browse/feature" + node = create :node + browse_check :node_path, node.id, "browse/feature" + 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 "a[href='#{api_node_path node}']", :count => 0 end def test_read_node_history -- 2.39.5