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

Fix: display the list of concepts in a collection at one sight #295

2 changes: 1 addition & 1 deletion app/controllers/ontologies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class OntologiesController < ApplicationController
include InstancesHelper
include ActionView::Helpers::NumberHelper
include OntologiesHelper
include SchemesHelper
include SchemesHelper, ConceptsHelper
include CollectionsHelper
include MappingStatistics

Expand Down
16 changes: 16 additions & 0 deletions app/helpers/concepts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ def get_concept_id(params, concept, root)
end
end

def sub_menu_active?(section)
params["sub_menu"]&.eql? section
end

def sub_menu_active_class(section)
"active show" if sub_menu_active?(section)
end

def default_sub_menu?
!sub_menu_active?('list') && !sub_menu_active?('date')
end

def default_sub_menu_class
"active show" if default_sub_menu?
end

def concept_label(ont_id, cls_id)
@ontology = LinkedData::Client::Models::Ontology.find(ont_id)
@ontology ||= LinkedData::Client::Models::Ontology.find_by_acronym(ont_id).first
Expand Down
7 changes: 5 additions & 2 deletions app/views/collections/_collection.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
- 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"]})
- t.add_row({th: 'Members count'}) do |r|
- r.td do
= link_to collection["memberCount"], "/ontologies/" + @ontology.acronym + "/?p=classes&sub_menu=list&concept_collections=" + collection["@id"], 'data-turbo-frame':'_top'
- t.add_row({th: 'Type'}, {td: collection["@type"]})

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
%nav
.nav.nav-tabs.text-center{:role => "tablist", style:"background-color: rgba(0, 0, 0, 0.03);"}

%a#concepts-tree-tab.nav-item.nav-link.active.flex-grow-1.border-radius-0{"data-toggle" => "tab", :href => "#concepts-tree-container", title: 'Hierarchy view', 'data-controller': "tooltip"}
%a#concepts-tree-tab.nav-item.nav-link.flex-grow-1.border-radius-0{"data-toggle" => "tab", :href => "#concepts-tree-container", title: 'Hierarchy view', 'data-controller': "tooltip", class: default_sub_menu_class}
%img{src: asset_path('list-tree.svg') , style:'width: 25px; height: 25px'}
- if skos?
%a#concepts-list-tab.nav-item.nav-link.flex-grow-1.border-radius-0{"data-toggle" => "tab", :href => "#concepts-list-container", title: 'Collection view', 'data-controller': "tooltip"}
%a#concepts-list-tab.nav-item.nav-link.flex-grow-1.border-radius-0{"data-toggle" => "tab", :href => "#concepts-list-container", title: 'Collection view', 'data-controller': "tooltip", class: sub_menu_active_class('list')}
%i.fas.fa-list.text-dark{style:'font-size: 25px'}
%a#concepts-date-sort-tab.nav-item.nav-link.flex-grow-1.border-radius-0{"data-toggle" => "tab", :href => "#concepts-date-sort-container", title: 'Date view', 'data-controller': "tooltip"}
%a#concepts-date-sort-tab.nav-item.nav-link.flex-grow-1.border-radius-0{"data-toggle" => "tab", :href => "#concepts-date-sort-container", title: 'Date view', 'data-controller': "tooltip", class: sub_menu_active_class('date')}
%i.far.fa-calendar-alt.text-dark{style:'font-size: 25px'}
.tab-content.px-1.py-2
#concepts-tree-container.tab-pane.fade.show.active
#concepts-tree-container.tab-pane.fade{class: default_sub_menu_class}
= render partial: 'ontologies/concepts_browsers/concepts_tree'
- if skos?
#concepts-list-container.tab-pane.fade
#concepts-list-container.tab-pane.fade{class: sub_menu_active_class('list')}
= render partial: 'ontologies/concepts_browsers/concepts_list'
#concepts-date-sort-container.tab-pane.fade
#concepts-date-sort-container.tab-pane.fade{class: sub_menu_active_class('date')}
= render partial: 'ontologies/concepts_browsers/concepts_date_sort'
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
data: {action: 'changed->turbo-frame#updateFrame'}}

%div#sd_content.card.p-1{style: 'overflow-y: scroll; height: 60vh;'}
= render TurboFrameComponent.new(id: 'concepts_list_view-page-1', data: {'turbo-frame-target': 'frame'}) do
= render TurboFrameComponent.new(id: 'concepts_list_view-page-1', data: {'turbo-frame-target': 'frame'}, src:params[:concept_collections] ? "/ajax/classes/list?ontology_id=#{@ontology.acronym}&collection_id=#{params[:concept_collections]}" : '') do
Please select a collection to display