Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: update summary page categories display to show acronym with tooltip #713

Merged
merged 4 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions app/helpers/ontologies_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,22 @@ def visibility_link(ontology)
"<a href='#{ont_url}/?p=#{page_name}'>#{link_name}</a>"
end

def show_category_name(domain)
return domain unless link?(domain)
def category_name_chip_component(domain)
text = domain.split('/').last.titleize


return render(ChipButtonComponent.new(text: text, tooltip: domain, type: "static")) unless link?(domain)


acronym = domain.split('/').last.upcase.strip
category = LinkedData::Client::Models::Category.find(acronym)
category.name ? category.name : acronym.titleize

if category.name
render ChipButtonComponent.new(text: text, tooltip: category.name, type: "static")
else
render ChipButtonComponent.new(text: text, tooltip: domain, url: domain, type: "clickable", target: '_blank')
end

end


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
- l.row do
= render FieldContainerComponent.new(label: t("ontologies.sections.metadata.categories_and_subjects")) do
= horizontal_list_container(show_ontology_domains(domains).uniq) do |v|
= render ChipButtonComponent.new(text: show_category_name(v), type: "static")
= category_name_chip_component(v)

- if @submission_latest&.pullLocation
- l.row do
Expand Down
6 changes: 3 additions & 3 deletions test/system/submission_flows_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SubmissionFlowsTest < ApplicationSystemTestCase
assert_selector '.alert-message', text: "The ontology is processing."

@new_ontology.hasDomain.each do |cat|
assert_text cat.name
assert_text cat.acronym.titleize
end


Expand Down Expand Up @@ -143,7 +143,7 @@ class SubmissionFlowsTest < ApplicationSystemTestCase
assert_text "#{ontology_2.name} (#{@new_ontology.acronym})"

selected_categories.each do |cat|
assert_text cat.name
assert_text cat.acronym.titleize
end

assert_text submission_2.URI
Expand Down Expand Up @@ -349,7 +349,7 @@ class SubmissionFlowsTest < ApplicationSystemTestCase
assert_selector '.alert-message', text: "The ontology is processing."

ontology_2.hasDomain.each do |cat|
assert_text cat.name
assert_text cat.acronym.titleize
end

refute_text 'Version IRI'
Expand Down
Loading