Skip to content

Commit

Permalink
update collection, concept, label_xl and scheme views with the new co…
Browse files Browse the repository at this point in the history
…ncept details component
  • Loading branch information
syphax-bouazzouni committed Jul 24, 2023
1 parent 2bab64d commit 846cb09
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 101 deletions.
26 changes: 5 additions & 21 deletions app/views/collections/_collection.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
- 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"]})
90 changes: 40 additions & 50 deletions app/views/concepts/_details.html.haml
Original file line number Diff line number Diff line change
@@ -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)




19 changes: 4 additions & 15 deletions app/views/label_xl/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]})
19 changes: 4 additions & 15 deletions app/views/schemes/_scheme.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]})

0 comments on commit 846cb09

Please sign in to comment.