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

Feature: Add Details sub-tab and API cotextual button in Properties, Instances, Schemes, and Collections #754

Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
afe236e
Merge pull request #737 from ontoportal-lirmm/development
syphax-bouazzouni Sep 10, 2024
4cdc1aa
limite taxonomy card ontologies chips number and add a see all button
Bilelkihal Sep 11, 2024
2733132
Properties layout harmonization
muhammedBkf Sep 11, 2024
96047f9
Instances layout harmonization
muhammedBkf Sep 11, 2024
ab524a7
fix: resolve issues related to properties raised in code review
muhammedBkf Sep 13, 2024
05a0ba6
fix: resolve issues related to instances raised in code review
muhammedBkf Sep 13, 2024
dc0fd3f
adding subtab "Details" and API cotextual button to `Schemes`
muhammedBkf Sep 13, 2024
4a802ff
adding subtab "Details" and API cotextual button to `Collections`
muhammedBkf Sep 13, 2024
60010b6
Using unless instead of if in sections controllers
muhammedBkf Sep 21, 2024
f0cd6c4
Adding new section tab component and using it in Properties, Instance…
muhammedBkf Sep 21, 2024
4760f31
display first scheme if none are selected
muhammedBkf Sep 21, 2024
650f9cd
Merge branch 'development' into enhancement/Properties_Instances_layout
syphax-bouazzouni Sep 29, 2024
a117e4b
move the created tabs_section component to rails helpers
syphax-bouazzouni Sep 30, 2024
dbbc76f
fix schemes and collections shows not selecting the right object
syphax-bouazzouni Sep 30, 2024
f5a5a05
remove details partials moving the content directly to the show files
syphax-bouazzouni Sep 30, 2024
601e8ac
remove unnecessary call in the properties show to find the ontology
syphax-bouazzouni Sep 30, 2024
bca4458
use the correct partial in the schemes controller show action
syphax-bouazzouni Sep 30, 2024
fa2ae4e
put the tab item helper in the component helpers as generic
syphax-bouazzouni Sep 30, 2024
f22d4f2
use the correct collection partial in the show action
syphax-bouazzouni Sep 30, 2024
327c445
remove unnecessary local in the instances partial
syphax-bouazzouni Sep 30, 2024
5b906fe
clean instance show partial code
syphax-bouazzouni Sep 30, 2024
927780b
remove unnecessary locals in the properties partial call
syphax-bouazzouni Sep 30, 2024
3346848
remove unnecessary locals in the collections show partial call
syphax-bouazzouni Sep 30, 2024
e523685
remove unnecessary locals in the schemes show partial call
syphax-bouazzouni Sep 30, 2024
436bc12
Add presence check (not nil and not empty) for ontology details compo…
muhammedBkf Sep 30, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
.description
= render TextAreaFieldComponent.new(value: @taxonomy.description)
.ontologies-cards
- @taxonomy.ontologies.each do |ontology|
- @taxonomy.ontologies.each_with_index do |ontology, index|
syphax-bouazzouni marked this conversation as resolved.
Show resolved Hide resolved
- if index>10
= render ChipButtonComponent.new(url: "/ontologies?#{@taxonomy.id.split('/')[-2]}=#{@taxonomy.acronym}", text: "...", tooltip:"See all ontologies ...", type: "clickable")
- break
= render ChipButtonComponent.new(url: "/ontologies/#{ontology.split('/').last}", text: ontology.split('/').last, tooltip: @ontologies_names[ontology], type: "clickable")

- if @taxonomy.children
.taxonomy-children-reveal{'data-action': "click->reveal-component#toggle", 'data-id': reveal_id}
.text
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def index
end

def show
redirect_to(ontology_path(id: params[:ontology_id], p: 'collections', collectionid: params[:id], lang: request_lang)) and return unless turbo_frame_request?
redirect_to(ontology_path(id: params[:ontology], p: 'collections', collectionid: params[:id], lang: request_lang)) and return if turbo_frame_request?
syphax-bouazzouni marked this conversation as resolved.
Show resolved Hide resolved

@collection = get_request_collection
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/instances_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def show
get_ontology(params)
@instance = get_instance_details_json(params[:ontology], params[:id] || params[:instanceid], {include: 'all'})

redirect_to(ontology_path(id: params[:ontology], p: 'instances', instanceid: params[:id] || params[:instanceid], lang: request_lang)) and return unless turbo_frame_request?
syphax-bouazzouni marked this conversation as resolved.
Show resolved Hide resolved
redirect_to(ontology_path(id: params[:ontology], p: 'instances', instanceid: params[:id] || params[:instanceid], lang: request_lang)) and return if turbo_frame_request?
syphax-bouazzouni marked this conversation as resolved.
Show resolved Hide resolved

render partial: 'instances/details', layout: nil
render partial: 'show'
end

private
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/properties_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ def show
@acronym = params[:ontology]
@property = get_property(params[:id], @acronym, include: 'all')

redirect_to(ontology_path(id: params[:ontology], p: 'properties', propertyid: params[:id], lang: request_lang)) and return unless turbo_frame_request?
syphax-bouazzouni marked this conversation as resolved.
Show resolved Hide resolved
redirect_to(ontology_path(id: params[:ontology], p: 'properties', propertyid: params[:id], lang: request_lang)) and return if turbo_frame_request?
syphax-bouazzouni marked this conversation as resolved.
Show resolved Hide resolved

render partial: 'show'

end


Expand Down
2 changes: 1 addition & 1 deletion app/controllers/schemes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def index
end

def show
redirect_to(ontology_path(id: params[:ontology_id], p: 'schemes', schemeid: params[:id],lang: request_lang)) and return unless turbo_frame_request?
redirect_to(ontology_path(id: params[:ontology], p: 'schemes', schemeid: params[:id],lang: request_lang)) and return if turbo_frame_request?
syphax-bouazzouni marked this conversation as resolved.
Show resolved Hide resolved

@scheme = get_request_scheme
end
Expand Down
17 changes: 17 additions & 0 deletions app/views/collections/_show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
= render TurboFrameComponent.new(id: 'collection_show', data: {"turbo-frame-target": "frame"}) do
- if @collection
- if @collection.errors
= render Display::AlertComponent.new(type:'info', message: @collection.errors.join)
- else

= render TabsContainerComponent.new(type:'outline') do |c|
- apikey = "#{get_apikey}"
- c.pinned_right do
%div{'data-concepts-json-target': 'button'}
.concepts_json_button
= render RoundedButtonComponent.new(link: "#{@ontology.id}/collections/#{escape(@collection.id)}?display=all&apikey=#{apikey}", target:'_blank')

- c.item(title: t('concepts.details'), path: '#details', selected: true, json_link: "#{@ontology.id}/collections/#{escape(@collection.id)}?display=all&apikey=#{apikey}")

- c.item_content do
= render :partial =>'/collections/collection', locals: {collection: @collection}
1 change: 0 additions & 1 deletion app/views/collections/show.html.haml

This file was deleted.

40 changes: 17 additions & 23 deletions app/views/instances/_details.html.haml
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
= render TurboFrameComponent.new(id: params[:modal]&.to_s.eql?('true') ? modal_frame_id : 'instance_show') do
- if @instance && @instance["@id"]
%div
- ontology_acronym = params[:ontology_id] || @ontology.acronym
- filter_properties = ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://www.w3.org/2000/01/rdf-schema#label", "http://www.w3.org/2004/02/skos/core#prefLabel"]

= render ConceptDetailsComponent.new(id:'instance-details', acronym: ontology_acronym, concept_id: @instance["@id"]) do |c|
- c.header(stripped: true) do |t|
- t.add_row({th: t("instances.id")}, {td: link_to_with_actions(@instance["@id"], acronym: @ontology.acronym) })

- label = @instance['label'] || @instance['prefLabel']
- unless label.blank?
- t.add_row({th: t('instances.label') }, {td: label.join(',').html_safe})

- types = @instance.types.reject{|x| x['NamedIndividual']}
- unless types.empty?
- t.add_row({th: t('instances.type') }) do |r|
- r.td do
= types.reject{|x| x['NamedIndividual']}.map {|cls| link_to_class(ontology_acronym,cls)}.join(', ').html_safe
- properties = @instance[:properties].to_h.select{|k,v| !filter_properties.include? k.to_s}
- properties.each do |prop|
- if !prop[1].nil?
- t.add_row({th: link_to_property(prop[0], ontology_acronym)}, {td: prop[1].map { |value| instance_property_value(value , ontology_acronym) }.join(', ').html_safe})
- ontology_acronym = params[:ontology_id] || @ontology.acronym
- filter_properties = ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://www.w3.org/2000/01/rdf-schema#label", "http://www.w3.org/2004/02/skos/core#prefLabel"]
= render ConceptDetailsComponent.new(id:'instance-details', acronym: ontology_acronym, concept_id: @instance["@id"]) do |c|
- c.header(stripped: true) do |t|
- t.add_row({th: t("instances.id")}, {td: link_to_with_actions(@instance["@id"], acronym: @ontology.acronym) })
- label = @instance['label'] || @instance['prefLabel']
- unless label.blank?
- t.add_row({th: t('instances.label') }, {td: label.join(',').html_safe})
- types = @instance.types.reject{|x| x['NamedIndividual']}
- unless types.empty?
- t.add_row({th: t('instances.type') }) do |r|
- r.td do
= types.reject{|x| x['NamedIndividual']}.map {|cls| link_to_class(ontology_acronym,cls)}.join(', ').html_safe
Dismissed Show dismissed Hide dismissed
- properties = @instance[:properties].to_h.select{|k,v| !filter_properties.include? k.to_s}
- properties.each do |prop|
- if !prop[1].nil?
- t.add_row({th: link_to_property(prop[0], ontology_acronym)}, {td: prop[1].map { |value| instance_property_value(value , ontology_acronym) }.join(', ').html_safe})



Expand Down
2 changes: 1 addition & 1 deletion app/views/instances/_instances.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

- if params[:p].eql?('instances')
%div#prop_contents{data: {'container-splitter-target': 'container'}}
= render partial: 'instances/details'
= render partial: 'instances/show', locals: { concept: @concept}



16 changes: 16 additions & 0 deletions app/views/instances/_show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
= render TurboFrameComponent.new(id: 'instance_show') do
- if @instance
- if @instance.errors
= render Display::AlertComponent.new(type:'info', message: @instance.errors.join)
- else
= render TabsContainerComponent.new(type:'outline') do |c|
- apikey = "#{get_apikey}"
- c.pinned_right do
%div{'data-concepts-json-target': 'button'}
.concepts_json_button
= render RoundedButtonComponent.new(link: "#{@ontology.id}/instances/#{escape(@instance["@id"])}?display=all&apikey=#{apikey}", target:'_blank')

- c.item(title: t('concepts.details'), path: '#details', selected: true, json_link: "#{@ontology.id}/instances/#{escape(@instance.id)}?display=all&apikey=#{apikey}")

- c.item_content do
= render :partial =>'/instances/details'
2 changes: 1 addition & 1 deletion app/views/ontologies/sections/_collections.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
%div#collection_contents{data:{'container-splitter-target': 'container'}}
= render TurboFrameComponent.new(id: 'collection') do
- if @collection
= render partial: 'collections/collection', locals: {collection: @collection}
= render partial: 'collections/show', locals: {collection: @collection}


2 changes: 1 addition & 1 deletion app/views/ontologies/sections/_schemes.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

%div#scheme_contents{data:{'container-splitter-target': 'container'}}
= render TurboFrameComponent.new(id:'scheme') do
= render partial: 'schemes/scheme', locals: {scheme: @scheme}
= render partial: 'schemes/show', locals: {scheme: @scheme}



2 changes: 1 addition & 1 deletion app/views/ontologies/sections/properties.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
tree_url: "/ontologies/#{@ontology.acronym}/properties?propertyid=#{escape(params[:propertyid])}&ontology=#{@ontology.acronym}&auto_click=false&language=#{request_lang}")

%div#prop_contents{data: {'container-splitter-target': 'container'}}
= render partial: 'properties/show'
= render partial: 'properties/show', locals: { property: @property, acronym: @ontology}
13 changes: 13 additions & 0 deletions app/views/properties/_details.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- properties = LinkedData::Client::Models::Property.properties_to_hash(@property).first
= render ConceptDetailsComponent.new(id:'property-details', acronym: @acronym, concept_id: @property.id,
properties: @property.properties,
top_keys: [],
bottom_keys: properties.keys.map(&:to_s),
exclude_keys: []) do |c|
- c.header(stripped: true) do |t|
- t.add_row({th: t('properties.id')}, {td: link_to_with_actions(@property.id, acronym: @acronym)})
- t.add_row({th: t('properties.type')}, {td: @property.type })
- t.add_row({th: t('properties.preferred_name')}, {td: display_in_multiple_languages(@property.label)}) unless @property.label.blank?
- t.add_row({th: t('properties.definitions')}, {td: display_in_multiple_languages(@property.definition)}) unless @property.definition.blank?
- t.add_row({th: t('properties.domain')}, {td: get_link_for_cls_ajax(@property.domain, @acronym, '_top')}) unless @property.domain.blank?
- t.add_row({th: t('properties.range')}, {td: get_link_for_cls_ajax(@property.range, @acronym, '_top')}) unless @property.range.blank?
23 changes: 11 additions & 12 deletions app/views/properties/_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
= render Display::AlertComponent.new(type:'info', message: @property.errors.join)
- else
- properties = LinkedData::Client::Models::Property.properties_to_hash(@property).first
= render ConceptDetailsComponent.new(id:'property-details', acronym: @acronym, concept_id: @property.id,
properties: @property.properties,
top_keys: [],
bottom_keys: properties.keys.map(&:to_s),
exclude_keys: []) do |c|
- c.header(stripped: true) do |t|
- t.add_row({th: t('properties.id')}, {td: link_to_with_actions(@property.id, acronym: @acronym)})
- t.add_row({th: t('properties.type')}, {td: @property.type })
- t.add_row({th: t('properties.preferred_name')}, {td: display_in_multiple_languages(@property.label)}) unless @property.label.blank?
- t.add_row({th: t('properties.definitions')}, {td: display_in_multiple_languages(@property.definition)}) unless @property.definition.blank?
- t.add_row({th: t('properties.domain')}, {td: get_link_for_cls_ajax(@property.domain, @acronym, '_top')}) unless @property.domain.blank?
- t.add_row({th: t('properties.range')}, {td: get_link_for_cls_ajax(@property.range, @acronym, '_top')}) unless @property.range.blank?
= render TabsContainerComponent.new(type:'outline') do |c|
- apikey = "#{get_apikey}"
syphax-bouazzouni marked this conversation as resolved.
Show resolved Hide resolved
- c.pinned_right do
%div{'data-concepts-json-target': 'button'}
.concepts_json_button
= render RoundedButtonComponent.new(link: "#{@ontology.id}/properties/#{escape(@property.id)}?display=all&apikey=#{apikey}", target:'_blank')

- c.item(title: t('concepts.details'), path: '#details', selected: true, json_link: "#{@ontology.id}/properties/#{escape(@property.id)}?display=all&apikey=#{apikey}")

- c.item_content do
= render :partial =>'/properties/details'
17 changes: 17 additions & 0 deletions app/views/schemes/_show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
= render TurboFrameComponent.new(id: 'scheme_show', data: {"turbo-frame-target": "frame"}) do
- if @scheme
- if @scheme.errors
= render Display::AlertComponent.new(type:'info', message: @scheme.errors.join)
- else

= render TabsContainerComponent.new(type:'outline') do |c|
- apikey = "#{get_apikey}"
- c.pinned_right do
%div{'data-concepts-json-target': 'button'}
.concepts_json_button
= render RoundedButtonComponent.new(link: "#{@ontology.id}/schemes/#{escape(@scheme.id)}?display=all&apikey=#{apikey}", target:'_blank')

- c.item(title: t('concepts.details'), path: '#details', selected: true, json_link: "#{@ontology.id}/scheme/#{escape(@scheme.id)}?display=all&apikey=#{apikey}")

- c.item_content do
= render :partial =>'/schemes/scheme', locals: {scheme: @scheme}
1 change: 0 additions & 1 deletion app/views/schemes/show.html.haml

This file was deleted.

Loading