diff --git a/modules/wikis/app/components/wikis/collapsible_page_links_component.rb b/modules/wikis/app/components/wikis/collapsible_page_links_component.rb index 51d51339952..4985ce4a46a 100644 --- a/modules/wikis/app/components/wikis/collapsible_page_links_component.rb +++ b/modules/wikis/app/components/wikis/collapsible_page_links_component.rb @@ -33,6 +33,8 @@ module Wikis include ApplicationHelper include OpPrimer::ComponentHelpers + Entry = Data.define(:result, :badge) + attr_reader :heading alias_method :page_links, :model diff --git a/modules/wikis/app/components/wikis/page_link_component.html.erb b/modules/wikis/app/components/wikis/page_link_component.html.erb index 5f20220e00a..97c07951068 100644 --- a/modules/wikis/app/components/wikis/page_link_component.html.erb +++ b/modules/wikis/app/components/wikis/page_link_component.html.erb @@ -37,13 +37,19 @@ See COPYRIGHT and LICENSE files for more details. %> <%= - render(Primer::Alpha::StackItem.new(grow: true, classes: "ellipsis")) do - if error? - concat render(Primer::Beta::Text.new(color: :muted)) { page_title } - else - concat render(Primer::Beta::Link.new(href: page_href, scheme: :primary)) { page_title } + render(Primer::Alpha::StackItem.new(grow: true)) do + render(Primer::Alpha::Stack.new(direction: :horizontal, gap: :condensed, align: :center)) do + concat( + render(Primer::Alpha::StackItem.new(grow: true, classes: "ellipsis")) do + if error? + render(Primer::Beta::Text.new(color: :muted)) { page_title } + else + render(Primer::Beta::Link.new(href: page_href, scheme: :primary)) { page_title } + end + end + ) + concat(render(Primer::Beta::Label.new(scheme: :secondary)) { badge }) if badge.present? end - concat render(Primer::Beta::Label.new(scheme: :secondary, ml: 2)) { badge } if badge.present? end %> diff --git a/modules/wikis/app/components/wikis/work_package_wikis_tab_component.rb b/modules/wikis/app/components/wikis/work_package_wikis_tab_component.rb index be84b97e1cc..460b1030c60 100644 --- a/modules/wikis/app/components/wikis/work_package_wikis_tab_component.rb +++ b/modules/wikis/app/components/wikis/work_package_wikis_tab_component.rb @@ -36,8 +36,6 @@ module Wikis TURBO_FRAME_ID = "work-package-wikis-tab-content" - PageLinkEntry = Data.define(:result, :badge) - alias_method :work_package, :model def providers @@ -50,7 +48,7 @@ module Wikis def inline_page_links @inline_page_links ||= page_link_service.inline_page_link_infos_for(linkable: work_package) - .map { PageLinkEntry.new(result: it, badge: nil) } + .map { CollapsiblePageLinksComponent::Entry.new(result: it, badge: nil) } end def referencing_wiki_pages @@ -62,12 +60,12 @@ module Wikis def referenced_page_entries page_link_service.referencing_wiki_page_infos_for(linkable: work_package) - .map { PageLinkEntry.new(result: it, badge: t(".badge_as_parent")) } + .map { CollapsiblePageLinksComponent::Entry.new(result: it, badge: t(".badge_as_parent")) } end def mentioning_page_entries page_link_service.mentioning_wiki_page_infos_for(linkable: work_package) - .map { PageLinkEntry.new(result: it, badge: nil) } + .map { CollapsiblePageLinksComponent::Entry.new(result: it, badge: nil) } end def page_link_service