From 846cb094660a9297eca8567e9cc098e3d7f28988 Mon Sep 17 00:00:00 2001 From: Syphax Bouazzouni Date: Mon, 24 Jul 2023 04:12:55 +0200 Subject: [PATCH] update collection, concept, label_xl and scheme views with the new concept details component --- app/views/collections/_collection.html.haml | 26 ++---- app/views/concepts/_details.html.haml | 90 +++++++++------------ app/views/label_xl/show.html.haml | 19 +---- app/views/schemes/_scheme.html.haml | 19 +---- 4 files changed, 53 insertions(+), 101 deletions(-) diff --git a/app/views/collections/_collection.html.haml b/app/views/collections/_collection.html.haml index a3310e7264..580c0b74e6 100644 --- a/app/views/collections/_collection.html.haml +++ b/app/views/collections/_collection.html.haml @@ -4,24 +4,8 @@ top_keys: %w[created modified comment note], bottom_keys: [], exclude_keys: %w[member]) do |c| - = c.header do - %tr - %td.label - ID - %td - %p - = collection["@id"] - %tr - %td{nowrap: ""} Preferred Name - %td - %p= get_collection_label(collection) - %tr - %td{nowrap: ""} Members count - %td - %p= collection["memberCount"] - %tr - %td.label - Type - %td - %p - = collection["@type"] \ No newline at end of file + - c.header(stripped: true) do |t| + - t.add_row({th: 'ID'}, {td: collection["@id"]}) + - t.add_row({th: 'Preferred Name'}, {td: get_collection_label(collection)}) + - t.add_row({th: 'Members count'}, {td: collection["memberCount"]}) + - t.add_row({th: 'Type'}, {td: collection["@type"]}) \ No newline at end of file diff --git a/app/views/concepts/_details.html.haml b/app/views/concepts/_details.html.haml index 4a9fb9c3c3..a8adbf64d8 100644 --- a/app/views/concepts/_details.html.haml +++ b/app/views/concepts/_details.html.haml @@ -1,73 +1,63 @@ = turbo_frame_tag 'concept_details' do - schemes_keys = %w[hasTopConcept topConceptOf] - label_xl_set = %w[skos-xl#prefLabel skos-xl#altLabel skos-xl#hiddenLabel] - + - binding.pry - if @concept.prefLabel.nil? %div.py-3.px-2 = render(AlertMessageComponent.new(message: t('ontology_details.concept.no_preferred_name_for_selected_language'), type: "warning", closeable: true)) - + = render ConceptDetailsComponent.new(id:'concept-details', acronym: @ontology.acronym, properties: @concept.properties, top_keys: %w[description comment], bottom_keys: %w[disjoint subclass is_a has_part], exclude_keys: schemes_keys + label_xl_set + ['inScheme']) do |c| - - - c.header do - %tr - %td{nowrap: ""}= t('ontology_details.concept.id') - %td - = @concept.id - %tr - %td{nowrap: ""}= t('ontology_details.concept.preferred_name') - %td - = @concept.prefLabel({:use_html => true}).html_safe + + - c.header(stripped: true) do |t| + - t.add_row({th: t('ontology_details.concept.id')}, {td:@concept.id}) + - t.add_row({th: t('ontology_details.concept.preferred_name')}, {td:@concept.prefLabel({:use_html => true}).html_safe}) + - unless @concept.synonym.nil? || @concept.synonym.empty? - %tr - %td{nowrap: ""}= t('ontology_details.concept.synonyms') - %td - - for synonym in @concept.synonym - = synonym - %td - %div.synonym-change-request - = add_synonym_button - = remove_synonym_button - - + - t.add_row({th: t('ontology_details.concept.synonyms')}) do |h| + - h.td do + %div.d-flex + %div + - for synonym in @concept.synonym + = synonym + %div.synonym-change-request + = add_synonym_button + = remove_synonym_button + + - unless @concept.definition.nil? || @concept.definition.empty? - %tr - %td{nowrap: ""}= t('ontology_details.concept.definitions') - %td - = dispaly_complex_text(@concept.definition) + - t.add_row({th: t('ontology_details.concept.definitions')}, {td:dispaly_complex_text(@concept.definition)}) + - if @concept.obsolete? - %tr - %td{nowrap: ""}= t('ontology_details.concept.obsolete') - %td - true + - t.add_row({th: t('ontology_details.concept.obsolete')}, {td: 'true'}) + - if skos? - unless @concept.memberOf.nil? || @concept.memberOf.empty? - %tr - %td{nowrap: ""}= t('ontology_details.concept.member_of') - %td + - t.add_row({th: t('ontology_details.concept.member_of')}) do |h| + - h.td do %div.my-1 - @concept.memberOf.each do |v| = raw get_link_for_collection_ajax(v, @ontology.acronym, '_blank') + - unless @concept.inScheme.nil? || @concept.inScheme.empty? - %tr - %td{nowrap: ""}= t('ontology_details.concept.in_schemes') - %td + - t.add_row({th: t('ontology_details.concept.in_schemes')}) do |h| + - h.td do %div.my-1 - @concept.inScheme.each do |v| = raw get_link_for_scheme_ajax(v, @ontology.acronym, '_blank') - %tr - %td{nowrap: ""}= t('ontology_details.concept.type') - %td - = @concept.type - - - scheme_set = c.properties_set_by_keys(schemes_keys, c.concept_properties) - - label_xl_set = c.properties_set_by_keys(label_xl_set, c.concept_properties) - - c.section do - = c.render_properties(scheme_set, c.concept_properties) do |v| - - get_link_for_scheme_ajax(v, @ontology.acronym, '_blank') - - c.section do - = c.render_properties(label_xl_set, c.concept_properties) do |v| - - get_link_for_label_xl_ajax(v, @ontology.acronym, @concept.id) + + - t.add_row({th: t('ontology_details.concept.type')} , {td: @concept.type}) + + + - c.add_sections(schemes_keys) do |v| + - get_link_for_scheme_ajax(v, @ontology.acronym, '_blank') + + - c.add_sections(label_xl_set) do |v| + - get_link_for_label_xl_ajax(v, @ontology.acronym, @concept.id) + + + + diff --git a/app/views/label_xl/show.html.haml b/app/views/label_xl/show.html.haml index 7b94c49718..424b9e4e29 100644 --- a/app/views/label_xl/show.html.haml +++ b/app/views/label_xl/show.html.haml @@ -5,18 +5,7 @@ top_keys: %w[description comment], bottom_keys: %w[disjoint subclass is_a has_part], exclude_keys: []) do |c| - - c.header do - %tr - %td.label - ID - %td - %p - = @label_xl["@id"] - %tr - %td{nowrap: ""} Preferred Name - %td - %p= get_label_xl_label(@label_xl) - %tr - %td{nowrap: ""} Type - %td - %p= @label_xl["@type"] + - c.header(stripped: true) do |t| + - t.add_row({th: 'ID'}, {td: @label_xl["@id"]}) + - t.add_row({th: 'Preferred Name'}, {td: get_label_xl_label(@label_xl)}) + - t.add_row({th: 'Type'}, {td: @label_xl["@type"]}) diff --git a/app/views/schemes/_scheme.html.haml b/app/views/schemes/_scheme.html.haml index 91607bf91e..2fcf310c95 100644 --- a/app/views/schemes/_scheme.html.haml +++ b/app/views/schemes/_scheme.html.haml @@ -5,19 +5,8 @@ top_keys: %w[description comment], bottom_keys: %w[disjoint subclass is_a has_part], exclude_keys: []) do |c| - = c.header do - %tr - %td.label - ID - %td - %p= scheme["@id"] - %tr - %td{nowrap: ""} Preferred Name - %td - %p= get_scheme_label(scheme) - %tr - %td.label - Type - %td - %p= scheme["@type"] + - c.header(stripped: true) do |t| + - t.add_row({th: 'ID'} , {td: scheme["@id"]}) + - t.add_row({th: 'Preferred Name'} , {td: get_scheme_label(scheme)}) + - t.add_row({th: 'Type'} , {td: scheme["@type"]})