From c4baf8a4a5e21388f966eb112430154c381468f6 Mon Sep 17 00:00:00 2001 From: Syphax Date: Tue, 17 Dec 2024 05:59:36 +0100 Subject: [PATCH] tmp --- app/assets/stylesheets/ontologies.scss | 4 +- app/assets/stylesheets/tree.scss | 4 +- app/components/chip_button_component.rb | 10 +++ app/components/chips_component.rb | 16 ++++ .../chips_component/chips_component.html.haml | 9 ++ .../concept_details_component.html.haml | 8 -- app/components/rounded_button_component.rb | 6 +- .../rounded_button_component.html.haml | 4 +- app/controllers/concepts_controller.rb | 17 ++-- app/controllers/mappings_controller.rb | 4 +- app/controllers/ontologies_controller.rb | 5 +- app/helpers/application_helper.rb | 73 ++++++++++++---- app/helpers/concepts_helper.rb | 14 ++++ app/helpers/multi_languages_helper.rb | 4 +- app/helpers/ontologies_helper.rb | 10 +-- app/javascript/controllers/index.js | 3 + .../controllers/label_ajax_controller.js | 83 +++++++++++++++++++ .../controllers/load_chart_controller.js | 10 +-- app/views/concepts/_biomixer.html.erb | 4 +- app/views/concepts/_details.html.haml | 31 +------ app/views/concepts/_show.html.haml | 14 ++-- app/views/ontologies/visualize.html.haml | 2 +- config/initializers/omniauth.rb | 3 +- 23 files changed, 238 insertions(+), 100 deletions(-) create mode 100644 app/components/chip_button_component.rb create mode 100644 app/components/chips_component.rb create mode 100644 app/components/chips_component/chips_component.html.haml create mode 100644 app/javascript/controllers/label_ajax_controller.js diff --git a/app/assets/stylesheets/ontologies.scss b/app/assets/stylesheets/ontologies.scss index e1b23a8db5..0962624704 100644 --- a/app/assets/stylesheets/ontologies.scss +++ b/app/assets/stylesheets/ontologies.scss @@ -11,7 +11,6 @@ $ont-show-bg-color: #e9ecef; } .ontologies.show .gutter { - background-color: rgba(0, 0, 0, 0.03); background-repeat: no-repeat; background-position: center; @@ -184,8 +183,9 @@ $ont-show-bg-color: #e9ecef; } #bd_content .sidebar { - overflow-x: auto; white-space: nowrap; + min-height: 70vh; + max-height: 90vh; } #search_box:focus { diff --git a/app/assets/stylesheets/tree.scss b/app/assets/stylesheets/tree.scss index 82bdffd14f..0697a56b5f 100644 --- a/app/assets/stylesheets/tree.scss +++ b/app/assets/stylesheets/tree.scss @@ -2,8 +2,8 @@ ## TREE VIEW *********************/ #tree_wrapper { - max-height: 70vh; - overflow-y: scroll; + max-height: 75vh; + overflow-y: auto; } div.tree_error { diff --git a/app/components/chip_button_component.rb b/app/components/chip_button_component.rb new file mode 100644 index 0000000000..316717fe71 --- /dev/null +++ b/app/components/chip_button_component.rb @@ -0,0 +1,10 @@ +class ChipButtonComponent < ViewComponent::Base + def initialize(url: nil, text: nil, type: "static", disabled: false, tooltip: nil ,**html_options) + @url = url + @text = text + @type = type + @disabled = disabled + @tooltip = tooltip + @html_options = html_options.merge({href: @url}) + end +end \ No newline at end of file diff --git a/app/components/chips_component.rb b/app/components/chips_component.rb new file mode 100644 index 0000000000..624681f812 --- /dev/null +++ b/app/components/chips_component.rb @@ -0,0 +1,16 @@ +class ChipsComponent < ViewComponent::Base + + renders_one :count + def initialize(id:nil, name:, label: nil, value: nil, checked: false, tooltip: nil) + @id = id || name + @name = name + @value = value || 'true' + @checked = checked + @label = label || @value + @tooltip = tooltip + end + + def checked? + @checked + end +end \ No newline at end of file diff --git a/app/components/chips_component/chips_component.html.haml b/app/components/chips_component/chips_component.html.haml new file mode 100644 index 0000000000..f08d5a33dd --- /dev/null +++ b/app/components/chips_component/chips_component.html.haml @@ -0,0 +1,9 @@ +.chips-container{class: @disabled ? 'disabled' : '', 'data-controller': 'tooltip', title: @tooltip} + %div + %label{:for => "chips-#{@id}-check"} + %input{:id => "chips-#{@id}-check", :name => @name, :type => "checkbox", :value => @value, checked: checked?, disabled: @disabled} + %span + = inline_svg_tag 'check.svg', class: 'chips-check-icon' + %div + = @label + = count diff --git a/app/components/concept_details_component/concept_details_component.html.haml b/app/components/concept_details_component/concept_details_component.html.haml index e8c341b8c4..f7af5e94a3 100644 --- a/app/components/concept_details_component/concept_details_component.html.haml +++ b/app/components/concept_details_component/concept_details_component.html.haml @@ -22,11 +22,3 @@ - row_hash_properties(bottom_set, @acronym).each do |row| - t.add_row(*row) - - - if @concept_id - - t.row do |r| - - r.td(colspan: 2) do - %div.d-flex.justify-content-center.p-2#content_resource_formats - - [["json","json-ld-file"], ["xml","rdf-xml-file"] , ["ntriples","ntriples-file"], ["turtle","turtle-file"]].each do |format, icon| - %div.mx-4{data: {controller: "tooltip"}, title: "Export in #{format.upcase}"} - = link_to_format_modal(format, icon) \ No newline at end of file diff --git a/app/components/rounded_button_component.rb b/app/components/rounded_button_component.rb index b2a0ce49c6..46058e3351 100644 --- a/app/components/rounded_button_component.rb +++ b/app/components/rounded_button_component.rb @@ -1,10 +1,12 @@ class RoundedButtonComponent < ViewComponent::Base - def initialize(icon: "json.svg", link: "#", size: "small", target: '', title: '') + def initialize(id: nil, icon: "json.svg", link: "#", size: "small", target: '', title: '', data: nil) @icon = icon @link = link @size = size @target = target @title = title + @data = data + @id = id end def size @@ -18,4 +20,4 @@ def size end end -end \ No newline at end of file +end diff --git a/app/components/rounded_button_component/rounded_button_component.html.haml b/app/components/rounded_button_component/rounded_button_component.html.haml index f5f23aad59..040d6b9a6f 100644 --- a/app/components/rounded_button_component/rounded_button_component.html.haml +++ b/app/components/rounded_button_component/rounded_button_component.html.haml @@ -1,2 +1,2 @@ -%a.rounded-button{:href => @link, style: "height:"+size[0]+"; width:"+size[0]+"; border-radius:"+size[2]+";", target:@target, title: @title, 'data-controller':'tooltip'} - = inline_svg_tag @icon, style: "transform: scale("+size[1]+");" +%a.rounded-button{id: @id, :href => @link, style: "height:"+size[0]+"; width:"+size[0]+"; border-radius:"+size[2]+";", target:@target, title: @title, 'data-controller':'tooltip', data: @data} + = content || inline_svg_tag(@icon, style: "transform: scale("+size[1]+");") diff --git a/app/controllers/concepts_controller.rb b/app/controllers/concepts_controller.rb index 94478c5373..4e22ea63ed 100644 --- a/app/controllers/concepts_controller.rb +++ b/app/controllers/concepts_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class ConceptsController < ApplicationController - include MappingsHelper + include MappingsHelper, ConceptsHelper layout 'ontology' @@ -47,17 +47,10 @@ def show end def show_label - @ontology = LinkedData::Client::Models::Ontology.find(params[:ontology]) - @ontology ||= LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology]).first - not_found unless @ontology - # Retrieve a class prefLabel or return the class ID (URI) - # - mappings may contain class URIs that are not in bioportal (e.g. obo-xrefs) - cls = @ontology.explore.single_class(params[:concept]) - # TODO: log any cls.errors - # TODO: NCBO-402 might be implemented here, but it throws off a lot of ajax result rendering. - # cls_label = cls.prefLabel({:use_html => true}) || cls_id - cls_label = cls.prefLabel || params[:concept] - render plain: cls_label + cls_id = params[:concept] || params[:id] # cls_id should be a full URI + ont_id = params[:ontology] # ont_id could be a full URI or an acronym + + render inline: helpers.main_language_label(concept_label(ont_id, cls_id)) end def show_definition diff --git a/app/controllers/mappings_controller.rb b/app/controllers/mappings_controller.rb index 1a5e67ab98..8d258ed6b2 100644 --- a/app/controllers/mappings_controller.rb +++ b/app/controllers/mappings_controller.rb @@ -4,7 +4,7 @@ class MappingsController < ApplicationController include ActionView::Helpers::NumberHelper - include MappingStatistics + include MappingStatistics,MappingsHelper layout :determine_layout before_action :authorize_and_redirect, only: [:create, :new, :destroy] @@ -83,7 +83,7 @@ def get_concept_table @ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontologyid]).first @concept = @ontology.explore.single_class({ full: true }, params[:conceptid]) - @mappings = @concept.explore.mappings + @mappings = get_concept_mappings(@concept) @type = params[:type] @delete_mapping_permission = check_delete_mapping_permission(@mappings) render partial: 'mappings/concept_mappings', layout: false diff --git a/app/controllers/ontologies_controller.rb b/app/controllers/ontologies_controller.rb index 8281af0793..9588de729e 100644 --- a/app/controllers/ontologies_controller.rb +++ b/app/controllers/ontologies_controller.rb @@ -143,8 +143,9 @@ def classes unless @concept.id == "bp_fake_root" @notes = @concept.explore.notes - @mappings = get_concept_mappings(@concept) - @delete_mapping_permission = check_delete_mapping_permission(@mappings) + puts 'getting mappings' + # @mappings = get_concept_mappings(@concept) + # @delete_mapping_permission = check_delete_mapping_permission(@mappings) end update_tab(@ontology, @concept.id) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index aa9f2bddf5..5341851084 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3,7 +3,7 @@ require 'digest/sha1' module ApplicationHelper - include ModalHelper + include ModalHelper, MultiLanguagesHelper RESOLVE_NAMESPACE = {:omv => "http://omv.ontoware.org/2005/05/ontology#", :skos => "http://www.w3.org/2004/02/skos/core#", :owl => "http://www.w3.org/2002/07/owl#", :rdf => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", :rdfs => "http://www.w3.org/2000/01/rdf-schema#", :metadata => "http://data.bioontology.org/metadata/", @@ -152,10 +152,31 @@ def build_tree(node, string, id, submission) def tree_link_to_concept(li_id:, child:, ontology_acronym:, active_style:, lang: ) - page_name = ontology_viewer_page_name(ontology_acronym, child.prefLabel, 'Classes') + page_name = ontology_viewer_page_name(ontology_acronym, main_language_label(child.prefLabel), 'Classes') open = child.expanded? ? "class='open'" : '' - href = ontology_acronym.blank? ? '#' : "/ontologies/#{child.explore.ontology.acronym}/concepts/?id=#{CGI.escape(child.id)}&lang=#{lang}" - "
  • #{child.prefLabel({ use_html: true })}" + pref_label_html, tooltip = tree_node_label(child) + href = ontology_acronym.blank? ? '#' : "/ontologies/#{ontology_acronym}/concepts/?id=#{CGI.escape(child.id)}&lang=#{lang}" + "
  • #{pref_label_html}" + end + + def tree_node_label(child) + label = begin + child.prefLabel || child.label + rescue + child.id + end + + if label.nil? + pref_label_html = link_last_part(child.id) + else + pref_label_lang, pref_label_html = select_language_label(label) + pref_label_lang = pref_label_lang.to_s.upcase + tooltip = pref_label_lang.eql?("@NONE") ? "" : pref_label_lang + + pref_label_html = "#{pref_label_html.html_safe}".html_safe if child.obsolete? + end + + [pref_label_html, tooltip] end def tree_link_to_children(li_id:, child:, ontology_acronym:, lang: ) @@ -351,27 +372,47 @@ def bp_ont_link(ont_acronym) "/ontologies/#{ont_acronym}" end + def bp_class_link(cls_id, ont_acronym) - ontology_path(id: ont_acronym, p: 'classes', conceptid: cls_id) + "#{bp_ont_link(ont_acronym)}?p=classes&conceptid=#{escape(cls_id)}&language=#{request_lang}" + end + + def label_ajax_data_h(cls_id, ont_acronym, ajax_uri, cls_url) + { data: + { + 'label-ajax-cls-id-value': cls_id, + 'label-ajax-ontology-acronym-value': ont_acronym, + 'label-ajax-ajax-url-value': ajax_uri, + 'label-ajax-cls-id-url-value': cls_url + } + } + end + + def label_ajax_data(cls_id, ont_acronym, ajax_uri, cls_url) + label_ajax_data_h(cls_id, ont_acronym, ajax_uri, cls_url) + end + + def label_ajax_link(link, cls_id, ont_acronym, ajax_uri, cls_url, target = nil) + data = label_ajax_data(cls_id, ont_acronym, ajax_uri, cls_url) + options = { 'data-controller': 'label-ajax' }.merge(data) + options = options.merge({ target: target }) if target + content_tag(:span, class: 'mx-1') do + render ChipButtonComponent.new(url: link, text: cls_id, type: 'clickable', **options) + end end def get_link_for_cls_ajax(cls_id, ont_acronym, target = nil) - # NOTE: bp_ajax_controller.ajax_process_cls will try to resolve class labels. - # Uses 'http' as a more generic attempt to resolve class labels than .include? ont_acronym; the - # bp_ajax_controller.ajax_process_cls will try to resolve class labels and - # otherwise remove the UNIQUE_SPLIT_STR and the ont_acronym. - target = target.nil? ? '' : " target='#{target}' " - - if cls_id.start_with?('http://', 'https://') - href_cls = " href='#{bp_class_link(cls_id, ont_acronym)}' " - data_cls = " data-cls='#{cls_id}' " - data_ont = " data-ont='#{ont_acronym}' " - "#{cls_id}" + if cls_id.start_with?('http://') || cls_id.start_with?('https://') + link = bp_class_link(cls_id, ont_acronym) + ajax_url = "/ajax/classes/label?language=#{request_lang}" + cls_url = "/ontologies/#{ont_acronym}?p=classes&conceptid=#{CGI.escape(cls_id)}" + label_ajax_link(link, cls_id, ont_acronym, ajax_url , cls_url ,target) else content_tag(:div, cls_id) end end + def get_link_for_ont_ajax(ont_acronym) # Ajax call will replace the acronym with an ontology name (triggered by class='ont4ajax') href_ont = " href='#{bp_ont_link(ont_acronym)}' " diff --git a/app/helpers/concepts_helper.rb b/app/helpers/concepts_helper.rb index da04a368fb..04986f4214 100644 --- a/app/helpers/concepts_helper.rb +++ b/app/helpers/concepts_helper.rb @@ -1,6 +1,20 @@ # frozen_string_literal: true module ConceptsHelper + include MultiLanguagesHelper + 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 + ontology_not_found(ont_id) unless @ontology + # Retrieve a class prefLabel or return the class ID (URI) + # - mappings may contain class URIs that are not in bioportal (e.g. obo-xrefs) + cls = @ontology.explore.single_class({language: request_lang, include: 'prefLabel'}, cls_id) + # TODO: log any cls.errors + # TODO: NCBO-402 might be implemented here, but it throws off a lot of ajax result rendering. + #cls_label = cls.prefLabel({:use_html => true}) || cls_id + cls.prefLabel || cls_id + end + def exclude_relation?(relation_to_check, ontology = nil) excluded_relations = %w[type rdf:type [R] SuperClass InstanceCount] diff --git a/app/helpers/multi_languages_helper.rb b/app/helpers/multi_languages_helper.rb index 9504a48095..bd5e38b738 100644 --- a/app/helpers/multi_languages_helper.rb +++ b/app/helpers/multi_languages_helper.rb @@ -1,4 +1,5 @@ module MultiLanguagesHelper + include OntologiesHelper def portal_language_help_text t('language.portal_language_help_text') @@ -110,6 +111,7 @@ def content_languages(submission = @submission || @submission_latest) [lang.english_name, lang.alpha2] end.compact + submission_lang << ['All languages', 'all'] [submission_lang, current_lang] end @@ -166,7 +168,7 @@ def display_in_multiple_languages(label) Array(value).map do |v| content_tag(:div, class: 'definition') do concat content_tag(:span, v) - concat content_tag(:span, key.upcase, class: 'badge badge-secondary ml-1') unless key.to_s.upcase.eql?('NONE') || key.to_s.upcase.eql?('@NONE') + concat content_tag(:span, key.upcase, class: 'badge bg-secondary ml-1') unless key.to_s.upcase.eql?('NONE') || key.to_s.upcase.eql?('@NONE') end end.join end.join) diff --git a/app/helpers/ontologies_helper.rb b/app/helpers/ontologies_helper.rb index 67d0c75f84..ad3763bb48 100644 --- a/app/helpers/ontologies_helper.rb +++ b/app/helpers/ontologies_helper.rb @@ -10,16 +10,16 @@ def ontology_object_json_link(ontology_acronym, object_type, id) end def render_permalink_link - content_tag(:div, class: 'mx-1') do - link_to("#classPermalinkModal", class: "class-permalink nav-link", title: t('concepts.permanent_link_class'), aria: { label: t('concepts.permanent_link_class') }, data: { toggle: "modal", current_purl: @current_purl }) do - content_tag(:i, '', class: "fas fa-link", aria: { hidden: "true" }) + content_tag(:div, class: 'concepts_json_button mx-2') do + render RoundedButtonComponent.new(id: 'classPermalink', link: 'javascript:void(0);', title: t('concepts.permanent_link_class'), data: { 'bs-toggle': "modal", 'bs-target': "#classPermalinkModal", current_purl: @current_purl} ) do + inline_svg_tag('icons/copy_link.svg', width: 20, height: 20) end end end def render_concepts_json_button(link) content_tag(:div, class: 'concepts_json_button') do - render RoundedButtonComponent.new(link: link, target: '_blank') + render RoundedButtonComponent.new(link: link, target: '_blank', title: t('concepts.permanent_link_class')) end end @@ -250,7 +250,7 @@ def visits_chart_dataset_array(visits_data, fill: true) data: x, borderWidth: 2, borderRadius: 5, - borderSkipped: false, + borderSkipped: true, cubicInterpolationMode: 'monotone', tension: 0.4, fill: fill diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js index 8933fa1a6e..fdf72f2dca 100644 --- a/app/javascript/controllers/index.js +++ b/app/javascript/controllers/index.js @@ -39,3 +39,6 @@ application.register("turbo-frame", TurboFrameController) import TurboFrameErrorController from "./turbo_frame_error_controller" application.register("turbo-frame-error", TurboFrameErrorController) + +import LabelAjaxController from "./label_ajax_controller" +application.register("label-ajax", LabelAjaxController) diff --git a/app/javascript/controllers/label_ajax_controller.js b/app/javascript/controllers/label_ajax_controller.js new file mode 100644 index 0000000000..d3cbcfff46 --- /dev/null +++ b/app/javascript/controllers/label_ajax_controller.js @@ -0,0 +1,83 @@ +import {Controller} from "@hotwired/stimulus" +import useAjax from "../mixins/useAjax"; + +// Connects to data-controller="label-ajax" +export default class extends Controller { + static values = { + clsId: String, + ontologyAcronym: String, + ajaxUrl: String, + clsIdUrl: String, + } + + connect() { + setTimeout(() => { + this.linkA = jQuery(this.element); + + if (this.linkA.hasClass('ajax-modified-cls')) { + return true + } + + this.cls_id = this.clsIdValue; + this.ont_acronym = this.ontologyAcronymValue; + + let ajax_uri = new URL(this.ajaxUrlValue, document.location.origin) + + ajax_uri.searchParams.set('ontology', this.ont_acronym) + ajax_uri.searchParams.set('id', this.cls_id) + + + this.request = useAjax({ + url: ajax_uri.pathname + ajax_uri.search, + timeout: ajax_process_timeout * 1000, + success: this.#ajaxSuccess.bind(this), + error: this.#ajaxError.bind(this) + }); + },1) + } + + abort() { + if (this.request) { + this.request.abort() + this.request = null + } + } + + disconnect() { + this.abort() + } + + #ajaxSuccess(data) { + data = data.trim(); + if (typeof data !== "undefined" && data.length > 0 && data.indexOf("http") !== 0) { + let cls_name = data + let cls_uri = this.clsIdUrlValue + this.linkA.html(cls_name); + this.linkA.attr('href', cls_uri); + this.linkA.addClass('ajax-modified-cls'); + //find and process any identical classes (low probability) + this.#fillIdenticalIds(cls_name, cls_uri) + } else { + // remove the unique_id separator and the ontology acronym from the href + this.linkA.attr('href', this.cls_id); // it may not be an ontology class, don't use the cls_uri + this.linkA.addClass('ajax-modified-cls'); + } + } + + #ajaxError() { + this.linkA.addClass('ajax-error') + } + + #fillIdenticalIds(cls_name, cls_uri) { + + let unique_id = this.linkA.attr('href'); + jQuery('a[href="' + unique_id + '"]').each(function () { + let link = jQuery(this); + if (!link.hasClass('ajax-modified-cls')) { + link.html(cls_name); + link.attr('href', cls_uri); + link.addClass('ajax-modified-cls') + } + }); + } +} diff --git a/app/javascript/controllers/load_chart_controller.js b/app/javascript/controllers/load_chart_controller.js index c55b5adbb3..7f34a5e24a 100644 --- a/app/javascript/controllers/load_chart_controller.js +++ b/app/javascript/controllers/load_chart_controller.js @@ -57,25 +57,25 @@ export default class extends Controller { if (this.indexAxisValue === axe) { return { border: { - display: false + display: true }, grid: { display: false }, ticks: { - beginAtZero: false + beginAtZero: true } } } else { return { border: { - display: false + display: true }, grid: { - display: false + display: true }, ticks: { - display: false + display: true } } } diff --git a/app/views/concepts/_biomixer.html.erb b/app/views/concepts/_biomixer.html.erb index 53fbff6a80..84ff4140a2 100644 --- a/app/views/concepts/_biomixer.html.erb +++ b/app/views/concepts/_biomixer.html.erb @@ -36,7 +36,7 @@ jQuery(document).data().bp.biomixer_fullscreen.toggle = function(toggle) { jQuery("#biomixer_container").css("padding", 0).css("width", jQuery(document).data().bp.biomixer_fullscreen.bio_container_w); jQuery("#bd_content").trigger('resize'); } else { - height = jQuery(window).height() - jQuery("#bd_content .cls-info-container").offset().top - 50; + height = jQuery(window).height() - 50; jQuery("#bd_content .cls-info-container").css("width", "100%").css("height", height); jQuery("#bd .bd_content .cls-info-container #contents").css("max-height", height); jQuery("#biomixer_container").css("padding", 0).css("width", "100%").css("height", height); @@ -44,7 +44,7 @@ jQuery(document).data().bp.biomixer_fullscreen.toggle = function(toggle) { } window.onmessage = function(e) { - var iframeHeight = jQuery(window).height() - jQuery("#bd_content .cls-info-container").offset().top - 50; + var iframeHeight = jQuery(window).height() - 50; if (e.data === "biomixer_full_screen_request") { if (jQuery(document).data().bp.biomixer_fullscreen.enabled) { // make small diff --git a/app/views/concepts/_details.html.haml b/app/views/concepts/_details.html.haml index a0b27cb7c7..208b0f5b5b 100644 --- a/app/views/concepts/_details.html.haml +++ b/app/views/concepts/_details.html.haml @@ -1,13 +1,8 @@ = turbo_frame_tag(params[:modal] ? 'application_modal_content' : 'concept_details', class: 'd-block p-2') do - - schemes_keys = %w[hasTopConcept topConceptOf] - - label_xl_set = %w[skos-xl#prefLabel skos-xl#altLabel skos-xl#hiddenLabel] - - = render ConceptDetailsComponent.new(id:'concept-details', acronym: @ontology.acronym, concept_id: @concept.id, 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', 'narrower']) do |c| + bottom_keys: %w[disjoint subclass is_a has_part]) do |c| - c.header(stripped: true) do |t| - t.add_row({th: t('ontology_details.concept.id')}, {td:link_to_with_actions(@concept.id, acronym: @ontology.acronym)}) @@ -32,26 +27,4 @@ - if @concept.obsolete? - t.add_row({th: t('ontology_details.concept.obsolete')}, {td: 'true'}) - - if skos? - - unless @concept.memberOf.nil? || @concept.memberOf.empty? - - t.add_row({th: t('ontology_details.concept.member_of')}) do |h| - - h.td do - - @concept.memberOf.each do |v| - %span.m-1 - = raw get_link_for_collection_ajax(v, @ontology.acronym, '_blank') - - - unless @concept.inScheme.nil? || @concept.inScheme.empty? - - t.add_row({th: t('ontology_details.concept.in_schemes')}) do |h| - - h.td do - - @concept.inScheme.each do |v| - %span.m-1 - = raw get_link_for_scheme_ajax(v, @ontology.acronym, '_blank') - - - 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) + - t.add_row({th: t('ontology_details.concept.type')} , {td: @concept.type}) diff --git a/app/views/concepts/_show.html.haml b/app/views/concepts/_show.html.haml index 4a9550638b..399a62cde6 100644 --- a/app/views/concepts/_show.html.haml +++ b/app/views/concepts/_show.html.haml @@ -25,14 +25,14 @@ src:"/ajax/mappings/get_concept_table?ontologyid=#{@ontology.acronym}&conceptid=#{CGI.escape(@concept.id)}") - :javascript - jQuery(document).ready(function(){ - jQuery("#classPermalinkModal").on("shown.bs.modal", function (e) { - var currentPurl = jQuery("a.class-permalink").data("current-purl"); + :javascript + jQuery(document).ready(function(){ + jQuery("#classPermalinkModal").on("shown.bs.modal", function (e) { + var currentPurl = jQuery("#classPermalink").data("current-purl"); jQuery("#purl_input").val(currentPurl); - }) + }) - jQuery("#purl_input").on("click", function () { + jQuery("#purl_input").on("click", function () { jQuery(this).select(); - }); }); + }); diff --git a/app/views/ontologies/visualize.html.haml b/app/views/ontologies/visualize.html.haml index c9d407d263..7127dd4d0e 100644 --- a/app/views/ontologies/visualize.html.haml +++ b/app/views/ontologies/visualize.html.haml @@ -3,7 +3,7 @@ - @title = "#{@ontology.name} - #{@concept.prefLabel}" %div.tooltip %div#bd_content.bd_content.explore.py-3{data:{controller: 'container-splitter'}} - %div.sidebar.d-flex.flex-column.pr-2{data:{'container-splitter-target': 'container'}} + %div.card.sidebar.d-flex.flex-column.p-1.mx-2{data:{'container-splitter-target': 'container'}} %div#qsearch.input-group.pb-2.pe-1 %span.input-group-text Jump to: = text_field_tag("search_box", nil, class: "form-control rounded-end", aria: {label: "Jump to:"}, diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index c7c4027c3e..c0ac6bd0c9 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,5 +1,4 @@ Rails.application.config.middleware.use OmniAuth::Builder do Array($OMNIAUTH_PROVIDERS).each do |provider, config| - provider config[:strategy] || provider, config[:client_id], config[:client_secret], client_options: {}.merge(config[:client_options].to_h) end -end \ No newline at end of file +end