Skip to content

Commit d53a39c

Browse files
committed
[#73909] removed wiki tab global blank slate
- resolved post merge conflict errors - improve counting of page links in tab
1 parent 3292c37 commit d53a39c

5 files changed

Lines changed: 25 additions & 33 deletions

File tree

modules/wikis/app/components/wikis/work_package_wikis_tab_component.html.erb

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,21 @@ See COPYRIGHT and LICENSE files for more details.
3131
content_tag("turbo-frame", id: "work-package-wikis-tab-content") do
3232
component_wrapper do
3333
flex_layout(test_selector: "op-work-package-wikis-tab-container") do |container|
34-
if providers.empty?
35-
container.with_row do
36-
render(Primer::Beta::Blankslate.new(border: false)) do |blankslate|
37-
blankslate.with_heading(tag: :h2).with_content(t(".blankslate.heading"))
38-
blankslate.with_description { t(".blankslate.description") }
39-
end
40-
end
41-
else
42-
providers.each do |provider|
43-
container.with_row(mb: 3) do
44-
render(::Wikis::RelationPageLinksComponent.new(provider, work_package:))
45-
end
34+
providers.each do |provider|
35+
container.with_row(mb: 3) do
36+
render(::Wikis::RelationPageLinksComponent.new(provider, work_package:))
4637
end
38+
end
4739

48-
if inline_page_links.any?
49-
container.with_row(mb: 3) do
50-
render(::Wikis::CollapsiblePageLinksComponent.new(inline_page_links, heading: t(".inline_page_links")))
51-
end
40+
if inline_page_links.any?
41+
container.with_row(mb: 3) do
42+
render(::Wikis::CollapsiblePageLinksComponent.new(inline_page_links, heading: t(".inline_page_links")))
5243
end
44+
end
5345

54-
if referencing_wiki_pages.any?
55-
container.with_row do
56-
render(::Wikis::CollapsiblePageLinksComponent.new(referencing_wiki_pages, heading: t(".referencing_pages")))
57-
end
46+
if referencing_wiki_pages.any?
47+
container.with_row do
48+
render(::Wikis::CollapsiblePageLinksComponent.new(referencing_wiki_pages, heading: t(".referencing_pages")))
5849
end
5950
end
6051
end

modules/wikis/app/services/wikis/adapters/providers/internal/queries/page_info.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ module Providers
3434
module Internal
3535
module Queries
3636
class PageInfo < BaseQuery
37-
def handle_query(identifier:)
37+
def call(input_data)
3838
# TODO: should we accept implicit User.current or do we want to pass in a user explicitly?
39-
wiki_page = WikiPage.visible.find_by(id: identifier)
39+
wiki_page = WikiPage.visible.find_by(id: input_data.identifier)
4040
return failure(code: :not_found) if wiki_page.nil?
4141

4242
success(
4343
Results::PageInfo.new(
44-
identifier:,
45-
provider: InternalProvider.first,
44+
identifier: input_data.identifier,
45+
provider:,
4646
title: wiki_page.title,
4747
href: url_for(only_path: true,
4848
controller: "/wiki",

modules/wikis/app/services/wikis/adapters/providers/xwiki/queries/page_info.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module Providers
3434
module XWiki
3535
module Queries
3636
class PageInfo < BaseQuery
37-
def handle_query(identifier:)
37+
def call(input_data)
3838
title = [
3939
"What makes XWiki special?",
4040
"API documentation",
@@ -43,8 +43,8 @@ def handle_query(identifier:)
4343

4444
success(
4545
Results::PageInfo.new(
46-
identifier:,
47-
provider: XWikiProvider.first,
46+
identifier: input_data.identifier,
47+
provider:,
4848
title:,
4949
href: "#"
5050
)

modules/wikis/app/services/wikis/page_link_service.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ def count(linkable)
4141
.merge(Provider.enabled)
4242
.where(linkable:)
4343
.count
44+
45+
relation_page_links = Provider.enabled.sum { |provider| relation_page_link_infos_for(provider:, linkable:).size }
46+
47+
relation_page_links +
48+
inline_page_link_infos_for(linkable:).size +
49+
referencing_wiki_page_infos_for(linkable:).size
4450
end
4551

4652
def relation_page_link_infos_for(provider:, linkable:)
@@ -66,7 +72,7 @@ def referencing_wiki_page_infos_for(linkable:)
6672
if linkable.id % 2 == 0
6773
InternalProvider.enabled.each do |provider|
6874
random_wiki_page = WikiPage.order("RANDOM()").limit(1).first
69-
referenced_in << page_info(provider: , identifier: random_wiki_page.id.to_s)
75+
referenced_in << page_info(provider:, identifier: random_wiki_page.id.to_s)
7076
end
7177
end
7278

modules/wikis/config/locales/en.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ en:
3333
work_package_wikis_tab_component:
3434
inline_page_links: Inline page links
3535
referencing_pages: Referenced in
36-
blankslate:
37-
heading: No wiki providers enabled
38-
description: >-
39-
There are no wiki providers configured and enabled. Wiki page links can only be added for enabled providers.
40-
To add wiki providers, visit Administration > Wikis.
4136
page_link_component:
4237
remove: Remove page link
4338
relation_page_links_component:

0 commit comments

Comments
 (0)