diff --git a/app/components/concept_details_component/concept_details_component.html.haml b/app/components/concept_details_component/concept_details_component.html.haml index 0f40704b2..6bda59040 100644 --- a/app/components/concept_details_component/concept_details_component.html.haml +++ b/app/components/concept_details_component/concept_details_component.html.haml @@ -3,29 +3,30 @@ = header %div.my-3 %div.raw-table - - if @bottom_keys.present? - .concepts-content-format + = render TabsContainerComponent.new(type: 'outline') do |c| + - if @bottom_keys.present? + - c.item(title: "Raw Data", selected: true) + - c.item_content do + - top_set, leftover_set, bottom_set = filter_properties(@top_keys, @bottom_keys, @exclude_keys, prefix_properties(@concept_properties)) + - leftover_set = convert_dates(leftover_set) + = render TableComponent.new(stripped: true) do |t| - = render TabsContainerComponent.new(type: 'outline') do |c| - - c.item(title: "Raw Data", selected: true) - - c.item_content do - - top_set, leftover_set, bottom_set = filter_properties(@top_keys, @bottom_keys, @exclude_keys, prefix_properties(@concept_properties)) - - leftover_set = convert_dates(leftover_set) - = render TableComponent.new(stripped: true) do |t| - - - row_hash_properties(top_set, @acronym).each do |row| - - t.add_row(*row) + - row_hash_properties(top_set, @acronym).each do |row| + - t.add_row(*row) - - row_hash_properties(leftover_set, @acronym).each do |row| - - t.add_row(*row) + - row_hash_properties(leftover_set, @acronym).each do |row| + - t.add_row(*row) - - sections.each do |section| - - t.row do - = section + - sections.each do |section| + - t.row do + = section - - row_hash_properties(bottom_set, @acronym).each do |row| - - t.add_row(*row) - - = content_formats(concept_id: @concept_id, acronym: @acronym, c: c) \ No newline at end of file + - row_hash_properties(bottom_set, @acronym).each do |row| + - t.add_row(*row) + - if @concept_id + - ['json', 'xml', 'ntriples', 'turtle'].each do |format| + - c.item(title: format, selected: (format=="json" && @bottom_keys.empty?)) + - c.item_content do + = render TurboFrameComponent.new(id: "resource_content_frame_#{format}", src: "/ontologies/#{@acronym}/#{CGI.escape(@concept_id)}/serialize/#{format}", loading: "lazy") \ No newline at end of file diff --git a/app/javascript/controllers/metadata_downloader_controller.js b/app/javascript/controllers/metadata_downloader_controller.js index a4aac3358..a2af7ed05 100644 --- a/app/javascript/controllers/metadata_downloader_controller.js +++ b/app/javascript/controllers/metadata_downloader_controller.js @@ -33,7 +33,6 @@ export default class extends Controller { break case 'ntriples': hljs.registerLanguage('ntriples', function (hljs) { - var URL_PATTERN = /<[^>]+>/; // Regex pattern for matching URLs in angle brackets return { case_insensitive: true, contains: [ @@ -57,7 +56,7 @@ export default class extends Controller { break case 'turtle': hljs.registerLanguage('turtle', function (hljs) { - var URL_PATTERN = /(?:<[^>]*>)|(?:https?:\/\/[^\s]+)/; + let URL_PATTERN = /(?:<[^>]*>)|(?:https?:\/\/[^\s]+)/; return { case_insensitive: true, diff --git a/app/views/collections/_collection.html.haml b/app/views/collections/_collection.html.haml index 99ea94cfa..9ab1f547a 100644 --- a/app/views/collections/_collection.html.haml +++ b/app/views/collections/_collection.html.haml @@ -1,5 +1,5 @@ = turbo_frame_tag 'collection' do - = render ConceptDetailsComponent.new(id:'collection-label', acronym: @ontology.acronym, + = render ConceptDetailsComponent.new(id:'collection-label', acronym: @ontology.acronym, concept_id: collection.id, properties: collection.properties, top_keys: %w[created modified comment note], bottom_keys: [], diff --git a/app/views/properties/_show.html.haml b/app/views/properties/_show.html.haml index b3bfd36f2..a1a5297f0 100644 --- a/app/views/properties/_show.html.haml +++ b/app/views/properties/_show.html.haml @@ -3,7 +3,7 @@ - if @property.errors = render Display::AlertComponent.new(type:'info', message: @property.errors.join) - else - = render ConceptDetailsComponent.new(id:'property-details', acronym: @acronym, + = render ConceptDetailsComponent.new(id:'property-details', acronym: @acronym, concept_id: @property.id, properties: OpenStruct.new(LinkedData::Client::Models::Property.properties_to_hash(@property).first), top_keys: [], bottom_keys: [], @@ -12,10 +12,4 @@ - t.add_row({th: t('properties.id')}, {td: link_to_with_actions(c.concept_properties[:id][:values])}) if c.concept_properties[:id][:values].present? - t.add_row({th: t('properties.preferred_name')}, {td: display_in_multiple_languages(c.concept_properties[:label][:values])}) if c.concept_properties[:label][:values].present? - t.add_row({th: t('properties.definitions')}, {td: display_in_multiple_languages(c.concept_properties[:definition][:values])}) if c.concept_properties[:definition][:values].present? - - t.add_row({th: t('properties.parent')}, {td: display_in_multiple_languages(c.concept_properties[:parents][:values])}) if c.concept_properties[:parents][:values].present? - - .property-content-format - - property = OpenStruct.new(LinkedData::Client::Models::Property.properties_to_hash(@property).first) - - = render TabsContainerComponent.new(type: 'outline') do |c| - = content_formats(concept_id: property.id, acronym: @acronym, c: c, selected_format: 'json') \ No newline at end of file + - t.add_row({th: t('properties.parent')}, {td: display_in_multiple_languages(c.concept_properties[:parents][:values])}) if c.concept_properties[:parents][:values].present? \ No newline at end of file diff --git a/app/views/schemes/_scheme.html.haml b/app/views/schemes/_scheme.html.haml index d2670af16..664cda427 100644 --- a/app/views/schemes/_scheme.html.haml +++ b/app/views/schemes/_scheme.html.haml @@ -1,6 +1,6 @@ = turbo_frame_tag 'scheme' do - if @scheme && !@scheme.empty? - = render ConceptDetailsComponent.new(id:'scheme-label', acronym: @ontology.acronym, + = render ConceptDetailsComponent.new(id:'scheme-label', acronym: @ontology.acronym, concept_id: @scheme.id, properties: scheme.properties, top_keys: %w[description comment], bottom_keys: %w[disjoint subclass is_a has_part],