Skip to content

Commit

Permalink
Add the content formats for instances and Properties
Browse files Browse the repository at this point in the history
  • Loading branch information
imadbourouche authored and syphax-bouazzouni committed Mar 27, 2024
1 parent 1161867 commit e1944be
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
36 changes: 24 additions & 12 deletions app/views/instances/_instance_details.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,30 @@
%div
- ontology_acronym = params[:ontology_id]
- filter_properties = ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]
%table.table
%tr
%td
= link_to 'type', "#"
%td{style:"word-break: break-all"}
- type = @instance.types.reject{|x| x['NamedIndividual']}
#{type.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?
= render TabsContainerComponent.new(type: 'outline') do |c|
- c.item(title: "Raw Data", selected: true)
- c.item_content do
%table.table
%tr
%td
= link_to_property(prop[0] , ontology_acronym)
= link_to 'type', "#"
%td{style:"word-break: break-all"}
= prop[1].map { |value| instance_property_value(value , ontology_acronym) }.join(', ').html_safe
- type = @instance.types.reject{|x| x['NamedIndividual']}
#{type.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?
%tr
%td
= link_to_property(prop[0] , ontology_acronym)
%td{style:"word-break: break-all"}
= prop[1].map { |value| instance_property_value(value , ontology_acronym) }.join(', ').html_safe
- if params["id"]
- uri_parameter= CGI.escape(params["id"])
- finder_params = "?acronym=#{ontology_acronym}&uri=#{uri_parameter}"
- ['json', 'xml', 'ntriples', 'turtle'].each do |format|
- c.item(title: format)
- c.item_content do
= render TurboFrameComponent.new(id: "resource_content_frame_#{format}", src: "/content_finder#{finder_params}&output_format=#{format}", loading: "lazy")
12 changes: 12 additions & 0 deletions app/views/properties/_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@
- 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|
- uri_parameter= CGI.escape(property.id)
- finder_params = "?acronym=#{@acronym}&uri=#{uri_parameter}"
%h4= finder_params
- ['json', 'xml', 'ntriples', 'turtle'].each do |format|
- c.item(title: format, selected: (format == 'json'))
- c.item_content do
= render TurboFrameComponent.new(id: "resource_content_frame_#{format}", src: "/content_finder#{finder_params}&output_format=#{format}", loading: "lazy")

0 comments on commit e1944be

Please sign in to comment.