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: Ontology description text display when it is a complex object not a string #273

Merged
merged 4 commits into from
Jun 15, 2023
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
12 changes: 12 additions & 0 deletions app/helpers/ontologies_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,18 @@ def languages_options(submission = @submission || @submission_latest)
options_for_select(submission_lang)
end

def dispaly_complex_text(definitions)
html = ""
definitions.each do |definition|
if definition.is_a?(String)
html+= "<p>" + definition + "</p>"
elsif definition.respond_to?(:uri) && definition.uri
html+= "<p>" + definition.uri + "</p>"
end
end
return html.html_safe
end

private

def submission_languages(submission = @submission)
Expand Down
2 changes: 1 addition & 1 deletion app/views/concepts/_details.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
%tr
%td{nowrap: ""}= t('ontology_details.concept.definitions')
%td
= @concept.definition.join(" ")
= dispaly_complex_text(@concept.definition)
- if @concept.obsolete?
%tr
%td{nowrap: ""}= t('ontology_details.concept.obsolete')
Expand Down