Skip to content

Commit

Permalink
Fix: update summary page categories display to show acronym with tool…
Browse files Browse the repository at this point in the history
…tip (#713)

* update summary page categories display to show acronym with tooltip

* fix submission flow system tests after changing their display

* make show_category return the full domain if not a category

* update the show category name to use clickable state if not a category and is a link
  • Loading branch information
syphax-bouazzouni authored Jul 19, 2024
1 parent 03a3e07 commit e51977f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
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

0 comments on commit e51977f

Please sign in to comment.