").html(text).hide();
-
- text = text.replace(/^ /, ''); // node had trailing whitespace.
-
- var text_short = text.slice(0, max_length);
-
- // Ensure HTML entities are encoded
- // http://debuggable.com/posts/encode-html-entities-with-jquery:480f4dd6-13cc-4ce9-8071-4710cbdd56cb
- text_short = $('
').text(text_short).html();
-
- var other_text = text.slice(max_length, text.length);
-
- text_short += "
"+more+"";
- text_short += "
" + other_text + "";
- return text_short;
- }
-}
diff --git a/app/javascript/controllers/form_display_controller.js b/app/javascript/controllers/form_display_controller.js
deleted file mode 100644
index 4649523fc..000000000
--- a/app/javascript/controllers/form_display_controller.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import { Controller } from "@hotwired/stimulus"
-
-// Connects to data-controller="form-options-display"
-export default class extends Controller {
-
- static targets = ['option1', 'option2']
- static values = {
- hiddenClass: String
- }
-
- connect() {
- this.class = this.hasHiddenClassValue ? this.hiddenClassValue : "hidden"
- }
-
- showOption1(){
- this.#hide(this.option2Targets)
- this.#show(this.option1Targets)
- }
-
- showOption2(){
- this.#hide(this.option1Targets)
- this.#show(this.option2Targets)
- }
-
-
- #show(optionElems){
- optionElems.forEach(x => x.classList.remove(this.class))
-
- }
-
- #hide(optionElems){
- optionElems.forEach(x => x.classList.add(this.class))
- }
-
-
-}
diff --git a/app/javascript/controllers/form_url_controller.js b/app/javascript/controllers/form_url_controller.js
deleted file mode 100644
index 1e5813a4a..000000000
--- a/app/javascript/controllers/form_url_controller.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import { Controller } from "@hotwired/stimulus"
-
-
-export default class extends Controller {
-
- submit(event){
- event.preventDefault();
- let selectedOptions, hiddenInput, optionString, selectElem
- let allSelects = this.element.querySelectorAll('select[name$="[]"]');
- for (const select of allSelects) {
- const selectElem = select.name.substring(0, select.name.indexOf('['));
- const selectedOptions = select.selectedOptions;
- if (selectedOptions.length > 0) {
- const optionString = Array.from(selectedOptions, option => option.value).join(",");
- const hiddenInput = this.#create_hidden_input_element(optionString, selectElem);
- event.currentTarget.appendChild(hiddenInput);
- select.remove();
- }
- }
-
- event.currentTarget.submit();
- }
-
- #create_hidden_input_element(optionString, name){
- let hiddenInput = document.createElement('input');
- hiddenInput.type = 'hidden';
- hiddenInput.name = name;
- hiddenInput.value = optionString;
- return hiddenInput
- }
-}
diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js
index 804ee3b3a..5598ea18d 100644
--- a/app/javascript/controllers/index.js
+++ b/app/javascript/controllers/index.js
@@ -4,11 +4,6 @@
import { application } from "./application"
-import BrowseFiltersController from "./browse_filters_controller"
-application.register("browse-filters", BrowseFiltersController)
-
-import ChosenController from "./chosen_controller"
-application.register("chosen", ChosenController)
import ClassSearchAutoCompleteController from "./class_search_auto_complete_controller"
application.register("class-search-auto-complete", ClassSearchAutoCompleteController)
@@ -16,93 +11,26 @@ application.register("class-search-auto-complete", ClassSearchAutoCompleteContro
import ContainerSplitterController from "./container_splitter_controller"
application.register("container-splitter", ContainerSplitterController)
-import FairScoreHomeController from "./fair_score_home_controller"
-application.register("fair-score-home", FairScoreHomeController)
-
-import FairScoreLandscapeController from "./fair_score_landscape_controller"
-application.register("fair-score-landscape", FairScoreLandscapeController)
-
-import FairScoreSummaryController from "./fair_score_summary_controller"
-application.register("fair-score-summary", FairScoreSummaryController)
-
-import FormAutoCompleteController from "./form_auto_complete_controller"
-application.register("form-auto-complete", FormAutoCompleteController)
-
-import FormDisplayController from "./form_display_controller"
-application.register("form-options-display", FormDisplayController)
-
import HistoryController from "./history_controller"
application.register("history", HistoryController)
-import LabelAjaxController from "./label_ajax_controller"
-application.register("label-ajax", LabelAjaxController)
-
-import LabelsAjaxContainerController from "./labels_ajax_container_controller"
-application.register("labels-ajax-container", LabelsAjaxContainerController)
-
import LanguageChangeController from "./language_change_controller"
application.register("language-change", LanguageChangeController)
import LoadChartController from "./load_chart_controller"
application.register("load-chart", LoadChartController)
-import OntologyRelationsNetworkController from "./ontology_relations_network_controller"
-application.register("ontology-relations-network", OntologyRelationsNetworkController)
-
import OntologyViewerTabsController from "./ontology_viewer_tabs_controller"
application.register("ontology-viewer-tabs", OntologyViewerTabsController)
import OntoportalAutocompleteController from "./ontoportal_autocomplete_controller"
application.register("ontoportal-autocomplete", OntoportalAutocompleteController)
-import RecommenderController from "./recommender_controller"
-application.register("recommender", RecommenderController)
-
-import ShowFilterCountController from "./show_filter_count_controller"
-application.register("show-filter-count", ShowFilterCountController)
-
-import ShowModalController from "./show_modal_controller"
-application.register("show-modal", ShowModalController)
-
import SimpleTreeController from "./simple_tree_controller"
application.register("simple-tree", SimpleTreeController)
-import SkosCollectionColorsController from "./skos_collection_colors_controller"
-application.register("skos-collection-colors", SkosCollectionColorsController)
-
-import SparqlController from "./sparql_controller"
-application.register("sparql", SparqlController)
-
-import TextTruncateController from "./text_truncate_controller"
-application.register("text-truncate", TextTruncateController)
-
-import TooltipController from "./tooltip_controller"
-application.register("tooltip", TooltipController)
-
-import TopnavResponsivenessController from "./topnav_responsiveness_controller"
-application.register("topnav-responsiveness", TopnavResponsivenessController)
-
import TurboFrameController from "./turbo_frame_controller"
application.register("turbo-frame", TurboFrameController)
import TurboFrameErrorController from "./turbo_frame_error_controller"
application.register("turbo-frame-error", TurboFrameErrorController)
-
-import SampleTextController from "./sample_text_controller"
-application.register("sample-text", SampleTextController)
-
-import AnnotatorController from "./annotator_controller"
-application.register('annotator', AnnotatorController)
-
-import FormUrlController from "./form_url_controller"
-application.register('form-url', FormUrlController)
-
-import OntologiesSelector from "./ontologies_selector_controller"
-application.register("ontologies-selector", OntologiesSelector)
-
-
-import MappingsController from "./mappings_visualization_controller"
-application.register('mappings', MappingsController)
-
-import ConceptsJsonButtonController from "./concepts_json_button_controller.js"
-application.register('concepts-json', ConceptsJsonButtonController)
\ No newline at end of file
diff --git a/app/javascript/controllers/label_ajax_controller.js b/app/javascript/controllers/label_ajax_controller.js
deleted file mode 100644
index d3cbcfff4..000000000
--- a/app/javascript/controllers/label_ajax_controller.js
+++ /dev/null
@@ -1,83 +0,0 @@
-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/labels_ajax_container_controller.js b/app/javascript/controllers/labels_ajax_container_controller.js
deleted file mode 100644
index a8f606114..000000000
--- a/app/javascript/controllers/labels_ajax_container_controller.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import {Controller} from "@hotwired/stimulus"
-
-// Connects to data-controller="labels-ajax-container"
-export default class extends Controller {
- static outlets = ['label-ajax']
-
- abortAll() {
- this.labelAjaxOutlets.forEach((link) => {link.abort()})
- }
-}
diff --git a/app/javascript/controllers/mappings_visualization_controller.js b/app/javascript/controllers/mappings_visualization_controller.js
deleted file mode 100644
index 58d74cc60..000000000
--- a/app/javascript/controllers/mappings_visualization_controller.js
+++ /dev/null
@@ -1,259 +0,0 @@
-import { Controller } from '@hotwired/stimulus'
-import { useMappingsDrawBubbles } from '../mixins/useMappingsBubbles'
-
-export default class extends Controller {
-
- static values = {
- mappingsList: Object,
- zoomRatio: { type: Number, default: 1 },
- acronym: String,
- containerId: { type: String, default: 'mappings-bubbles-view' }
- }
-
- static targets = ['frame', 'bubbles', 'submit', 'modal', 'selector', 'ontologies', 'loader']
-
- connect () {
-
- this.drawBubbles = (mappingsList) => {
- const zoomRatio = this.zoomRatioValue
- const width = 600 * zoomRatio
- const height = 600 * zoomRatio
- const margin = 1
- const logScaleFactor = 10
- const normalization_ratio = this.#normalizationRatio(mappingsList)
-
- const data = Object.entries(mappingsList).map(([key, value]) => ({
- ontology_name: key.split('/').pop(),
- ontology_mappings: value,
- }))
- this.bubblesTarget.innerHTML = ''
- useMappingsDrawBubbles(data, width, height, margin, this.bubblesTarget, normalization_ratio, logScaleFactor)
-
- this.#centerScroll(this.frameTarget)
- }
-
- this.drawBubbles(this.mappingsListValue)
-
- if (this.#selectionDisabled()) {
- this.#clickOnSelectedAcronymBubble()
- }
-
- }
-
- filterOntologies () {
- const selectOptions = Array.from(this.ontologiesTarget.querySelector('select').selectedOptions)
- const acronyms = selectOptions.map(option => option.value)
-
- const filteredList = Object.fromEntries(
- Object.entries(this.mappingsListValue).filter(([key]) => acronyms.includes(key))
- )
-
- this.drawBubbles(filteredList)
- }
-
- submit (event) {
- const itemElement = event.currentTarget.querySelector('.item')
- if (!itemElement) return
-
- this.submitTarget.click()
-
- const selectAcronym = event.currentTarget.querySelector('select').value
-
- const bubblesContainer = document.getElementById(this.containerIdValue)
- const selectedBubble = bubblesContainer.querySelector('[data-selected="true"]')
- const currentBubble = bubblesContainer.querySelector(`[data-acronym="${selectAcronym}"]`)
-
- if (selectedBubble && selectedBubble.dataset.acronym === selectAcronym) return
-
- const clickEvent = new MouseEvent('click', { bubbles: true, cancelable: true, view: window })
-
- if (currentBubble && (currentBubble.getAttribute('data-enabled') === 'false' || currentBubble.getAttribute('data-highlighted') === 'true')) {
- selectedBubble.dispatchEvent(clickEvent)
- }
-
- if (currentBubble) currentBubble.dispatchEvent(clickEvent)
- }
-
- zoomIn () {
- this.zoomRatioValue++
- this.drawBubbles(this.mappingsListValue)
- }
-
- zoomOut () {
- if (this.zoomRatioValue > 1) {
- this.zoomRatioValue--
- this.drawBubbles(this.mappingsListValue)
- }
- }
-
- selectBubble (event) {
- const selected_bubble = event.currentTarget
-
- if (selected_bubble.getAttribute('data-enabled') === 'false') {
- // user clicks on a bubble that is disabled (has no mappings with the current bubble) do nothing
- return
- }
-
- this.#toggleAnimation()
-
- if (selected_bubble.getAttribute('data-highlighted') === 'true') {
- // user clicks on a bubble that have mapping with the current highlighted bubble, should show a modal with the mappings
- this.#showMappingsModal(selected_bubble)
- this.#toggleAnimation()
- } else if (selected_bubble.getAttribute('data-selected') === 'true') {
- // user clicks on current bubble (should deselect it, but nothing happen if we're in ontology mappings section not the page)
- this.#unSelectBubble(selected_bubble)
- this.#toggleAnimation()
- } else {
- this.#selectBubble(selected_bubble)
- }
- }
-
- #selectBubble (selected_bubble) {
-
- const acronym = selected_bubble.getAttribute('data-acronym')
- let url = '/mappings/count/' + acronym
- selected_bubble.setAttribute('data-selected', 'true')
-
- if (this.#selectionEnabled()) {
- const input = this.selectorTarget.querySelector('input')
- input.value = acronym
- input.dispatchEvent(new Event('input', { bubbles: true }))
-
- const selectValue = Array.from(this.selectorTarget.querySelectorAll('.option'))
- .find(option => option.getAttribute('data-value') === acronym)
-
- if (selectValue) selectValue.click()
- }
-
- this.#fetchMappingsDataAndSetBubblesColor(url)
- }
-
- #unSelectBubble (selected_bubble) {
-
- if (this.#selectionDisabled()) return
-
- selected_bubble.setAttribute('data-selected', 'false')
-
- const selected_circle = selected_bubble.querySelector('circle')
- selected_circle.style.fill = 'var(--primary-color)'
-
- const leafs = this.bubblesTarget.querySelectorAll('.leaf')
- leafs.forEach(leaf => {
- const circle = leaf.querySelector('circle')
- circle.style.fill = 'var(--primary-color)'
- circle.style.opacity = '1'
- leaf.setAttribute('data-enabled', 'true')
- leaf.setAttribute('data-highlighted', 'false')
- })
- }
-
- #showMappingsModal (selected_bubble) {
- const selected_leaf = this.bubblesTarget.querySelector('[data-selected="true"]')
- const acronym = selected_leaf.getAttribute('data-acronym')
- const target_acronym = selected_bubble.getAttribute('data-acronym')
- this.modalTarget.querySelector('a').href = `/mappings/show_mappings?id=${acronym}&target=${target_acronym}`
- this.modalTarget.querySelector('a').click()
- }
-
- #fetchMappingsDataAndSetBubblesColor (url) {
- fetch(url, {
- method: 'GET',
- headers: {
- 'Accept': 'application/json'
- },
- })
- .then(response => {
- if (!response.ok) {
- throw new Error('Network response was not ok')
- }
- return response.json()
- })
- .then(data => {
- const mappings_list = data.map(item => ({
- acronym: item.target_ontology.acronym,
- count: item.count
- }))
-
- this.#setBubblesColors(mappings_list)
-
- this.#toggleAnimation()
- })
- .catch(error => {
- console.error('Error fetching or processing data:', error)
- // Handle errors here
- })
- }
-
- #setBubblesColors (mappings_list) {
- const bubblesContainer = this.bubblesTarget
- const leafs = bubblesContainer.querySelectorAll('.leaf')
- const max_mappings_count = mappings_list.reduce((max, item) => Math.max(max, item.count), -Infinity)
-
- leafs.forEach(leaf => {
- const circle = leaf.querySelector('circle')
- const acronym = leaf.getAttribute('data-acronym')
-
- const matchingMapping = mappings_list.find(item => item.acronym === acronym)
-
- if (matchingMapping) {
- leaf.setAttribute('data-highlighted', 'true')
- circle.style.fill = 'var(--primary-color)'
-
- const opacity = (matchingMapping.count / max_mappings_count + Math.log(matchingMapping.count + 1)) / 10 + 0.3
- circle.style.opacity = `${opacity}`
- } else {
- leaf.setAttribute('data-enabled', 'false')
- circle.style.fill = 'var(--light-color)'
- }
- })
-
- const selected_leaf = bubblesContainer.querySelector('[data-selected="true"]')
- selected_leaf.setAttribute('data-enabled', 'true')
-
- const selected_circle = selected_leaf.querySelector('circle')
- selected_circle.style.fill = 'var(--secondary-color)'
- }
-
-
-
- #centerScroll (frame) {
- frame.scrollTop = frame.scrollHeight / 2 - frame.clientHeight / 2
- frame.scrollLeft = frame.scrollWidth / 2 - frame.clientWidth / 2
- }
-
- #normalizationRatio (ontologies_hash) { // try to find the biggest multiple of 10 inferior to the max mappings value
- const maxValue = Math.max(...Object.values(ontologies_hash))
- let normalization_ratio = 1
- while (maxValue / normalization_ratio > 10) {
- normalization_ratio *= 10
- }
- return normalization_ratio
- }
-
- #toggleAnimation () {
- this.loaderTarget.classList.toggle('d-none')
- this.bubblesTarget.classList.toggle('d-none')
- }
-
- #selectionEnabled () {
- return !this.hasAcronymValue
- }
-
- #selectionDisabled () {
- return !this.#selectionEnabled()
- }
-
- #clickOnSelectedAcronymBubble () {
- setTimeout(() => {
- const currentBubble = this.bubblesTarget.querySelector(`[data-acronym="${this.acronymValue}"]`)
- let clickEvent = new MouseEvent('click', {
- bubbles: true,
- cancelable: true,
- view: window
- })
- currentBubble.dispatchEvent(clickEvent)
- }, 100)
-
- }
-}
\ No newline at end of file
diff --git a/app/javascript/controllers/ontologies_selector_controller.js b/app/javascript/controllers/ontologies_selector_controller.js
deleted file mode 100644
index 32ebd13d5..000000000
--- a/app/javascript/controllers/ontologies_selector_controller.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import {Controller} from "@hotwired/stimulus"
-
-export default class extends Controller {
- static targets = ['submit', 'ontology', 'table', 'exit']
- static values = {
- id: String,
- selectAll: String,
- unselectAll: String
- }
- input(){
- this.submitTarget.click()
- }
- change(event){
- this.submitTarget.click()
- this.#updateTableNumbers(event)
- }
- selectall(event) {
- const selectText = `\n${this.selectAllValue}\n`;
- const unselectText = `\n${this.unselectAllValue}\n`;
- const isChecked = event.target.innerHTML === unselectText;
- const newInnerHTML = isChecked ? selectText : unselectText;
- for (const target of this.ontologyTargets) {
- target.querySelector('input').checked = !isChecked;
- }
- event.target.innerHTML = newInnerHTML;
- }
- apply() {
- const select = document.getElementById(`select_${this.idValue}`);
- const tsControl = document.getElementById(`select_${this.idValue}-ts-control`);
- const values = this.#selectedOntologies(this.ontologyTargets);
- for (const value of values) {
- tsControl.value = value;
- tsControl.dispatchEvent(new Event('input', { bubbles: true }));
- select.parentNode.querySelector(`div[data-value="${value}"]`).click();
- }
- this.exitTarget.click();
- }
- clear() {
- const selectedItems = document.getElementById(`select_${this.idValue}`).parentNode.querySelectorAll('a');
- selectedItems.forEach(item => {
- item.click();
- });
- }
-
- #selectedOntologies(ontologies) {
- return ontologies
- .filter(ontology => ontology.querySelector('input').checked)
- .map(ontology => ontology.querySelector('input').name);
- }
-
- #updateTableNumbers() {
- const navItems = Array.from(this.tableTarget.querySelectorAll('.nav-item'));
- navItems.forEach(item => this.#updateNavItemCount(item));
- }
-
- #updateNavItemCount(navItem) {
- const tabPane = this.tableTarget.querySelector(`.tab-pane${navItem.getAttribute('data-target')}`);
- const inputs = tabPane.querySelectorAll('input');
- const count = Array.from(inputs).filter(input => input.checked).length;
- const itemTitleElement = navItem.querySelector('a');
- let itemTitle = itemTitleElement.innerHTML.trim();
- const regex = /\(\d+\)/;
- if (itemTitle.endsWith(")")) {
- itemTitleElement.innerHTML = itemTitle.replace(regex, `(${count})`);
- } else {
- itemTitleElement.innerHTML = `${itemTitle} (${count})`;
- }
- if (count === 0) {
- itemTitleElement.innerHTML = itemTitle.replace(regex, '').trim();
- }
- }
-}
\ No newline at end of file
diff --git a/app/javascript/controllers/ontology_relations_network_controller.js b/app/javascript/controllers/ontology_relations_network_controller.js
deleted file mode 100644
index 75ea02909..000000000
--- a/app/javascript/controllers/ontology_relations_network_controller.js
+++ /dev/null
@@ -1,189 +0,0 @@
-import {Controller} from "@hotwired/stimulus"
-import { Network, DataSet } from 'vis-network/standalone/esm/vis-network.min.js';
-
-// Connects to data-controller="ontology-relations-network"
-export default class extends Controller {
- static values = {
- data: Array
- }
-
- static targets = ["container"]
-
- connect() {
- this.build()
- }
-
-
- build(){
- this.#buildNetwork(this.dataValue);
- }
- /**
- * Build the VIS network for ontologies relations: http://visjs.org/docs/network/
- * @param ontologyRelationsArray
- */
- #buildNetwork(ontologyRelationsArray) {
- const nodes = new DataSet([])
- // create an array with edges
- const edges = new DataSet();
-
- let propertyCount = 1; // To define nodes IDs
-
- // Hash with nodes id for each ontology URI
- let nodeIds = {};
-
- /* Get the relations that have been selected
- if (jQuery("#selected_relations").val() !== null) {
- selected_relations = jQuery("#selected_relations").val()
- }*/
-
- let selected_relations = [];
- this.relationCheckTargets = Array.from(this.element.querySelectorAll('option'))
- this.relationCheckTargets.forEach((elem) => {
- if (elem.selected) {
- selected_relations.push(elem.value);
- }
- })
-
- ontologyRelationsArray.forEach((relation) => {
- let targetNodeNumber
- let sourceNodeNumber
-
- // If relations have been selected for filtering then we don't show others relations
- if (!selected_relations.includes(relation["relation"])) {
- return
- }
-
- // Don't create a new node if node exist already, just add a new edge
- if ( nodeIds[relation["source"]] != null) {
- sourceNodeNumber = nodeIds[relation["source"]];
- } else {
- sourceNodeNumber = propertyCount;
- // If the node is the source it means it is from the Portal, so we colorate it in green
- nodes.add([
- {id: sourceNodeNumber, label: relation["source"], color: "#5cb85c"}
- ]);
- nodeIds[relation["source"]] = propertyCount;
- propertyCount++;
- }
-
- // Create the target node if don't exist
- if (nodeIds[relation["target"]] != null) {
- targetNodeNumber = nodeIds[relation["target"]];
- } else {
- targetNodeNumber = propertyCount;
- // If target node is an ontology from the portal then node in green
- if (relation["targetInPortal"]) {
- nodes.add([
- {id: targetNodeNumber, label: relation["target"], color: "#5cb85c"}
- ]);
- } else {
- nodes.add([
- {id: targetNodeNumber, label: relation["target"]}
- ]);
- }
- nodeIds[relation["target"]] = propertyCount;
- propertyCount++;
- }
-
- edges.add([
- {
- from: sourceNodeNumber,
- to: targetNodeNumber,
- label: relation["relation"],
- font: {align: 'horizontal'}
- }
- ]);
- })
-
-
-
- // create a network
- const container = this.containerTarget;
- // provide the data in the vis format
-
- const data = {
- nodes: nodes,
- edges: edges
- };
-
- // Get height of div
- const networkHeight = container.clientHeight.toString();
-
- const options = {
- autoResize: true,
- groups: {
- useDefaultGroups: true,
- myGroupId: {
- /*node options*/
- }
- },
- edges: {
- color: {inherit: 'both'},
- smooth: {
- enabled: true,
- type: "dynamic",
- roundness: 0.5
- }
- },
- nodes: {
- shape: "box"
- },
- physics: {
- // http://visjs.org/docs/network/physics.html
- enabled: true,
- // To stabilize faster, increase the minVelocity value
- minVelocity: 1,
- stabilization: {
- enabled: true,
- onlyDynamicEdges: false,
- fit: true
- },
- barnesHut: {
- gravitationalConstant: -1500,
- centralGravity: 0,
- springLength: 300,
- springConstant: 0.01,
- damping: 0.2,
- avoidOverlap: 0.2
- },
- hierarchicalRepulsion: { // not used at the moment
- centralGravity: 0.0,
- springLength: 500,
- springConstant: 0.2,
- damping: 1,
- nodeDistance: 170
- },
- solver: 'barnesHut'
- },
- interaction: {
- zoomView: false,
- navigationButtons: true
- }
- };
-
- // initialize your network!
- const network = new Network(container, data, options);
- network.fit();
- // Add a button click event listener
- var fullscreenButton = document.getElementById('fullscreen-button');
- fullscreenButton.addEventListener('click', function () {
- toggleFullScreen(container);
- });
-
- // Function to toggle full screen mode
- function toggleFullScreen(element) {
- var networkContainer = document.getElementById('networkContainer');
-
- // check to existance of element
- if (networkContainer) {
- var parentElement = networkContainer.parentNode;
-
- // add style background:
- parentElement.style.backgroundColor = 'white';
- }
- networkContainer.parentNode.classList.toggle('active-fullscreen');
- networkContainer.style.height = "100%";
- networkContainer.style.width = "100%";
- }
- }
-}
diff --git a/app/javascript/controllers/recommender_controller.js b/app/javascript/controllers/recommender_controller.js
deleted file mode 100644
index e753a7ace..000000000
--- a/app/javascript/controllers/recommender_controller.js
+++ /dev/null
@@ -1,60 +0,0 @@
-import { Controller } from "@hotwired/stimulus"
-
-// Connects to data-controller="recommender"
-export default class extends Controller {
- static targets = ['button', 'input', 'result', 'maxset', 'empty', 'ontologieschoice']
-
- connect(){
- if(document.querySelector('input[name="highlighted_recommendation"]:checked') !== null){
- this.handleHighlightedChange()
- }
-
- let ontologies_choice = this.ontologieschoiceTarget.childNodes[1].childNodes[1]
- if(!ontologies_choice.checked){
- this.togglesets()
- }
- }
- edit(event){
- this.#toggle(this.buttonTarget)
- this.#toggle(event.currentTarget)
- this.#toggle(this.inputTarget)
- this.#toggle(this.resultTarget)
- }
- togglesets(){
- this.#toggle(this.maxsetTarget)
- this.#toggle(this.emptyTarget)
- }
-
- handleHighlightedChange(){
- let recommandations_area = this.resultTarget
- let jsonString = document.querySelector('input[name="highlighted_recommendation"]:checked').value;
- let jsonStringModified = jsonString.replace(/:text/g, '"text"').replace(/:link/g, '"link"').replace(/=>/g, ':');
- let jsonArray = JSON.parse(jsonStringModified);
- var words = recommandations_area.textContent.split(/\s+/);
- for (var i = 0; i < words.length; i++) {
- var word = words[i].replace(/[.,\/#!$%\^&\*;:{}=\-_`~()]/g, '').toLowerCase(); // Remove punctuation and convert to lowercase
- var foundItem = jsonArray.find(item => item.text.toLowerCase() === word);
-
- if (foundItem) {
- // Replace the word with
tag
- words[i] = '' + words[i] + '';
- }
- }
- recommandations_area.innerHTML = words.join(' ');
- }
-
- handleInput(event){
- var selectedInputChoice = document.querySelector('input[name="input_type"]:checked').value;
- if (selectedInputChoice === "2"){
- const textarea = event.currentTarget
- const value = textarea.value;
- const lastCharIsSpace = event.data === ' ';
- const formattedValue = lastCharIsSpace ? value.trim() + ', ' : value;
- textarea.value = formattedValue;
- }
- }
-
- #toggle(element){
- element.classList.toggle('d-none')
- }
-}
diff --git a/app/javascript/controllers/sample_text_controller.js b/app/javascript/controllers/sample_text_controller.js
deleted file mode 100644
index dd6f96711..000000000
--- a/app/javascript/controllers/sample_text_controller.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import {Controller} from "@hotwired/stimulus"
-
-// Connects to data-controller="sample-text"
-export default class extends Controller {
- static targets = ['input']
- annotator_recommender(event){
- let button = event.target.closest("[data-sample-text]");
- this.inputTarget.value = button.dataset.sampleText
- }
-}
\ No newline at end of file
diff --git a/app/javascript/controllers/show_filter_count_controller.js b/app/javascript/controllers/show_filter_count_controller.js
deleted file mode 100644
index 21b3d7250..000000000
--- a/app/javascript/controllers/show_filter_count_controller.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import {Controller} from "@hotwired/stimulus"
-
-// Connects to data-controller="show-filter-count"
-
-export default class extends Controller {
- static targets = ["countSpan"]
-
- updateCount() {
- const checkInputs = this.element.querySelectorAll('input:checked')
- this.element.querySelectorAll('turbo-frame').forEach(x => {
- x.setAttribute('busy', 'true')
- })
- const count = checkInputs.length
- this.countSpanTarget.style.display = count === 0 ? "none" : "inline-block"
- this.countSpanTarget.innerHTML = count === 0 ? "" : count
- }
-}
diff --git a/app/javascript/controllers/show_modal_controller.js b/app/javascript/controllers/show_modal_controller.js
deleted file mode 100644
index f539869d8..000000000
--- a/app/javascript/controllers/show_modal_controller.js
+++ /dev/null
@@ -1,66 +0,0 @@
-import {Controller} from "@hotwired/stimulus"
-import {UseModal} from "../mixins/useModal";
-
-// Connects to data-controller="show-modal"
-export default class extends Controller {
- static values = {
- targetModal: {type: String, default: '#application_modal'},
- title: String,
- size: String,
- }
-
-
- connect() {
- this.modal = new UseModal()
- this.boundHide = this.hide.bind(this)
- this.modal.onClose(this.element, this.boundHide)
- }
-
- disconnect() {
- this.modal.onCloseRemoveEvent(this.element, this.boundHide)
- }
-
- show() {
- this.setTitle()
- this.setSize()
- let target = this.targetModalElement
- if (target) {
- this.modal.showModal(target)
- }
- }
-
- hide() {
- let target = this.targetModalElement
- if (target) {
- this.modal.hideModal(target)
- }
-
- }
-
- get targetModalElement() {
- return document.querySelector(this.targetModalValue)
- }
-
- get modalTitle() {
- return document.querySelector(`${this.targetModalValue} .modal-title`)
- }
-
- setTitle() {
- let titleElem = this.modalTitle
- if(titleElem){
- titleElem.innerHTML = this.titleValue
- }
- }
-
- setSize() {
- const target = this.targetModalElement
- const newSize = this.sizeValue
- if (target && newSize){
- const modalContainer = target.firstElementChild
- const classes = modalContainer.classList
- const oldSize = classes.item(classes.length - 1)
- modalContainer.classList.remove(oldSize)
- modalContainer.classList.add(newSize)
- }
- }
-}
diff --git a/app/javascript/controllers/simple_tree_controller.js b/app/javascript/controllers/simple_tree_controller.js
index 858bfde2c..d178b3bb3 100644
--- a/app/javascript/controllers/simple_tree_controller.js
+++ b/app/javascript/controllers/simple_tree_controller.js
@@ -1,63 +1,57 @@
-import { Controller } from '@hotwired/stimulus'
-// Connects to data-controller="simple-tree"
-export default class extends Controller {
-
- static values = {
- autoClick: { type: Boolean, default: false }
- }
-
- connect () {
- setTimeout(() => {
- let activeElem = this.element.querySelector('.tree-link.active');
- if (activeElem) {
- activeElem.scrollIntoView({ block: 'center' });
- window.scrollTo({top: 0,});
- if (this.autoClickValue) {
- activeElem.click();
- }
- }
- this.#onClickTooManyChildrenInit();
- }, 0);
- }
+import {Controller} from "@hotwired/stimulus"
+import {useSimpleTree} from "../mixins/useSimpleTree";
- select (event) {
- this.element.querySelector('a.active')?.classList.toggle('active')
- event.currentTarget.classList.toggle('active')
- this.#afterClick(event.currentTarget)
- }
+export default class extends Controller {
+ connect() {
+ this.simpleTreeCollection = useSimpleTree(this.element,
+ this.#afterClick.bind(this),
+ this.#afterAjaxError.bind(this),
+ this.#beforeAjax.bind(this)
+ )
- toggleChildren (event) {
- event.preventDefault()
- event.target.classList.toggle('fa-chevron-right')
- event.target.classList.toggle('fa-chevron-down')
- event.target.nextElementSibling.nextElementSibling.classList.toggle('hidden')
+ this.#onClickTooManyChildrenInit()
}
- #onClickTooManyChildrenInit () {
- jQuery('.too_many_children_override').live('click', (event) => {
- event.preventDefault()
- let result = jQuery(event.target).closest('ul')
- result.html('
')
+ #onClickTooManyChildrenInit(){
+ jQuery(".too_many_children_override").live('click', (event) => {
+ event.preventDefault();
+ let result = jQuery(event.target).closest("ul");
+ result.html("
");
jQuery.ajax({
url: jQuery(event.target).attr('href'),
context: result,
success: function (data) {
- this.html(data)
- this.simpleTreeCollection.get(0).setTreeNodes(this)
+ this.html(data);
+ this.simpleTreeCollection.get(0).setTreeNodes(this);
},
error: function () {
- this.html('
')
+ this.html("
");
}
- })
- })
+ });
+ });
+ }
+
+ #afterClick(node) {
+ const page_name = $(node.context).attr("data-bp-ont-page-name")
+ const conf = jQuery(document).data().bp.ont_viewer
+ const concept_id = jQuery(node).children("a").attr("id")
+ History.pushState({
+ p: "classes",
+ conceptid: concept_id
+ }, page_name + " | " + conf.org_site,
+ '?p=classes&conceptid=' + concept_id)
+ }
+
+ #afterAjaxError(node) {
+ this.simpleTreeCollection[0].option.animate = false;
+ this.simpleTreeCollection.get(0).nodeToggle(node.parent()[0]);
+ if (node.parent().children(".expansion_error").length === 0) {
+ node.parent().append("
Error, please try again");
+ }
+ this.simpleTreeCollection[0].option.animate = true;
}
- #afterClick (node) {
- this.element.dispatchEvent(new CustomEvent('clicked', {
- detail: {
- node: node,
- data: { ...node.dataset }
- }, bubbles: true
- }))
+ #beforeAjax(node) {
+ node.parent().children(".expansion_error").remove();
}
-}
+}
\ No newline at end of file
diff --git a/app/javascript/controllers/skos_collection_colors_controller.js b/app/javascript/controllers/skos_collection_colors_controller.js
deleted file mode 100644
index 58baddf4d..000000000
--- a/app/javascript/controllers/skos_collection_colors_controller.js
+++ /dev/null
@@ -1,91 +0,0 @@
-import { Controller } from '@hotwired/stimulus'
-
-// Connects to data-controller="skos-collection-colors"
-export default class extends Controller {
-
- static values = {
- collectionsColorSelectTarget: String
- }
- static targets = ['collection']
-
- connect () {
- this.allCollections = this.#collectionsChoices()
- this.selected = []
- }
-
- updateCollectionTags (event) {
- this.selected = Object.entries(event.detail.data)[0][1]
- this.collectionTargets.forEach((collectionElem) => {
- this.#updateColorsTags(collectionElem)
- })
- }
-
- #updateColorsTags (collectionElem) {
- let collections = this.#getElemCollections(collectionElem)
- let activeCollections = this.#getMatchedCollections(collectionElem, collections, this.selected)
-
- this.#removeColors(collectionElem)
- this.#addColorsTags(collectionElem, this.#getCollectionColors(activeCollections))
- }
-
- collectionTargetConnected (collectionElem) {
-
- if (this.selected.length > 0) {
- this.#updateColorsTags(collectionElem)
- }
- }
-
- #removeColors (collectionElem) {
- const childList = collectionElem.children
- if (childList && childList.length > 0) {
- collectionElem.removeChild(collectionElem.lastElementChild)
- }
- }
-
- #collectionsChoices () {
- const options = document.getElementById(this.collectionsColorSelectTargetValue)
- const out = {}
- if (options) {
- Array.from(options.options).forEach(s => {
- if (s.value !== '') {
- out[s.value] = s.dataset.color
- }
- })
- }
- return out
- }
-
- #getMatchedCollections (elem, collections, selected) {
- collections = [...new Set(collections.concat(this.#getElemActiveCollections(elem)))]
- return selected.filter(c => collections.includes(c))
- }
-
- #getCollectionColors (collectionsIds) {
- return Object.entries(this.allCollections).filter(([key]) => collectionsIds.includes(key)).map(x => x[1])
- }
-
- #getElemCollections (elem) {
- return JSON.parse(elem.dataset.collectionsValue)
- }
-
- #getElemActiveCollections (elem) {
- return JSON.parse(elem.dataset.activeCollectionsValue)
- }
-
- #addColorsTags (elem, colors) {
- const colorsContainer = document.createElement('span')
- colors.forEach(c => this.#elemAddColorTag(colorsContainer, c))
- elem.appendChild(colorsContainer)
- }
-
- #elemAddColorTag (elem, color) {
- const span = document.createElement('span')
- span.style.backgroundColor = color
- span.style.height = '10px'
- span.style.width = '10px'
- span.style.borderRadius = '50%'
- span.style.display = 'inline-block'
- span.className += 'mx-1'
- elem.appendChild(span)
- }
-}
diff --git a/app/javascript/controllers/sparql_controller.js b/app/javascript/controllers/sparql_controller.js
deleted file mode 100644
index 11a6879b2..000000000
--- a/app/javascript/controllers/sparql_controller.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import { Controller } from '@hotwired/stimulus'
-import { getYasgui } from '../mixins/useYasgui'
-
-// Connects to data-controller="sparql"
-export default class extends Controller {
- static values = {
- proxy: String,
- username: String,
- apikey: String,
- graph: String,
- }
- connect () {
- localStorage.removeItem('yagui__config');
- this.yasgui = getYasgui(this.element,
- {
- corsProxy: this.proxyValue,
- copyEndpointOnNewTab: true,
- requestConfig: {
- endpoint: this.#proxyUrl(),
- acceptHeaderGraph: false,
- acceptHeaderUpdate: false,
- namedGraphs: [this.graphValue],
- }
- })
-
- }
-
- #proxyUrl(){
- return `${this.proxyValue}?apikey=${this.apikeyValue}&username=${this.usernameValue}`
- }
-}
diff --git a/app/javascript/controllers/text_truncate_controller.js b/app/javascript/controllers/text_truncate_controller.js
deleted file mode 100644
index b3c235e83..000000000
--- a/app/javascript/controllers/text_truncate_controller.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import ReadMore from "stimulus-read-more";
-
-// Connects to data-controller="text-truncate"
-export default class extends ReadMore {
- static targets = ['button']
-
- connect() {
- super.connect()
- if (!this.#isTextClamped()) {
- this.#hideButton()
- }
- }
-
- #isTextClamped() {
- return this.contentTarget.scrollHeight > this.contentTarget.clientHeight
- }
-
- #hideButton() {
- this.buttonTarget.style.display = 'none'
- }
-}
diff --git a/app/javascript/controllers/tooltip_controller.js b/app/javascript/controllers/tooltip_controller.js
deleted file mode 100644
index 60fd3d7e9..000000000
--- a/app/javascript/controllers/tooltip_controller.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import {Controller} from "@hotwired/stimulus"
-import useTooltip from "../mixins/useTooltip";
-
-// Connects to data-controller="tooltip"
-export default class extends Controller {
-
- static values = {
- position: {type: String, default: 'top'},
- interactive: {type: Boolean, default: false}
- }
-
- connect() {
- if (this.element.title && this.element.title !== '') {
- useTooltip(this.element, {interactive: this.interactiveValue, placement: this.positionValue})
- }
-
- }
-
-}
diff --git a/app/javascript/controllers/topnav_responsiveness_controller.js b/app/javascript/controllers/topnav_responsiveness_controller.js
deleted file mode 100644
index 218919ff8..000000000
--- a/app/javascript/controllers/topnav_responsiveness_controller.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import { Controller } from "@hotwired/stimulus"
-
-// Connects to data-controller="topnav-responsiveness"
-export default class extends Controller {
- static targets = ['navMenu']
-
- connect() {
- let checkbox = this.navMenuTarget
- let divs = document.querySelectorAll('.top-nav, .top-nav-ul, .nav-items, .nav-ul-li, .nav-input, .nav-a, .nav-language, .supportMenuDropdownLink');
- checkbox.addEventListener('change', function() {
- if (this.checked) {
- divs.forEach(function(div) {
- div.classList.add('show-responsive');
- });
- } else {
- divs.forEach(function(div) {
- div.classList.remove('show-responsive');
- });
- }
- });
- }
-}
diff --git a/app/javascript/mixins/cookie.js b/app/javascript/mixins/cookie.js
deleted file mode 100644
index 5e2b5bf0d..000000000
--- a/app/javascript/mixins/cookie.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export const getCookie = (name) => {
- const cookieValue = document.cookie.match('(^|[^;]+)\\s*' + name + '\\s*=\\s*([^;]+)');
- return cookieValue ? cookieValue.pop() : '';
-}
-
-export const setCookie = (name, value, days) => {
- document.cookie = `${name}=${value};max-age=${days * 24 * 60 * 60}`;
-}
\ No newline at end of file
diff --git a/app/javascript/mixins/useChosen.js b/app/javascript/mixins/useChosen.js
deleted file mode 100644
index 5f2c6c541..000000000
--- a/app/javascript/mixins/useChosen.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export function useChosen(element, params, onChange = null) {
- const chosen = $(element).chosen(params)
- if(onChange){
- chosen.change(onChange)
- }
-
- return chosen;
-}
\ No newline at end of file
diff --git a/app/javascript/mixins/useFairScore.js b/app/javascript/mixins/useFairScore.js
deleted file mode 100644
index 02b12f95b..000000000
--- a/app/javascript/mixins/useFairScore.js
+++ /dev/null
@@ -1,631 +0,0 @@
-function round(val , base = 1){
- return Math.floor( val * 100 * base) / 100
-}
-
-function getObtainedNotObtainedNA(scoresIn, portalMax , max , normalize = true){
- const delimiter = (val) => (normalize ? val : 1)
- const notObtained = portalMax.map((x,i) => {
- return round((x - scoresIn[i]) / delimiter(max[i]) ,(normalize ? 100 : 1))
- })
- const na = max.map((x,i) => {
- return round((x - portalMax[i]) / delimiter(max[i]), (normalize ? 100 : 1))
- })
-
- const scores = scoresIn.map((x, i ) => {
- return round(x / delimiter(max[i]), (normalize ? 100 : 1))
- })
- return {scores , notObtained , na}
-}
-
-function printScore(score, normalizedScore){
- return score +" "+'('+normalizedScore+"%)"
-}
-
-
-class FairScoreChartContainer{
- constructor(fairChartsContainerId , charts) {
- this.fairChartsContainer = jQuery("#"+fairChartsContainerId)
- this.fairAverageScoreSpan = jQuery("#fair-score-average")
- this.fairMinScoreSpan = jQuery("#fair-score-min")
-
- this.fairMaxScoreSpan = jQuery("#fair-score-max")
-
-
- this.fairMedianScoreSpan = jQuery("#fair-score-median")
-
-
- this.requestLink = jQuery("#fairness-service-url")
- this.requestHrefBase = (this.requestLink != null ?this.requestLink.attr("href") : "")
-
- this.fairSpinner = jQuery("")
- this.fairMsgErr = jQuery(" We could not collect the data from the fairness service
")
- this.fairMsgErr.hide()
- this.fairChartsContainer.before(this.fairSpinner)
- this.fairChartsContainer.before(this.fairMsgErr)
- this.charts = charts
- }
-
-
- ajaxCall(ontologies){
- return new Promise( (resolve ,reject) => {
- $.get( "/ajax/fair_score/json/?ontologies="+ontologies, (data) => {
- if(data) {
- resolve(data)
- }else {
- reject("error")
- }
- }).fail(function(err) {
- reject("error")
- })
- })
- }
- getFairScoreData(ontologies) {
- if(this.fairChartsContainer){
- this.hideMsgError()
- this.showLoader();
- this.#updateLink(ontologies)
- this.ajaxCall(ontologies).then(data => {
- this.hideLoader()
- this.charts.forEach( x => x.setFairScoreData(data))
- this.#fillScoreSpans(data)
- }).catch(err => {
- this.hideLoader()
- this.showMsgError()
- })
- }
-
-
- }
-
- showMsgError(){
- this.fairChartsContainer.hide()
- this.fairMsgErr.show()
- }
-
- hideMsgError(){
- this.fairMsgErr.hide()
- this.fairChartsContainer.show()
- }
- showLoader(){
- this.fairChartsContainer.hide()
- this.fairSpinner.show()
- }
- hideLoader(){
- this.fairSpinner.hide()
- this.fairChartsContainer.show()
- }
-
- #updateLink(ontologies){
- if(this.requestLink){
- this.requestLink.attr("href" , this.requestHrefBase + "&ontologies=" + ontologies
- + (ontologies==="all" || ontologies.includes(",") ? "&combined": ""))
-
- }
- }
- #fillScoreSpans(data){
-
- if(this.fairAverageScoreSpan){
- this.fairAverageScoreSpan.html(printScore(data.score,data.normalizedScore))
- }
-
- if(data.resourceCount > 1){
- this.#showScoreLabel(this.fairMinScoreSpan, data.minScore, data.maxCredits)
- this.#showScoreLabel(this.fairMaxScoreSpan, data.maxScore, data.maxCredits)
- this.#showScoreLabel(this.fairMedianScoreSpan, data.medianScore, data.maxCredits)
-
- }else {
- this.#hideScoreLabel((this.fairMinScoreSpan))
- this.#hideScoreLabel((this.fairMaxScoreSpan))
- this.#hideScoreLabel((this.fairMedianScoreSpan))
- }
-
-
- }
-
- #showScoreLabel(elem, score , maxCredits){
- if(elem){
- elem.parent().parent().show()
- elem.html(printScore(score,round(score/maxCredits , 100)))
- }
-
- }
-
- #hideScoreLabel(elem){
- if(elem)
- elem.parent().parent().hide()
- }
-}
-
-class FairScoreChart{
- constructor(fairCanvasId , dataField) {
- this.dataField = dataField
- this.fairScoreChartCanvas = jQuery("#"+fairCanvasId)
- this.chart= null
- }
-
- setFairScoreData(data){
- if(this.fairScoreChartCanvas){
- Object.entries(data[this.dataField]).forEach( ([key, value]) => this.fairScoreChartCanvas.data(key , value))
- this.fairScoreChartCanvas.data("resourceCount" , data["resourceCount"])
- if(this.chart === null)
- this.chart = this.initChart()
- else {
- this.chart.data.datasets = this.getFairScoreDataSet()
- this.chart.update()
- }
- }
-
- }
-
- getFairScoreDataSet(){
- return []
- }
-
- initChart(){
- return new Chart(this.fairScoreChartCanvas , {})
- }
-
-}
-
-class FairScorePrincipleBar extends FairScoreChart{
-
- constructor(fairCanvasId) {
- super(fairCanvasId , 'principles');
- }
- initChart() {
- const labels = this.fairScoreChartCanvas.data('labels')
- const data = {
- labels: labels,
- datasets: this.getFairScoreDataSet()
- };
- const config = {
- type: 'horizontalBar',
- data: data,
- options: {
- title: {
- display: false,
- text: 'FAIRness Scores'
- },
- elements: {
- bar: {
- borderWidth: 2,
- }
- },
- indexAxis: 'y',
- legend: {
- display: true
- },
- scales: {
- xAxes: [{
- stacked: true,
- ticks: {
- beginAtZero: true
- }
- }],
- yAxes: [{
- stacked: true,
- ticks: {
- beginAtZero: true
- }
- }]
- },
- tooltips: {
- callbacks: {
- label: function (tooltipItem, data) {
- let score =jQuery(this._chart.canvas).data("scores")[tooltipItem.index]
- let maxScore =jQuery(this._chart.canvas).data("maxCredits")[tooltipItem.index]
- let portalMaxScore =jQuery(this._chart.canvas).data("portalMaxCredits")[tooltipItem.index]
-
- let normalizedScore = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]
- let na = maxScore - portalMaxScore
- let notObtained = portalMaxScore - score
- return printScore([score, notObtained, na][tooltipItem.datasetIndex], normalizedScore)
- },
-
- }
- }
- }
- }
-
- return new Chart(this.fairScoreChartCanvas, config);
- }
- getFairScoreDataSet(){
- const maxCredits = this.fairScoreChartCanvas.data('maxCredits')
- const portalMaxCredits = this.fairScoreChartCanvas.data('portalMaxCredits')
- const {scores, notObtained , na } = getObtainedNotObtainedNA( this.fairScoreChartCanvas.data('scores') , portalMaxCredits , maxCredits )
- return [
- {
- label: 'Obtained score',
- data: scores,
- fill: true,
- backgroundColor: 'rgba(102, 187, 106, 0.2)',
- borderColor: 'rgba(102, 187, 106, 1)',
- pointBorderColor: 'rgba(102, 187, 106, 1)',
- pointBackgroundColor: 'rgba(102, 187, 106, 1)'
- },
- {
- label: 'Not obtained score',
- data: notObtained,
- fill: true,
- backgroundColor: 'rgba(251, 192, 45, 0.2)',
- borderColor: 'rgba(251, 192, 45, 1)',
- pointBorderColor: 'rgba(251, 192, 45, 1)',
- pointBackgroundColor: 'rgba(251, 192, 45, 1)'
- },
- {
- label: 'Not yet supported',
- data: na,
- fill: true,
- backgroundColor: 'rgba(176, 190, 197, 0.2)',
- borderColor: 'rgba(176, 190, 197, 1)',
- pointBorderColor: 'rgba(176, 190, 197, 1)',
- pointBackgroundColor: 'rgba(176, 190, 197, 1)'
- }
- ]
- }
-}
-
-class FairScoreCriteriaRadar extends FairScoreChart{
-
- constructor(fairCanvasId) {
- super( fairCanvasId , 'criteria');
- }
-
- customTooltips(){
- return function (tooltipModel) {
- // Tooltip Element
- let tooltipEl = document.getElementById('chartjs-tooltip');
- let canvas = jQuery(this._chart.canvas)
- let descriptions = canvas.data("descriptions")
- // Create element on first render
- if (!tooltipEl) {
- tooltipEl = document.createElement('div');
- tooltipEl.id = 'chartjs-tooltip';
- tooltipEl.innerHTML = '';
- document.body.appendChild(tooltipEl);
- }
-
- // Hide if no tooltip
- if (tooltipModel.opacity === 0) {
- tooltipEl.style.opacity = 0;
- return;
- }
-
- // Set caret Position
- tooltipEl.classList.remove('above', 'below', 'no-transform');
- if (tooltipModel.yAlign) {
- tooltipEl.classList.add(tooltipModel.yAlign);
- } else {
- tooltipEl.classList.add('no-transform');
- }
-
- function getBody(bodyItem) {
- return bodyItem.lines;
- }
- // Set Text
- if (tooltipModel.body) {
- let titleLines = tooltipModel.title || [];
- let bodyLines = tooltipModel.body.map(getBody);
-
- let innerHtml = '';
-
- titleLines.forEach(function(title ,index) {
- innerHtml += '' + title + ' : '+ descriptions[tooltipModel.dataPoints[0].index] + ' |
';
- });
- innerHtml += '';
-
- bodyLines.forEach(function(body, i) {
- let colors = tooltipModel.labelColors[i];
- let style = 'background:' + colors.backgroundColor;
- style += '; border-color:' + colors.borderColor;
- style += '; border-width: 2px;';
- style += '; font-size: 12px;';
- innerHtml += '' + body + ' |
';
- });
- innerHtml += '';
-
- let tableRoot = tooltipEl.querySelector('table');
- tableRoot.innerHTML = innerHtml;
- }
-
- // `this` will be the overall tooltip
- let position = this._chart.canvas.getBoundingClientRect();
-
- // Display, position, and set styles for font
- tooltipEl.style.background = 'rgba(0, 0, 0, 0.7)';
- tooltipEl.style.borderRadius = '3px';
- tooltipEl.style.color = 'white';
- tooltipEl.style.opacity = 1;
- tooltipEl.style.position = 'absolute';
- tooltipEl.style.left = position.left + window.pageXOffset + tooltipModel.caretX + 'px';
- tooltipEl.style.top = position.top + window.pageYOffset + tooltipModel.caretY + 'px';
- tooltipEl.style.fontFamily = tooltipModel._bodyFontFamily;
- tooltipEl.style.fontSize = tooltipModel.bodyFontSize + 'px';
- tooltipEl.style.fontStyle = tooltipModel._bodyFontStyle;
- tooltipEl.style.padding = tooltipModel.yPadding + 'px ' + tooltipModel.xPadding + 'px';
- tooltipEl.style.pointerEvents = 'none';
- }
- }
-
- initChart() {
- const labels = this.fairScoreChartCanvas.data('labels')
-
- const data = {
- labels: labels,
- datasets: this.getFairScoreDataSet()
- };
- const config = {
- type: 'radar',
- data: data,
- options: {
- title: {
- display: false,
- text: 'FAIRness Wheel'
- },
- legend: {
- display: false
- },
- elements: {
- line: {
- borderWidth: 3
- }
- },
- tooltips: {
- enabled: false,
- custom: this.customTooltips(),
- callbacks: {
- label: function (tooltipItem, data) {
- let scores =jQuery(this._chart.canvas).data("scores")
- let normalizedScore = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]
- let score = scores[tooltipItem.index]
- return printScore(score, normalizedScore)
- },
-
- }
- }
- }
- }
-
- return new Chart(this.fairScoreChartCanvas, config);
- }
-
- getFairScoreDataSet() {
- const scores = this.fairScoreChartCanvas.data('normalizedScores')
- return [
- {
- label: 'Fair score',
- data: scores,
- fill: true,
- backgroundColor: 'rgba(151, 187, 205, 0.2)',
- borderColor: 'rgba(151, 187, 205, 1)',
- pointBorderColor: 'rgba(151, 187, 205, 1)',
- pointBackgroundColor: 'rgba(151, 187, 205, 1)'
- }
- ]
- }
-
-
-
-}
-class FairScoreCriteriaBar extends FairScoreChart{
- constructor(fairCanvasId) {
- super(fairCanvasId , 'criteria');
- this.questions = []
- }
- customTooltips(){
- return function (tooltipModel) {
- let tooltipContainer = document.getElementById('chartjs-tooltip-container')
- // Tooltip Element
- let tooltipEl = document.getElementById('chartjs-tooltip')
- let canvas = jQuery(this._chart.canvas)
- let questions = canvas.data("questions")
- let descriptions = canvas.data("descriptions")
- let resourceCount = canvas.data("resourceCount")
-
- // Create element on first render
- if (!tooltipEl) {
- tooltipEl = document.createElement('div');
- tooltipEl.id = 'chartjs-tooltip';
- tooltipEl.innerHTML = '';
- tooltipContainer.appendChild(tooltipEl);
- }
-
- // Hide if no tooltip
- if (tooltipModel.opacity === 0) {
- tooltipEl.style.opacity = 1;
- return;
- }
-
- // Set caret Position
- tooltipEl.classList.remove('above', 'below', 'no-transform');
- if (tooltipModel.yAlign) {
- tooltipEl.classList.add(tooltipModel.yAlign);
- } else {
- tooltipEl.classList.add('no-transform');
- }
-
- function getBody(bodyItem) {
- return bodyItem.lines;
- }
-
- // Set Text
- if (tooltipModel.body) {
- let titleLines = tooltipModel.title || [];
- let bodyLines = tooltipModel.body.map(getBody);
-
- let innerHtml = '';
-
- titleLines.forEach(function(title ,index) {
- innerHtml += '
' + title + ' : '+ descriptions[tooltipModel.dataPoints[0].index] + '
';
- });
-
- innerHtml += "
"
- bodyLines.forEach(function(body, i) {
- let colors = tooltipModel.labelColors[i];
- let style = 'background:' + colors.backgroundColor;
- style += '; border-color:' + colors.borderColor;
- style += '; border-width: 2px';
- style += '; width: 100%';
- innerHtml += '' + body + '';
- });
-
- innerHtml+='
'
-
-
- for (const [key, value] of Object.entries(questions[tooltipModel.dataPoints[0].index])) {
- let count = (value.state ? (value.state.success + value.state.average) : (value.score === value.maxCredits ? 1: 0) )
- innerHtml+=`-
- ${printScore(count,round((count / resourceCount) * 100))}
- responded successfully to: ${key}:
- "${value.question}"
`
- }
- innerHtml += '
';
-
- let tableRoot = tooltipEl.querySelector('div');
- tableRoot.innerHTML = innerHtml;
- }
-
- // `this` will be the overall tooltip
- let position = this._chart.canvas.getBoundingClientRect()
- let topOffset = tooltipModel.caretY - (tooltipEl.clientHeight / 2)
-
-
- if (topOffset <= 0)
- topOffset = 0
- else if( (topOffset + tooltipEl.clientHeight) >= position.height)
- topOffset = position.height - tooltipEl.clientHeight
-
- // Display, position, and set styles for font
- tooltipEl.style.opacity = 1;
- tooltipEl.style.position = 'absolute';
- tooltipEl.style.top = topOffset +'px';
- //tooltipEl.style.fontFamily = tooltipModel._bodyFontFamily;
- tooltipEl.style.fontSize = tooltipModel.bodyFontSize + 'px';
- tooltipEl.style.fontStyle = tooltipModel._bodyFontStyle;
- tooltipEl.style.padding = tooltipModel.yPadding + 'px ' + tooltipModel.xPadding + 'px';
- tooltipEl.style.pointerEvents = 'none';
- }
- }
- initChart() {
- const labels = this.fairScoreChartCanvas.data('labels')
- const data = {
- labels: labels,
- datasets: this.getFairScoreDataSet()
- };
- const config = {
- type: 'horizontalBar',
- data: data,
- options: {
- title: {
- display: false,
- text: 'FAIRness Scores'
- },
- elements: {
- bar: {
- borderWidth: 2,
- }
- },
- indexAxis: 'y',
- legend: {
- display: true
- },
- scales: {
- xAxes: [{
- stacked: true,
- ticks: {
- beginAtZero: true,
-
- }
- }],
- yAxes: [{
- stacked: true,
- ticks: {
- beginAtZero: true,
-
- }
- }]
- },
- tooltips: {
- enabled: false,
- mode: 'index',
- position: 'nearest',
- intersect: false,
- custom: this.customTooltips(),
- callbacks: {
- label: function (tooltipItem, data) {
- const canvas = jQuery(this._chart.canvas)
- const max = canvas.data('maxCredits')
- const scores = canvas.data('scores')
- const portalMax = canvas.data("portalMaxCredits")
-
- const label = data.datasets[tooltipItem.datasetIndex].label
- const score = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]
- const normalizedScore =Object.values(getObtainedNotObtainedNA(scores ,portalMax , max , false))[tooltipItem.datasetIndex][tooltipItem.index]
-
- return label +': '+ printScore(score, normalizedScore)
-
- }
- }
- }
-
- }
- }
-
- return new Chart(this.fairScoreChartCanvas, config);
- }
- getFairScoreDataSet(){
- const maxCredits = this.fairScoreChartCanvas.data('maxCredits')
- const portalMaxCredits = this.fairScoreChartCanvas.data('portalMaxCredits')
- const {scores , notObtained , na } = getObtainedNotObtainedNA(this.fairScoreChartCanvas.data('scores'), portalMaxCredits ,maxCredits , true)
- return [
- {
- label: 'Obtained score',
- data: scores ,
- fill: true,
- backgroundColor: 'rgba(102, 187, 106, 0.2)',
- borderColor: 'rgba(102, 187, 106, 1)',
- pointBorderColor: 'rgba(102, 187, 106, 1)',
- pointBackgroundColor: 'rgba(102, 187, 106, 1)'
- },
- {
- label: 'Not obtained score',
- data: notObtained,
- fill: true,
- backgroundColor: 'rgba(251, 192, 45, 0.2)',
- borderColor: 'rgba(251, 192, 45, 1)',
- pointBorderColor: 'rgba(251, 192, 45, 1)',
- pointBackgroundColor: 'rgba(251, 192, 45, 1)',
- },
- {
- label: 'Not yet supported',
- data: na,
- fill: true,
- backgroundColor: 'rgba(176, 190, 197, 0.2)',
- borderColor: 'rgba(176, 190, 197, 1)',
- pointBorderColor: 'rgba(176, 190, 197, 1)',
- pointBackgroundColor: 'rgba(176, 190, 197, 1)'
- }
- ]
- }
- setFairScoreData(data) {
- super.setFairScoreData(data);
- if(this.chart){
- this.showFirstToolTip()
- }
- }
-
- showFirstToolTip(){
- let meta = this.chart.getDatasetMeta(0),
- rect = this.chart.canvas.getBoundingClientRect(),
- point = meta.data[0].getCenterPoint(),
- evt = new MouseEvent('mousemove', {
- clientX: rect.left + point.x,
- clientY: rect.top + point.y
- }),
- node = this.chart.canvas;
- node.dispatchEvent(evt);
- }
-}
-
-export {round, getObtainedNotObtainedNA, FairScoreChartContainer, FairScoreChart, FairScorePrincipleBar, FairScoreCriteriaRadar, FairScoreCriteriaBar}
-
diff --git a/app/javascript/mixins/useHighLight.js b/app/javascript/mixins/useHighLight.js
deleted file mode 100644
index 7b34116f7..000000000
--- a/app/javascript/mixins/useHighLight.js
+++ /dev/null
@@ -1,88 +0,0 @@
-import hljs from 'highlight.js/lib/core'
-import xml from 'highlight.js/lib/languages/xml'
-import json from 'highlight.js/lib/languages/json'
-
-class HighLighter {
- constructor (highlighter, format) {
- switch (format) {
- case 'xml':
- highlighter.registerLanguage('xml', xml)
- break
- case 'json':
- highlighter.registerLanguage('json', json)
- break
- case 'triples':
- case 'ntriples':
- highlighter.registerLanguage('ntriples', function (hljs) {
- return {
- case_insensitive: true,
- contains: [
- {
- className: 'subject',
- begin: /^<[^>]+>/,
- },
- {
- className: 'predicate',
- begin: /<[^>]+>/,
- },
- {
- className: 'object',
- begin: /\s([^\s]+)\s\./,
- },
- hljs.COMMENT('^#', '$')
- ]
- }
- })
- break
- case 'turtle':
- highlighter.registerLanguage('turtle', function (hljs) {
- let URL_PATTERN = /(?:<[^>]*>)|(?:https?:\/\/[^\s]+)/
-
- return {
- case_insensitive: true,
- contains: [
- {
- className: 'custom-prefixes',
- begin: '@prefix',
- relevance: 10
- },
- {
- className: 'meta',
- begin: /@base/,
- end: /[\r\n]|$/,
- relevance: 10
- },
- {
- className: 'variable',
- begin: /\?[\w\d]+/
- },
- {
- className: 'custom-symbol',
- begin: /@?[A-Za-z_][A-Za-z0-9_]*(?= *:)/,
- relevance: 10
- },
- {
- className: 'custom-concepts',
- begin: /:\s*(\w+)/,
- relevance: 10
- },
- {
- className: 'string',
- begin: URL_PATTERN
- }
- ]
- }
- })
- break
- }
- this.highlighter = highlighter
- }
-
- highlight (text, format) {
- return this.highlighter.highlight(text, { language: format }).value
- }
-}
-
-export function useHighLighter (format) {
- return new HighLighter(hljs, format)
-}
\ No newline at end of file
diff --git a/app/javascript/mixins/useMappingsBubbles.js b/app/javascript/mixins/useMappingsBubbles.js
deleted file mode 100644
index 60c5a3683..000000000
--- a/app/javascript/mixins/useMappingsBubbles.js
+++ /dev/null
@@ -1,110 +0,0 @@
-import * as d3 from 'd3'
-
-class BubbleData {
- constructor(ontology_name, ontology_mappings) {
- this.ontology_name = ontology_name;
- this.ontology_mappings = ontology_mappings;
- }
-}
-
-/**
- * Draws bubbles using D3.js based on the provided data.
- * @param {Array} data - The array of BubbleData objects containing ontology names and mappings.
- * @param {number} width - The width of the SVG container.
- * @param {number} height - The height of the SVG container.
- * @param {number} margin - The margin for the SVG container.
- * @param {HTMLElement} bubblesTarget - The target HTML element to append the SVG container to.
- * @param {number} normalization_ratio - The normalization ratio for bubble size calculation.
- * @param {number} logScaleFactor - The logarithmic scale factor for bubble size calculation.
- */
-
-export function useMappingsDrawBubbles(data, width, height, margin, bubblesTarget, normalization_ratio, logScaleFactor) {
- // Define pack layout
- const pack = d3.pack()
- .size([width - margin, height - margin])
- .padding(3);
-
- // Create hierarchy and sum for bubble sizes
- const root = d3.hierarchy({ children: data })
- .sum(d => calculateBubbleSize(d));
-
- // Create SVG container
- const svg = d3.select(`#${bubblesTarget.id}`)
- .append('svg')
- .attr('width', width)
- .attr('height', height)
- .append('g')
- .attr('transform', `translate(${margin}, ${margin})`)
-
- // Create nodes and bind data
- const node = svg.selectAll('.node')
- .data(pack(root).descendants().slice(1)) // Exclude the root node
- .enter().append('g')
- .attr('class', d => d.children ? 'node mappings-bubble' : 'leaf mappings-bubble')
- .attr('transform', d => `translate(${d.x},${d.y})`)
- .attr('data-action', 'click->mappings#selectBubble')
- .attr('data-acronym', d => d.data.ontology_name)
- .attr('data-enabled', d => 'true');
-
- // Create circles
- const circle = node.append('circle')
- .attr('r', d => d.r)
- .style('fill', 'var(--primary-color)');
-
- // Display ontology names and mappings
- const textOntology = node.append('text')
- .attr('dy', '.35em')
- .style('text-anchor', 'middle')
- .style('font-size', '16px')
- .style('fill', 'white')
- .style('font-weight', '600')
- .text(d => displayOntologyName(d));
-
- const textMappings = node.append('text')
- .attr('dy', '1.5em')
- .style('text-anchor', 'middle')
- .style('font-size', '12px')
- .style('fill', 'white')
- .text(d => displayMappings(d));
-
- // Show tooltips on hover
- circle.on('mouseover', (event, d) => showTooltip(event, d))
- .on('mouseout', () => hideTooltip());
-
- // Function to calculate bubble size
- function calculateBubbleSize(d) {
- return d.ontology_mappings / normalization_ratio + Math.log(d.ontology_mappings + 1) / logScaleFactor;
- }
-
- // Function to display ontology name
- function displayOntologyName(d) {
- return (d.r > d.data.ontology_name.length * 5 && d.r > 20) ? d.data.ontology_name : '';
- }
-
- // Function to display mappings count
- function displayMappings(d) {
- return (d.r > d.data.ontology_name.length * 5 && d.r > 20) ? d.data.ontology_mappings : '';
- }
-
- // Function to show tooltip
- function showTooltip(event, d) {
- if (!(d.r > d.data.ontology_name.length * 5 && d.r > 20)) {
- // Remove existing tooltip
- d3.selectAll('.bubble-tooltip').remove();
-
- // Calculate tooltip position based on mouse coordinates
- const tooltip = d3.select('body')
- .append('div')
- .attr('class', 'bubble-tooltip')
- .style('left', `${event.pageX + 10}px`) // Adjust position relative to mouse pointer
- .style('top', `${event.pageY + 10}px`) // Adjust position relative to mouse pointer
- .html(`${d.data.ontology_name}
${d.data.ontology_mappings}`);
- }
- }
-
- // Function to hide tooltip
- function hideTooltip() {
- // Remove tooltip on mouseout
- d3.selectAll('.bubble-tooltip').remove();
- }
-}
diff --git a/app/javascript/mixins/useModal.js b/app/javascript/mixins/useModal.js
deleted file mode 100644
index 2a5c34239..000000000
--- a/app/javascript/mixins/useModal.js
+++ /dev/null
@@ -1,18 +0,0 @@
-export class UseModal {
-
- showModal(element) {
- $(element).modal('show')
- }
-
- hideModal(element) {
- $(element).modal('hide')
- }
-
- onClose(element, callback) {
- return $(element).on('hidden.bs.modal', callback)
- }
- onCloseRemoveEvent(element, callback){
- return element.removeEventListener('hidden.bs.modal', callback)
- }
-}
-
diff --git a/app/javascript/mixins/useTomSelect.js b/app/javascript/mixins/useTomSelect.js
deleted file mode 100644
index 7b4923d02..000000000
--- a/app/javascript/mixins/useTomSelect.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import TomSelect from "tom-select"
-
-export function useTomSelect(element, params, onChange = null) {
- const tom = new TomSelect(element,params)
- if(onChange){
- tom.on('change',onChange)
- }
- return tom;
-}
\ No newline at end of file
diff --git a/app/javascript/mixins/useTooltip.js b/app/javascript/mixins/useTooltip.js
deleted file mode 100644
index 805978000..000000000
--- a/app/javascript/mixins/useTooltip.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import tippy from 'tippy.js';
-
-export default function useTooltip(elem, params) {
- const content = elem.title
- elem.removeAttribute('title')
- tippy(elem, {
- theme: 'light-border',
- animation: 'fade',
- content: content,
- allowHTML: true,
- maxWidth: '400', ...params
- })
-}
\ No newline at end of file
diff --git a/app/javascript/mixins/useYasgui.js b/app/javascript/mixins/useYasgui.js
deleted file mode 100644
index e13188157..000000000
--- a/app/javascript/mixins/useYasgui.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import Yasgui from "@triply/yasgui";
-
-export const getYasgui = (elem, config) => {
- return new Yasgui(elem, config)
-}
-
diff --git a/app/views/concepts/_child_nodes.html.haml b/app/views/concepts/_child_nodes.html.haml
index 5479ebcfd..7a2e76c50 100644
--- a/app/views/concepts/_child_nodes.html.haml
+++ b/app/views/concepts/_child_nodes.html.haml
@@ -1,6 +1,6 @@
- output =""
- for child in @children
- - output << tree_link_to_concept(li_id: short_uuid, child: child, ontology_acronym: child.explore.ontology.acronym, active_style: '', node: @concept)
+ - output << tree_link_to_concept(li_id: short_uuid, child: child, ontology_acronym: child.explore.ontology.acronym, active_style: '')
- if child.hasChildren
- output << tree_link_to_children(li_id: short_uuid, child: child)
- output << ""
diff --git a/app/views/concepts/_show.html.haml b/app/views/concepts/_show.html.haml
index 2419a1633..f6b67d557 100644
--- a/app/views/concepts/_show.html.haml
+++ b/app/views/concepts/_show.html.haml
@@ -1,50 +1,39 @@
-= turbo_frame_tag 'concept_show' do
- %div.hide-if-loading.fade.show
- / When we have an ontology with a flat hierarchy, we initially disable the tabs because we don't have a class to display
- - if @concept.id.eql?("bp_fake_root")
- %div{:style => "padding: 100px 0; font-size: larger; font-weight: bold; text-align: center;"}
- Use the "Jump To" to find a class and display details, visualization, notes, and mappings
- - else
- .cls-info-container
-
- %ul.nav.nav-tabs.tabs
- %li#details_top.nav-item
- %a.nav-link.active.py-1{:href => "#details" , data:{toggle: 'tab', target: '#details_content'}} Details
- %li#visualization_top.nav-item
- %a.nav-link.py-1{:href => "#visualization", data:{toggle: 'tab', target: '#visualization_content'}} Visualization
- %li#notes_top.nav-item
- %a.nav-link.py-1{:href => "#notes", data:{toggle: 'tab', target: '#notes_content'}}
- Notes
- %span#note_count_wrapper
- (
- %span#note_count= @notes.length
- )
- %li#mappings_top.nav-item
- %a.nav-link.py-1{:href => "#mappings", data:{toggle: 'tab', target: '#mappings_content'}}
- Class Mappings (
- %span#mapping_count= @mappings.size
+= render TurboFrameComponent.new(id: 'concept_show', data: { turbo: false }) do
+ - if @concept.id.eql?("bp_fake_root")
+ %div{:style => "padding: 100px 0; font-size: larger; font-weight: bold; text-align: center;"}
+ Use the "Jump To" to find a class and display details, visualization, notes, and mappings
+ - else
+ .cls-info-container
+ %ul.nav.nav-tabs.tabs
+ %li#details_top.nav-item
+ %button.nav-link.active.py-1{:href => "#details" , data:{'bs-toggle': 'tab', 'bs-target': '#details_content'}} Details
+ %li#visualization_top.nav-item
+ %button.nav-link.py-1{:href => "#visualization", data:{'bs-toggle': 'tab', 'bs-target': '#visualization_content'}} Visualization
+ %li#notes_top.nav-item
+ %button.nav-link.py-1{:href => "#notes", data:{'bs-toggle': 'tab', 'bs-target': '#notes_content'}}
+ Notes
+ %span#note_count_wrapper
+ (
+ %span#note_count= @notes.length
)
- - if @enable_ontolobridge
- %li#request_term_top.nav-item
- %a.nav-link.py-1{:href => "#request_term", data:{toggle: 'tab', target: '#request_term'}}
- New Term Requests
- - if $PURL_ENABLED
- = link_to("#classPermalinkModal", class: "class-permalink nav-link", title: "Get a permanent link to this class", aria: {label: "Get a permanent link to this class"}, data: {toggle: "modal", current_purl: "#{@current_purl}"}) do
- %i{class: "fas fa-link", aria: {hidden: "true"}}
- #contents.tab-content
- #details_content.tab-pane.active.show
- = render :partial =>'/concepts/details'
- #visualization_content.tab-pane
- = render :partial =>'/concepts/biomixer'
- #notes_content.tab-pane
- = render :partial =>'/notes/list'
- #mappings_content.tab-pane
- = render :partial => '/mappings/concept_mappings'
- - if @enable_ontolobridge
- #request_term_content.tab-pane
- = render :partial =>'/concepts/request_term'
-%div.show-if-loading.align-self-center.my-auto
- loading...
+ %li#mappings_top.nav-item
+ %button.nav-link.py-1{:href => "#mappings", data:{'bs-toggle': 'tab', 'bs-target': '#mappings_content'}}
+ Class Mappings (
+ %span#mapping_count= @mappings.size
+ )
+ - if $PURL_ENABLED
+ = link_to("#classPermalinkModal", class: "class-permalink nav-link", title: "Get a permanent link to this class", aria: {label: "Get a permanent link to this class"}, data: {toggle: "modal", current_purl: "#{@current_purl}"}) do
+ %i{class: "fas fa-link", aria: {hidden: "true"}}
+ #contents.tab-content
+ #details_content.tab-pane.active.show
+ = render :partial =>'/concepts/details'
+ #visualization_content.tab-pane
+ = render :partial =>'/concepts/biomixer'
+ #notes_content.tab-pane
+ = render :partial =>'/notes/list'
+ #mappings_content.tab-pane
+ = render :partial => '/mappings/concept_mappings'
+
:javascript
jQuery(document).ready(function(){
diff --git a/app/views/layouts/_ontology_viewer.html.haml b/app/views/layouts/_ontology_viewer.html.haml
index 6262ec3b8..527dc6a15 100644
--- a/app/views/layouts/_ontology_viewer.html.haml
+++ b/app/views/layouts/_ontology_viewer.html.haml
@@ -108,7 +108,7 @@
%div.row.pb-4
%div.col
%div.card.py-3
- %div
+ %div{data: {controller: 'ontology-viewer-tabs', 'ontology-viewer-tabs-language-sections-value': ontology_data_sections }}
- sections = sections_to_show
%div.ontologies-tabs-container{data:{action: 'tab-selected->ontology-viewer-tabs#updateLanguageSelector'}}
= render TabsContainerComponent.new(id: 'ontology_viewer', url_parameter: 'p') do |t|
diff --git a/app/views/layouts/angular.html.erb b/app/views/layouts/angular.html.erb
index 6b6f71f2e..8b4da096e 100644
--- a/app/views/layouts/angular.html.erb
+++ b/app/views/layouts/angular.html.erb
@@ -33,7 +33,6 @@
<%= stylesheet_link_tag "application" %>
- <%=javascript_include_tag "application-esbuild", "data-turbo-track": "reload", type: "module" %>
<%=javascript_include_tag "vendor"%>
<%=javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js"%>
<%=javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.1/Chart.min.js"%>
diff --git a/app/views/layouts/appliance.html.haml b/app/views/layouts/appliance.html.haml
index 397a301bf..ee0de53a7 100644
--- a/app/views/layouts/appliance.html.haml
+++ b/app/views/layouts/appliance.html.haml
@@ -14,7 +14,6 @@
= stylesheet_link_tag "https://use.fontawesome.com/releases/v5.2.0/css/all.css", integrity: "sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ", crossorigin: "anonymous"
= stylesheet_link_tag "application", media: "all"
- = javascript_include_tag "application-esbuild", "data-turbo-track": "reload", type: "module"
= javascript_include_tag "vendor"
= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js"
= javascript_include_tag "//ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"
diff --git a/app/views/ontologies/_lazy_load_content.html.haml b/app/views/ontologies/_lazy_load_content.html.haml
deleted file mode 100644
index ae7b28ac1..000000000
--- a/app/views/ontologies/_lazy_load_content.html.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-- if current_section.eql?(section_title)
- = yield
-- else
- = render TurboFrameComponent.new(id: section_title, src: "/ontologies/#{@ontology.acronym}?p=#{section_title}", loading: :lazy)
\ No newline at end of file
diff --git a/app/views/ontologies/_mappings.html.haml b/app/views/ontologies/_mappings.html.haml
index 699558aaa..71f656cf1 100644
--- a/app/views/ontologies/_mappings.html.haml
+++ b/app/views/ontologies/_mappings.html.haml
@@ -1,3 +1,3 @@
-= turbo_frame_tag 'mappings' do
+= turbo_frame_tag 'mappings', data: {turbo: false} do
#mappings_content
= render :partial => 'mappings/count'
diff --git a/app/views/ontologies/_metadata.html.haml b/app/views/ontologies/_metadata.html.haml
index 5efe86a87..98c106b5a 100644
--- a/app/views/ontologies/_metadata.html.haml
+++ b/app/views/ontologies/_metadata.html.haml
@@ -1,5 +1,5 @@
-= turbo_frame_tag 'summary' do
- %div.ont-metadata
+= turbo_frame_tag 'summary', data: {turbo: false} do
+ %div.ont-metadata.py-3
-# Details pane
%section.ont-metadata-card.ont-details-card
%header.pb-2.fw-bold Details
diff --git a/app/views/ontologies/_notes.html.haml b/app/views/ontologies/_notes.html.haml
index 11ee81c20..4db993a52 100644
--- a/app/views/ontologies/_notes.html.haml
+++ b/app/views/ontologies/_notes.html.haml
@@ -1,4 +1,4 @@
-= turbo_frame_tag 'notes' do
+= turbo_frame_tag 'notes', data: {turbo: false} do
%div#notes_content{style:"margin: 1em 0"}
%h2{style:"margin-bottom: -0.5em; font-size: x-large; padding: .5em .5em 0; float: left;"} Notes
= render :partial => 'notes/ontology_list'
diff --git a/app/views/ontologies/_treeview.html.haml b/app/views/ontologies/_treeview.html.haml
index 10ccde6cb..cc7b4cac7 100644
--- a/app/views/ontologies/_treeview.html.haml
+++ b/app/views/ontologies/_treeview.html.haml
@@ -1,9 +1,10 @@
= turbo_frame_tag 'concepts_tree_view' do
- #tree_wrapper
- %ul.simpleTree{data:{controller: 'simple-tree'}}
- %li.root
- %ul
- = draw_tree(@root, @concept.id) # application_helper::draw_tree
+ - unless @ontology.flat?
+ #tree_wrapper.card.p-1
+ %ul.simpleTree{data:{controller: 'simple-tree'}}
+ %li.root
+ %ul
+ = draw_tree(@root, @concept.id)
:javascript
jQuery(document).ready(function () {
diff --git a/app/views/ontologies/_widgets.html.haml b/app/views/ontologies/_widgets.html.haml
index ddd634b2a..c4c4f8159 100644
--- a/app/views/ontologies/_widgets.html.haml
+++ b/app/views/ontologies/_widgets.html.haml
@@ -1,4 +1,4 @@
-= turbo_frame_tag 'widgets' do
+= turbo_frame_tag 'widgets', data: {turbo: false} do
- ont_uri = "/ontologies/#{@ontology.acronym}"
- get_code_prefix = ont_uri + '?p=widgets#TB_inline&height=400&width=600'
diff --git a/app/views/ontologies/properties.html.haml b/app/views/ontologies/properties.html.haml
index dc3f796fa..ce3500759 100644
--- a/app/views/ontologies/properties.html.haml
+++ b/app/views/ontologies/properties.html.haml
@@ -1,5 +1,5 @@
-= turbo_frame_tag 'properties' do
- %div.ont-properties{data:{controller: 'container-splitter'}}
+= render TurboFrameComponent.new(id: 'properties',data: {"turbo-frame-target": "frame"}) do
+ %div.ont-properties.py-3{data:{controller: 'container-splitter'}}
%div#propTree{data:{'container-splitter-target': 'container'}}
%div#prop_contents.pl-3{data:{'container-splitter-target': 'container'}}
diff --git a/app/views/ontologies/visualize.html.haml b/app/views/ontologies/visualize.html.haml
index 9b1b6ebf1..f55661777 100644
--- a/app/views/ontologies/visualize.html.haml
+++ b/app/views/ontologies/visualize.html.haml
@@ -1,35 +1,27 @@
-= turbo_frame_tag 'classes' do
+= render TurboFrameComponent.new(id: 'classes', data: {"turbo-frame-target": "frame"}) do
- unless @error
- @title = "#{@ontology.name} - #{@concept.prefLabel}"
- - @new_term_request_ontologies
- - @enable_ontolobridge = !$NEW_TERM_REQUEST_ONTOLOGIES.nil? && $NEW_TERM_REQUEST_ONTOLOGIES.include?(@ontology.acronym)
%div.tooltip
- %div#bd_content.bd_content.explore{data:{controller: 'container-splitter'}}
+ %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'}}
- -# Search box for class tree
- %div#qsearch.input-group.pb-2
- %div.input-group-prepend
- %span.input-group-text Jump to:
- = text_field_tag("search_box", nil, class: "form-control rounded-right", aria: {label: "Jump to:"},
- data: {controller: 'class-search', 'class-search-ontology-acronym-value': @ontology.acronym,
- 'class-search-spinner-src-value': asset_path("jquery.simple.tree/spinner.gif")})
+ %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:"},
+ data: {controller: 'class-search-auto-complete', 'class-search-auto-complete-ontology-acronym-value': @ontology.acronym,
+ 'class-search-auto-complete-spinner-src-value': asset_path("jquery.simple.tree/spinner.gif")})
= hidden_field_tag("jump_to_concept_id")
- -# Class tree
- %div#sd_content.card.p-1
- = turbo_frame_tag 'concepts_tree_view' , src: "/ajax/classes/treeview?ontology=#{@ontology.acronym}&conceptid=#{escape(@concept.id)}" do
- = loading_spinner(true)
+ %div#sd_content.p-1
+ = render TurboFrameComponent.new(id: 'concepts_tree_view' , src: "/ajax/classes/treeview?ontology=#{@ontology.acronym}&conceptid=#{escape(@concept.id)}")
%div#concept_content.d-flex.flex-column.card.p-1.ml-2{data:{'container-splitter-target': 'container'}}
= render partial: 'concepts/show'
- - form_for(:search, :url => '', :html=>{:id=>'search_form'}) do |f|
+ - form_for(:search, :url => '', :html=>{:id=>'search_form'}) do
%input{:name => "search[ontologies][]", :type => "hidden", :value => @ontology.acronym}/
= hidden_field :search, :search_type, :value=>"contains"
= hidden_field :search, :keyword, :value=>"",:id=>"search_keyword"
- else # found an error
= "#{@error}
"
- :javascript
-
diff --git a/config/application.rb b/config/application.rb
index 77aa0796f..8a1fe795a 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -26,7 +26,6 @@ class Application < Rails::Application
config.exceptions_app = self.routes
- config.autoload_paths += %W[#{config.root}/app/lib/kgcl]
config.settings = config_for :settings
diff --git a/config/bioportal_config_env.rb.sample b/config/bioportal_config_env.rb.sample
index 277b97201..746efd10c 100644
--- a/config/bioportal_config_env.rb.sample
+++ b/config/bioportal_config_env.rb.sample
@@ -301,7 +301,7 @@ $FOOTER_LINKS = {
-$UI_THEME = ENV['UI_THEME'] || 'ontoportal'
+$UI_THEME = ENV['UI_THEME'] || 'bioportal'
$HOSTNAME = ENV['API_URL']
if $HOSTNAME
diff --git a/config/initializers/zeitwerk.rb b/config/initializers/zeitwerk.rb
index 5e278416f..a105110d1 100644
--- a/config/initializers/zeitwerk.rb
+++ b/config/initializers/zeitwerk.rb
@@ -1,5 +1,4 @@
# frozen_string_literal: true
-
Rails.autoloaders.each do |autoloader|
autoloader.inflector = Zeitwerk::Inflector.new
autoloader.inflector.inflect(