From ba2c75641d3de82fc4cda78dc864dc690b860b6d Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Mon, 19 Feb 2024 03:32:09 +0300 Subject: [PATCH] Move element title to changeset/relation list item --- app/helpers/browse_helper.rb | 6 +++--- app/views/browse/_relation_member.html.erb | 2 +- app/views/browse/changeset.html.erb | 6 +++--- test/helpers/browse_helper_test.rb | 12 ++++++------ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/helpers/browse_helper.rb b/app/helpers/browse_helper.rb index 29f243cf4..3c9d4d092 100644 --- a/app/helpers/browse_helper.rb +++ b/app/helpers/browse_helper.rb @@ -1,6 +1,6 @@ module BrowseHelper def element_single_current_link(type, object, url) - link_to url, { :class => element_class(type, object), :title => link_title(object), :rel => (link_follow(object) if type == "node") } do + link_to url, { :class => element_class(type, object), :title => element_title(object), :rel => (link_follow(object) if type == "node") } do element_strikethrough object do printable_name object end @@ -8,7 +8,7 @@ module BrowseHelper end def element_list_item(type, object, &block) - tag.li :class => element_class(type, object) do + tag.li :class => element_class(type, object), :title => element_title(object) do element_strikethrough object, &block end end @@ -55,7 +55,7 @@ module BrowseHelper classes.join(" ") end - def link_title(object) + def element_title(object) if object.redacted? "" else diff --git a/app/views/browse/_relation_member.html.erb b/app/views/browse/_relation_member.html.erb index 93c33b8a7..56b8f154f 100644 --- a/app/views/browse/_relation_member.html.erb +++ b/app/views/browse/_relation_member.html.erb @@ -1,4 +1,4 @@ -<% 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) } +<% linked_name = link_to printable_name(relation_member.member), { :controller => :browse, :action => relation_member.member_type.downcase, :id => relation_member.member_id.to_s }, { :rel => link_follow(relation_member.member) } type_str = t ".type.#{relation_member.member_type.downcase}" %> <%= element_list_item relation_member.member_type.downcase, relation_member.member do %> <%= if relation_member.member_role.blank? diff --git a/app/views/browse/changeset.html.erb b/app/views/browse/changeset.html.erb index eac8bd472..d2ccff44d 100644 --- a/app/views/browse/changeset.html.erb +++ b/app/views/browse/changeset.html.erb @@ -94,7 +94,7 @@ @@ -105,7 +105,7 @@ @@ -116,7 +116,7 @@ diff --git a/test/helpers/browse_helper_test.rb b/test/helpers/browse_helper_test.rb index e26d0f407..06d5f3d53 100644 --- a/test/helpers/browse_helper_test.rb +++ b/test/helpers/browse_helper_test.rb @@ -92,7 +92,7 @@ class BrowseHelperTest < ActionView::TestCase assert_equal "node", element_class("node", node_v1) end - def test_link_title + def test_element_title node = create(:node, :with_history, :version => 2) node_v1 = node.old_nodes.find_by(:version => 1) node_v2 = node.old_nodes.find_by(:version => 2) @@ -102,12 +102,12 @@ class BrowseHelperTest < ActionView::TestCase add_old_tags_selection(node_v2) add_old_tags_selection(node_v1) - assert_equal "", link_title(create(:node)) - assert_equal "", link_title(create(:node, :deleted)) + assert_equal "", element_title(create(:node)) + assert_equal "", element_title(create(:node, :deleted)) - assert_equal "building=yes, shop=gift, and tourism=museum", link_title(node) - assert_equal "building=yes, shop=gift, and tourism=museum", link_title(node_v2) - assert_equal "", link_title(node_v1) + assert_equal "building=yes, shop=gift, and tourism=museum", element_title(node) + assert_equal "building=yes, shop=gift, and tourism=museum", element_title(node_v2) + assert_equal "", element_title(node_v1) end def test_icon_tags -- 2.39.5