").attr("id", "proposal_buttons").append(requestTermButtons()));
- container.append(requestTermForm);
-
- requestTermForm.submit(function(e) {
- e.preventDefault(e);
- bindRequestTermSaveClick();
- return false;
- });
-
- return requestTermForm;
-}
-
-function obTriggerNewTermRequestFormSave() {
- var ont = jQuery(document).data().bp.ontology;
- var ob_onts = jQuery(document).data().bp.ontolobridge_ontologies;
-
- // Execute only if ontology is Ontolobridge-enabled
- if (Object.entries(ont).length > 0 && ob_onts && ob_onts.length > 0 && ob_onts.includes(ont["acronym"])) {
- var formName = 'request_term_form';
-
- jQuery("#" + formName + " input, #" + formName + " textarea").each(function() {
- var input = jQuery(this);
- var val = input.val().trim();
-
- if (input.attr('type') === "checkbox" && input.prop('checked') === true) {
- window.localStorage.setItem(formName + '_' + input.attr('name'), 'checkbox_checked');
- window.localStorage.setItem(formName + '_populated', true);
- } else if (input.attr('type') !== "hidden" && input.attr('type') !== "checkbox" && val) {
- window.localStorage.setItem(formName + '_' + input.attr('name'), val);
- window.localStorage.setItem(formName + '_populated', true);
- }
- });
- }
-}
-
-jQuery(document).ready(function() {
- clearStatusMessages();
- bindAddRequestTermClick();
- bindCancelRequestTermClick();
- preventNewTermInstructionsFormSubmit();
- bindNewTermInstructionsSubmit();
- bindNewTermInstructionsCancel();
- bindNewTermInstructionsClick();
-});
diff --git a/app/assets/stylesheets/application.css.scss.erb b/app/assets/stylesheets/application.css.scss.erb
index 52b88a0a6d..5f86b22144 100755
--- a/app/assets/stylesheets/application.css.scss.erb
+++ b/app/assets/stylesheets/application.css.scss.erb
@@ -32,7 +32,6 @@
@import "recommender";
@import "search";
@import "submissions";
-@import "ontolobridge";
@import "fair_assement";
@import "instances_table";
@import "register";
diff --git a/app/assets/stylesheets/browse.scss b/app/assets/stylesheets/browse.scss
index a55292bde0..57e857442c 100644
--- a/app/assets/stylesheets/browse.scss
+++ b/app/assets/stylesheets/browse.scss
@@ -266,6 +266,9 @@
z-index: 1;
}
+.browse-filter .switch-filter > p, .switch-filter > div{
+ max-width: 207px;
+}
.browse-search-bar input:focus {
box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
diff --git a/app/assets/stylesheets/components/tree_view.scss b/app/assets/stylesheets/components/tree_view.scss
index 1582b9c3a3..4393281f9c 100644
--- a/app/assets/stylesheets/components/tree_view.scss
+++ b/app/assets/stylesheets/components/tree_view.scss
@@ -35,7 +35,6 @@ padding:0;
a.tree-link {
display: inline-block;
padding: 5px;
- word-break: break-all;
text-wrap: wrap;
color: var(--primary-color) !important;
}
diff --git a/app/assets/stylesheets/home.scss b/app/assets/stylesheets/home.scss
index 9965d2bfd5..875138bdd7 100644
--- a/app/assets/stylesheets/home.scss
+++ b/app/assets/stylesheets/home.scss
@@ -222,7 +222,7 @@ i.fa.fa-caret-square-o-down {
.home-statistics-container > div {
display: flex;
align-items: start;
- justify-content: center;
+ justify-content: flex-start;
flex-wrap: wrap;
}
.home-agroportal-figures{
diff --git a/app/assets/stylesheets/ontolobridge.scss b/app/assets/stylesheets/ontolobridge.scss
deleted file mode 100644
index ebcc8e9426..0000000000
--- a/app/assets/stylesheets/ontolobridge.scss
+++ /dev/null
@@ -1,35 +0,0 @@
-/* message boxes */
-.message-box {
- color: #555;
- border-radius: 3px;
- font-family: Tahoma, Geneva, Arial, sans-serif;
- font-size: 11px;
- padding: 10px;
- margin: 10px 0 0 0;
-}
-
-.message-box span {
- font-weight: bold;
- text-transform: uppercase;
-}
-
-.error-msg {
- //background-color: #eee;
- border: 1px solid #f5aca6;
-}
-
-.success-msg {
- //background-color: #eee;
- border: 1px solid #a6ca8a;
-}
-
-input.req,
-textarea.req {
- border-color: darksalmon !important;
-}
-
-blockquote {
- padding: 0 1em;
- color: #6a737d;
- border-left: .25em solid #dfe2e5;
-}
diff --git a/app/assets/stylesheets/ontologies.scss b/app/assets/stylesheets/ontologies.scss
index ccaf70d314..3b71432d37 100644
--- a/app/assets/stylesheets/ontologies.scss
+++ b/app/assets/stylesheets/ontologies.scss
@@ -2,6 +2,7 @@ $ont-metadata-bg-color: #e2ebf0;
$widget-table-border-color: #EFEFEF;
+
.admin-background{
a.chip_button_container_clickable{
color: var(--admin-color) !important;
@@ -314,4 +315,4 @@ $widget-table-border-color: #EFEFEF;
color: white;
border-radius: 10px;
position: relative;
-}
\ No newline at end of file
+}
diff --git a/app/assets/stylesheets/taxonomy.scss b/app/assets/stylesheets/taxonomy.scss
index 6043973aa8..077b5bcdaf 100644
--- a/app/assets/stylesheets/taxonomy.scss
+++ b/app/assets/stylesheets/taxonomy.scss
@@ -63,7 +63,18 @@
}
.taxonomy-card .description{
color: #666666;
- padding-bottom: 5px;
+}
+
+.taxonomy-card .descriptionlink svg{
+ margin: 0px 2px;
+ height: 19px;
+}
+
+.taxonomy-card .descriptionlink svg path{
+ fill: #666666;
+}
+.category-link{
+ color: #666666 !important;
}
.taxonomy-slice-svg{
width: 35px;
@@ -98,4 +109,23 @@
background-color: var(--primary-color);
}
+.taxonomy-empty-illustration{
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ .browse-empty-illustration {
+ margin-top: 40px;
+ }
+}
+
+
+.taxonomy-empty-illustration-text{
+ color: var(--gray-color);
+
+}
+.taxonomy-empty-illustration-button{
+ width: 168px;
+}
diff --git a/app/components/chip_button_component/chip_button_component.html.haml b/app/components/chip_button_component/chip_button_component.html.haml
index 26172a5487..f2dd0d3dd0 100644
--- a/app/components/chip_button_component/chip_button_component.html.haml
+++ b/app/components/chip_button_component/chip_button_component.html.haml
@@ -4,7 +4,7 @@
= @text || content
- elsif !content
%a.chip_button_container_clickable{@html_options}
- = @text
+ = @text.html_safe
- else
%span.chip_button_container_clickable{@html_options}
= content
diff --git a/app/components/display/taxonomy_card_component.rb b/app/components/display/taxonomy_card_component.rb
index df896191b6..89b05bcb69 100644
--- a/app/components/display/taxonomy_card_component.rb
+++ b/app/components/display/taxonomy_card_component.rb
@@ -1,4 +1,5 @@
class Display::TaxonomyCardComponent < ViewComponent::Base
+ include UrlsHelper
def initialize(taxonomy: , ontologies_names: )
@taxonomy = taxonomy
@ontologies_names = ontologies_names
diff --git a/app/components/display/taxonomy_card_component/taxonomy_card_component.html.haml b/app/components/display/taxonomy_card_component/taxonomy_card_component.html.haml
index ab55aa41de..218eaca749 100644
--- a/app/components/display/taxonomy_card_component/taxonomy_card_component.html.haml
+++ b/app/components/display/taxonomy_card_component/taxonomy_card_component.html.haml
@@ -4,12 +4,22 @@
= "#{@taxonomy.name} (#{@taxonomy.acronym})"
%a{href: "https://#{@taxonomy.acronym}.#{$UI_URL.sub("https://", "")}"}
= inline_svg_tag('icons/slices.svg', class: "taxonomy-slice-svg #{@taxonomy.is_slice ? '' : 'd-none'}")
+
+ - if link?(@taxonomy.description)
+ .descriptionlink
+ %a.category-link{href: @taxonomy.description, target: '_blank'}
+ = @taxonomy.description
+ = inline_svg_tag 'icons/external-link.svg'
+
%a.ontologies{href: "/ontologies?#{@taxonomy.id.split('/')[-2]}=#{@taxonomy.acronym}"}
= inline_svg_tag('icons/ontology.svg')
.number-of-ontologies
= "#{@taxonomy.ontologies.length} ontologies"
- .description
- = render TextAreaFieldComponent.new(value: @taxonomy.description)
+
+ - unless link?(@taxonomy.description)
+ .description.mb-1
+ = render TextAreaFieldComponent.new(value: @taxonomy.description)
+
.ontologies-cards
- @taxonomy.ontologies.each_with_index do |ontology, index|
- if index>10
diff --git a/app/components/federated_portal_button_component.rb b/app/components/federated_portal_button_component.rb
index 4d8a1e886c..920407bb44 100644
--- a/app/components/federated_portal_button_component.rb
+++ b/app/components/federated_portal_button_component.rb
@@ -2,6 +2,7 @@
class FederatedPortalButtonComponent < ViewComponent::Base
attr_reader :name, :tooltip, :link, :color, :light_color
+ include UrlsHelper
def initialize(name:, link:, color:, tooltip:, light_color:)
@name = name
@@ -10,4 +11,8 @@ def initialize(name:, link:, color:, tooltip:, light_color:)
@color = color
@light_color = light_color
end
+
+ def internal?
+ !link?(@link)
+ end
end
diff --git a/app/components/federated_portal_button_component/federated_portal_button_component.html.haml b/app/components/federated_portal_button_component/federated_portal_button_component.html.haml
index e45a6f0520..b59554ff84 100644
--- a/app/components/federated_portal_button_component/federated_portal_button_component.html.haml
+++ b/app/components/federated_portal_button_component/federated_portal_button_component.html.haml
@@ -1,7 +1,7 @@
%span{'data-controller': 'federation-portals-colors',
'data-federation-portals-colors-color-value': color,
'data-federation-portals-colors-portal-name-value': name.downcase}
-%a{ href: link, target: '_blank', 'data-controller' => 'tooltip', title: tooltip, class: 'federation-portal-button button icon-right', style: color ? "background-color: #{light_color} !important" : '' }
+%a{ href: link, target: internal? ? '_top' : '_blank', 'data-controller' => 'tooltip', title: tooltip, class: 'federation-portal-button button icon-right', style: color ? "background-color: #{light_color} !important" : '' }
= inline_svg_tag('logos/ontoportal.svg', class: "federated-icon-#{name.downcase}")
%div{ class: 'text', style: color ? "color: #{color} !important" : '' }
= name.humanize.gsub("portal", "Portal")
diff --git a/app/components/label_fetcher_component.rb b/app/components/label_fetcher_component.rb
new file mode 100644
index 0000000000..f89f39d16e
--- /dev/null
+++ b/app/components/label_fetcher_component.rb
@@ -0,0 +1,56 @@
+# frozen_string_literal: true
+
+class LabelFetcherComponent < ViewComponent::Base
+ include UrlsHelper, Turbo::FramesHelper, ModalHelper
+
+ def initialize(id:, label: nil, link: nil, ajax_src: nil, open_in_modal: false, target: nil, external: false)
+ super
+ @id = id
+ @link = link
+ @ajax_src = ajax_src
+ @open_in_modal = open_in_modal
+ @target = target
+ @external = external
+ @label = label
+
+ if external_link?
+ @link = id
+ @target ||= '_blank'
+ else
+ @target ||= '_top'
+ end
+
+ end
+
+ def external_link?
+ (@label.nil? || @label.eql?(@id)) && @external
+ end
+
+ def label_fetcher_container(&block)
+ id = "#{escape(@id)}_label"
+ if @ajax_src
+ render(TurboFrameComponent.new(id: id, src: "#{@ajax_src}&target=#{@target}", loading: 'lazy')) do |t|
+ t.loader do
+ render ChipButtonComponent.new(url: @id, text: "#{@id} #{render(LoaderComponent.new(small: true))}", type: 'clickable', target: '_blank')
+ end
+
+ t.error do
+ capture(&block)
+ end
+ end
+ else
+ turbo_frame_tag(id) do
+ capture(&block)
+ end
+ end
+
+ end
+
+ def link_with_icon
+ if external_link?
+ ExternalLinkTextComponent.new(text: @label).call
+ else
+ InternalLinkTextComponent.new(text: @label).call
+ end
+ end
+end
diff --git a/app/components/label_fetcher_component/label_fetcher_component.html.haml b/app/components/label_fetcher_component/label_fetcher_component.html.haml
new file mode 100644
index 0000000000..80587133d1
--- /dev/null
+++ b/app/components/label_fetcher_component/label_fetcher_component.html.haml
@@ -0,0 +1,10 @@
+= label_fetcher_container do
+ - if @open_in_modal
+ = render ChipButtonComponent.new(type: 'clickable') do
+ = link_to_modal(@label, @link)
+ - else
+ %span
+ = render ChipButtonComponent.new(url: @link,
+ type: 'clickable',
+ text: link_with_icon,
+ target: @target)
diff --git a/app/components/label_link_component.rb b/app/components/label_link_component.rb
deleted file mode 100644
index 3d8ecee988..0000000000
--- a/app/components/label_link_component.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class LabelLinkComponent < ViewComponent::Base
-
- def initialize(id:, text:, icon: 'popup-link')
- @id = id
- @text = text
- @icon = icon
- end
-
- def call
- if @id.eql?(@text)
- ExternalLinkTextComponent.new(text: @text).call
- else
- InternalLinkTextComponent.new(text: @text).call
- end
- end
-
- def self.inline(id, text)
- { plain: LabelLinkComponent.new(id: id, text: text).call }
- end
-end
diff --git a/app/components/turbo_frame_component.rb b/app/components/turbo_frame_component.rb
index d25322e154..1e54e24ce8 100644
--- a/app/components/turbo_frame_component.rb
+++ b/app/components/turbo_frame_component.rb
@@ -4,6 +4,7 @@ class TurboFrameComponent < ViewComponent::Base
include Turbo::FramesHelper
renders_one :loader
+ renders_one :error
def initialize(id:, src: '', **html_options)
@id = id
diff --git a/app/components/turbo_frame_component/turbo_frame_component.html.haml b/app/components/turbo_frame_component/turbo_frame_component.html.haml
index 1c5d0d9f59..a288d8eaca 100644
--- a/app/components/turbo_frame_component/turbo_frame_component.html.haml
+++ b/app/components/turbo_frame_component/turbo_frame_component.html.haml
@@ -8,5 +8,9 @@
- else
%div.p-3
= render LoaderComponent.new(type: 'pulsing')
- %div{'data-turbo-frame-error-target': 'errorMessage', style:'display: none; width: 100%'}
- = render Display::AlertComponent.new(type:'danger')
\ No newline at end of file
+ %span{'data-turbo-frame-error-target': 'errorMessage', style:'display: none; width: 100%'}
+ - if error?
+ = error
+ - else
+ %div
+ = render Display::AlertComponent.new(type:'danger')
diff --git a/app/controllers/agents_controller.rb b/app/controllers/agents_controller.rb
index c058eb130f..5c06c79a39 100644
--- a/app/controllers/agents_controller.rb
+++ b/app/controllers/agents_controller.rb
@@ -18,7 +18,7 @@ def show
end
def ajax_agents
- filters = { query: params[:query], qf: "identifiers_texts^20 acronym_text^15 name_text^10 email_text^10"}
+ filters = { query: "#{params[:query]}*", qf: "identifiers_texts^20 acronym_text^15 name_text^10 email_text^10"}
@agents = LinkedData::Client::HTTP.get('/search/agents', filters)
agents_json = @agents.collection.map do |x|
{
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 7af57ee341..e6182c033c 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -13,7 +13,7 @@
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
- include InternationalisationHelper
+ include InternationalisationHelper, MultiLanguagesHelper
before_action :set_locale
@@ -26,6 +26,9 @@ def set_locale
I18n.locale = cookies[:locale] || detect_locale
cookies.permanent[:locale] = I18n.locale if cookies[:locale].nil?
logger.debug "* Locale set to '#{I18n.locale}'"
+
+ I18n.locale = portal_lang unless portal_language_enabled?(I18n.locale)
+
session[:locale] = I18n.locale
end
@@ -250,12 +253,15 @@ def authorize_and_redirect
end
def authorize_admin
- admin = session[:user] && session[:user].admin?
- redirect_to_home unless admin
+ redirect_to_home unless current_user_admin?
end
def current_user_admin?
- session[:user] && session[:user].admin?
+ session[:user]&.admin? || current_login_as_admin?
+ end
+
+ def current_login_as_admin?
+ session[:admin_user]&.admin?
end
def ontology_restricted?(acronym)
@@ -424,7 +430,7 @@ def json_link(url, optional_params)
optional_params_str = filtered_params.map { |param, value| "#{param}=#{value}" }.join("&")
return base_url + optional_params_str + "&apikey=#{$API_KEY}"
end
-
+
def set_federated_portals
RequestStore.store[:federated_portals] = params[:portals]&.split(',')
end
diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb
index c01c0cf879..699eda2698 100644
--- a/app/controllers/collections_controller.rb
+++ b/app/controllers/collections_controller.rb
@@ -1,7 +1,6 @@
class CollectionsController < ApplicationController
include CollectionsHelper,SearchContent
-
def index
acronym = params[:ontology]
@ontology = LinkedData::Client::Models::Ontology.find_by_acronym(acronym).first
@@ -47,21 +46,30 @@ def show
def show_label
collection_label = ''
- collection = get_request_collection
- collection_label = collection['prefLabel'] if collection
- collection_label = params[:id] if collection_label.nil? || collection_label.empty?
+ collection = get_request_collection
+ collection_label = collection['prefLabel'] if collection
+ collection_label = params[:id] if collection_label.nil? || collection_label.empty?
- render LabelLinkComponent.inline(params[:id], helpers.main_language_label(collection_label))
+ label = helpers.main_language_label(collection_label)
+ link = collection_path(collection_id: params[:id], ontology_id: params[:ontology_id], language: request_lang)
+ render(inline: helpers.ajax_link_chip(params[:id], label, link, external: collection.blank?), layout: false)
end
def show_members
@ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology_id] || params[:ontology]).first
- @submission = @ontology.explore.latest_submission(include:'uriRegexPattern,preferredNamespaceUri')
- @collection = get_request_collection
+ @submission = @ontology.explore.latest_submission(include: 'uriRegexPattern,preferredNamespaceUri')
page = params[:page] || '1'
@auto_click = page.to_s.eql?('1')
- @page = @collection.explore.members({page: page, language: request_lang})
- @concepts = @page.collection
+ @collection = get_request_collection(@ontology)
+
+ if @collection
+ @page = @collection.explore.members({ page: page, language: request_lang })
+ @concepts = @page.collection
+ else
+ @page = OpenStruct.new({ nextPage: 1, page: 1 })
+ @concepts = []
+ end
+
if @ontology.nil?
ontology_not_found params[:ontology]
else
@@ -71,14 +79,12 @@ def show_members
private
- def get_request_collection
+ def get_request_collection(ontology = nil)
params[:id] = request_collection_id
- if params[:id].nil? || params[:id].empty?
- render plain: t('collections.error_valid_collection')
- return
- end
- @ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology_id] || params[:ontology]).first
+ return nil if params[:id].nil? || params[:id].empty?
+
+ @ontology = ontology || LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology_id] || params[:ontology]).first
ontology_not_found(params[:ontology_id]) if @ontology.nil?
get_collection(@ontology, params[:id])
end
diff --git a/app/controllers/concepts_controller.rb b/app/controllers/concepts_controller.rb
index 1063c953b4..3d4923296f 100644
--- a/app/controllers/concepts_controller.rb
+++ b/app/controllers/concepts_controller.rb
@@ -23,7 +23,6 @@ def show
redirect_to(ontology_path(id: params[:ontology], p: 'classes', conceptid: params[:id], lang: request_lang)) and return unless turbo_frame_request?
@submission = get_ontology_submission_ready(@ontology)
- @ob_instructions = helpers.ontolobridge_instructions_template(@ontology)
@concept = @ontology.explore.single_class({full: true, language: request_lang}, params[:id])
@instances_concept_id = @concept.id
@@ -43,7 +42,6 @@ def index
# Note that find_by_acronym includes views by default
@ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology]).first
- @ob_instructions = helpers.ontolobridge_instructions_template(@ontology)
@submission = @ontology.explore.latest_submission(include:'uriRegexPattern,preferredNamespaceUri')
@@ -63,10 +61,18 @@ def index
end
def show_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 LabelLinkComponent.inline(cls_id, helpers.main_language_label(concept_label(ont_id, cls_id)))
+ cls_id = params[:concept] || params[:id]
+ ont_id = params[:ontology]
+ pref_label = begin
+ concept_label(ont_id, cls_id)
+ rescue
+ cls_id
+ end
+ cls = @ontology.explore&.single_class({ language: request_lang, include: 'prefLabel' }, cls_id)
+ label = helpers.main_language_label(pref_label)
+ link = concept_path(cls_id, ont_id, request_lang)
+
+ render(inline: helpers.ajax_link_chip(cls_id, label, link, external: cls.nil? || cls.errors), layout: nil)
end
def show_definition
@@ -87,8 +93,8 @@ def show_tree
not_found(t('concepts.missing_roots')) if @root.nil?
render inline: helpers.concepts_tree_component(@root, @concept,
- @ontology.acronym, Array(params[:concept_schemes]&.split(',')), request_lang,
- id: 'concepts_tree_view', auto_click: params[:auto_click] || true)
+ @ontology.acronym, Array(params[:concept_schemes]&.split(',')), request_lang,
+ id: 'concepts_tree_view', auto_click: params[:auto_click] || true)
end
end
diff --git a/app/controllers/concerns/search_aggregator.rb b/app/controllers/concerns/search_aggregator.rb
index 078c89c5c9..a4c8699f2b 100644
--- a/app/controllers/concerns/search_aggregator.rb
+++ b/app/controllers/concerns/search_aggregator.rb
@@ -251,25 +251,36 @@ def blacklist_cls_id_components(cls_id, blacklist_words)
def merge_federated_results(search_results)
search_results.each do |element|
element[:root][:other_portals] = []
- element[:reuses].reject! do |reuse|
- if (element[:root][:ontology_acronym] == reuse[:root][:ontology_acronym]) && (element[:root][:uri] == reuse[:root][:uri])
- portal_name = reuse[:root][:portal_name]
- link = reuse[:root][:link]
- element[:root][:other_portals] << {
- name: portal_name,
- color: federated_portal_color(portal_name),
- light_color: federated_portal_light_color(portal_name),
- link: link,
- ontology_id: reuse[:root][:ontology_id]
- }
- true
- else
- false
+ element_ontology_id = element[:root][:ontology_id].split('/').last
+ element_uri = element[:root][:uri]
+ [element[:reuses], search_results].each do |collection|
+ collection.reject! do |entry|
+ next if entry == element
+
+ entry_ontology_id = entry[:root][:ontology_id].split('/').last
+ entry_uri = entry[:root][:uri]
+
+ if element_ontology_id == entry_ontology_id && element_uri == entry_uri
+ element[:root][:other_portals] << build_other_portal_entry(entry)
+ true
+ else
+ false
+ end
end
end
end
end
+ def build_other_portal_entry(reuse)
+ {
+ name: reuse[:root][:portal_name],
+ color: federated_portal_color(reuse[:root][:portal_name]),
+ light_color: federated_portal_light_color(reuse[:root][:portal_name]),
+ link: reuse[:root][:link],
+ ontology_id: reuse[:root][:ontology_id]
+ }
+ end
+
def swap_canonical_portal_results_first(search_results)
all_submissions = LinkedData::Client::Models::OntologySubmission.all(include: 'pullLocation', include_views: true, display_links: false, display_context: false)
diff --git a/app/controllers/concerns/submission_filter.rb b/app/controllers/concerns/submission_filter.rb
index c039147280..5bb9937e1a 100644
--- a/app/controllers/concerns/submission_filter.rb
+++ b/app/controllers/concerns/submission_filter.rb
@@ -72,6 +72,7 @@ def merge_by_acronym(submissions)
submissions.group_by { |x| x[:ontology]&.acronym }.each do |acronym, ontologies|
ontology = canonical_ontology(ontologies)
ontology[:sources] = ontologies.map { |x| x[:id] }
+ ontology[:sources].reject! { |id| id.include?(portal_name.downcase) } if ontology[:sources].size.eql?(1)
merged_submissions << ontology
end
merged_submissions
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 2d20328b74..b9737ae8a1 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -23,11 +23,20 @@ def index
@anal_ont_names = []
@anal_ont_numbers = []
- @analytics.sort_by{|ont, count| -count}[0..4].each do |ont, count|
- @anal_ont_names << ont
- @anal_ont_numbers << count
+ if @analytics.empty?
+ all_metrics = LinkedData::Client::Models::Metrics.all
+ all_metrics.sort_by{|x| -(x.classes + x.individuals)}[0..4].each do |x|
+ @anal_ont_names << x.id.split('/')[-4]
+ @anal_ont_numbers << (x.classes + x.individuals) || 0
+ end
+ else
+ @analytics.sort_by{|ont, count| -count}[0..4].each do |ont, count|
+ @anal_ont_names << ont
+ @anal_ont_numbers << count
+ end
end
+
end
def set_cookies
@@ -39,6 +48,8 @@ def portal_config
@config = $PORTALS_INSTANCES.select { |x| x[:name].downcase.eql?((params[:portal] || helpers.portal_name).downcase) }.first
if @config && @config[:api]
@portal_config = LinkedData::Client::Models::Ontology.top_level_links(@config[:api]).to_h
+ @color = @portal_config[:color].present? ? @portal_config[:color] : @config[:color]
+ @name = @portal_config[:title].present? ? @portal_config[:title] : @config[:name]
else
@portal_config = {}
end
diff --git a/app/controllers/label_xl_controller.rb b/app/controllers/label_xl_controller.rb
index 521d35fb7a..e62a749084 100644
--- a/app/controllers/label_xl_controller.rb
+++ b/app/controllers/label_xl_controller.rb
@@ -1,5 +1,5 @@
class LabelXlController < ApplicationController
- include LabelXlHelper
+ include LabelXlHelper, UrlsHelper
def show
@label_xl = get_request_label_xl
@@ -9,8 +9,9 @@ def show_label
label_xl = get_request_label_xl
label_xl_label = label_xl ? label_xl['literalForm'] : nil
label_xl_label = params[:id] if label_xl_label.nil? || label_xl_label.empty?
-
- render LabelLinkComponent.inline(params[:id], helpers.main_language_label(label_xl_label))
+ label = helpers.main_language_label(label_xl_label)
+ link = "/ajax/label_xl/?id=#{escape(params[:id])}&ontology=#{params[:ontology_id]}&cls_id=#{escape(params[:cls_id])}"
+ render(inline: helpers.ajax_link_chip(params[:id], label, link, open_in_modal: true, external: label_xl.blank?), layout: false)
end
private
diff --git a/app/controllers/language_controller.rb b/app/controllers/language_controller.rb
index 0ccf6b59c5..56c647489a 100644
--- a/app/controllers/language_controller.rb
+++ b/app/controllers/language_controller.rb
@@ -1,11 +1,12 @@
class LanguageController < ApplicationController
+ include MultiLanguagesHelper
# set locale to the language selected by the user
def set_locale_language
language = params[:language].strip.downcase.to_sym
supported_languages = I18n.available_locales
-
- if language
+
+ if language && portal_language_enabled?(language)
if supported_languages.include?(language)
cookies.permanent[:locale] = language
else
diff --git a/app/controllers/mappings_controller.rb b/app/controllers/mappings_controller.rb
index df582acb4e..0ca5fd8b77 100644
--- a/app/controllers/mappings_controller.rb
+++ b/app/controllers/mappings_controller.rb
@@ -118,7 +118,7 @@ def show_mappings
ontology_acronym = @ontology.acronym
@ontology_name = ontology_acronym
end
- if @target_ontology.nil?
+ if @target_ontology.nil? || @target_ontology.errors
if params[:target] == EXTERNAL_MAPPINGS_GRAPH
target_acronym = EXTERNAL_URL_PARAM_STR
@target_ontology_name = t('mappings.external_mappings')
@@ -132,7 +132,6 @@ def show_mappings
end
ontologies = [ontology_acronym, target_acronym]
-
@mapping_pages = LinkedData::Client::HTTP.get("#{MAPPINGS_URL}", { page: page, ontologies: ontologies.join(',') })
not_found(@mapping_pages.errors) if @mapping_pages.respond_to?(:errors)
@mappings = @mapping_pages.collection
diff --git a/app/controllers/ontolobridge_controller.rb b/app/controllers/ontolobridge_controller.rb
deleted file mode 100644
index 89d3d62b6d..0000000000
--- a/app/controllers/ontolobridge_controller.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-require 'rest-client'
-require 'multi_json'
-
-class OntolobridgeController < ApplicationController
-
- # POST /ontolobridge
- # POST /ontolobridge.xml
- def create
- request_term
- end
-
- def request_term
- response = {}
- endpoint = "/RequestTerm"
- h_params = {}
- response_raw = nil
- code = 200
-
- begin
- params.delete("controller")
- params.delete("action")
- params.each { |k, v|
- if v === "on"
- h_params[k] = true
- else
- h_params[k] = v
- end
- }
-
- headers = {'Authorization' => $ONTOLOBRIDGE_AUTHENTICATION_TOKEN}
- response_raw = RestClient.post("#{$ONTOLOBRIDGE_BASE_URL}#{endpoint}", h_params, headers)
- code = response_raw.code
- response.merge!(MultiJson.load(response_raw))
- rescue RestClient::BadRequest => e
- code = 400
- response["error"] = e.message
- rescue Exception => e
- code = 500
- response["error"] = t('ontolobridge.problem_of_creating_new_term', endpoint: endpoint, class: e.class, message: e.message)
- end
-
- render json: [response, code], status: code
- end
-
- def save_new_term_instructions
- code = 200
- response = {error: '', success: ''}
- response[:success] = t('ontolobridge.new_term_instructions_saved', acronym: params['acronym'])
- ont_data = Ontology.find_by(acronym: params['acronym'])
- ont_data ||= Ontology.new
- ont_data.acronym = params['acronym']
- ont_data.new_term_instructions = params['new_term_instructions']
-
- begin
- ont_data.save
- rescue Exception => e
- code = 500
- response[:error] = t('ontolobridge.error_saving_new_term_instructions', acronym: params['acronym'])
- end
- sleep(1)
- render json: [response, code], status: code
- end
-
-end
diff --git a/app/controllers/ontologies_controller.rb b/app/controllers/ontologies_controller.rb
index 041c1e6361..9d5f267777 100644
--- a/app/controllers/ontologies_controller.rb
+++ b/app/controllers/ontologies_controller.rb
@@ -276,7 +276,6 @@ def show
params[:p] = "summary"
end
- #@ob_instructions = helpers.ontolobridge_instructions_template(@ontology)
# Get the latest submission (not necessarily the latest 'ready' submission)
diff --git a/app/controllers/schemes_controller.rb b/app/controllers/schemes_controller.rb
index 8c5c97f1f0..1116e6a740 100644
--- a/app/controllers/schemes_controller.rb
+++ b/app/controllers/schemes_controller.rb
@@ -23,9 +23,9 @@ def index
render inline: helpers.render_search_paginated_list(container_id: 'schemes_sorted_list',
- next_page_url: "/ontologies/#{@ontology.acronym}/schemes",
- child_url: "/ontologies/#{@ontology.acronym}/schemes/show", child_turbo_frame: 'scheme',
- child_param: :schemeid,
+ next_page_url: "/ontologies/#{@ontology.acronym}/schemes",
+ child_url: "/ontologies/#{@ontology.acronym}/schemes/show", child_turbo_frame: 'scheme',
+ child_param: :schemeid,
results: results, next_page: next_page, total_count: total_count)
end
@@ -35,7 +35,7 @@ def show
redirect_to(ontology_path(id: params[:ontology], p: 'schemes', schemeid: params[:id],lang: request_lang)) and return unless turbo_frame_request?
@scheme = get_request_scheme
-
+
render partial: "schemes/show"
end
@@ -43,8 +43,9 @@ def show_label
scheme = get_request_scheme
scheme_label = scheme ? scheme['prefLabel'] : params[:id]
scheme_label = scheme_label.nil? || scheme_label.empty? ? params[:id] : scheme_label
-
- render LabelLinkComponent.inline(params[:id], helpers.main_language_label(scheme_label))
+ label = helpers.main_language_label(scheme_label)
+ link = scheme_path(scheme_id: params[:id], ontology_id: params[:ontology_id])
+ render(inline: helpers.ajax_link_chip(params[:id], label, link, external: scheme.blank?), layout: false)
end
private
diff --git a/app/controllers/taxonomy_controller.rb b/app/controllers/taxonomy_controller.rb
index b3afa2542a..8696c3e086 100644
--- a/app/controllers/taxonomy_controller.rb
+++ b/app/controllers/taxonomy_controller.rb
@@ -32,8 +32,9 @@ def nest_categories_children(categories)
category_index[category[:id]] = category
end
categories.each do |category|
- category[:parentCategory].each do |parent_id|
+ category[:parentCategory]&.each do |parent_id|
parent = category_index[parent_id]
+ next if parent.nil?
parent[:children] ||= []
parent[:children] << category
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 520ab1b861..5b4eb817e5 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -226,6 +226,7 @@ def unescape_id
def verify_owner
return if current_user_admin?
+
if session[:user].nil? || (!session[:user].id.eql?(params[:id]) && !session[:user].username.eql?(params[:id]))
redirect_to controller: 'login', action: 'index', redirect: "/accounts/#{params[:id]}"
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 6d565bdb22..c41d1734f3 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -9,7 +9,7 @@ module ApplicationHelper
REST_URI = $REST_URL
API_KEY = $API_KEY
- include ModalHelper, MultiLanguagesHelper, UrlsHelper
+ include ModalHelper, MultiLanguagesHelper, UrlsHelper, ComponentsHelper
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#",
@@ -19,7 +19,7 @@ module ApplicationHelper
:umls => "http://bioportal.bioontology.org/ontologies/umls/", :door => "http://kannel.open.ac.uk/ontology#", :dct => "http://purl.org/dc/terms/",
:void => "http://rdfs.org/ns/void#", :foaf => "http://xmlns.com/foaf/0.1/", :vann => "http://purl.org/vocab/vann/", :adms => "http://www.w3.org/ns/adms#",
:voaf => "http://purl.org/vocommons/voaf#", :dcat => "http://www.w3.org/ns/dcat#", :mod => "http://www.isibang.ac.in/ns/mod#", :prov => "http://www.w3.org/ns/prov#",
- :cc => "http://creativecommons.org/ns#", :schema => "http://schema.org/", :doap => "http://usefulinc.com/ns/doap#", :bibo => "http://purl.org/ontology/bibo/",
+ :cc => "http://creativecommons.org/ns#", :schema => "http://schema.org/", :doap => "http://usefulinc.com/ns/doap#", :bibo => "http://purl.org/ontology/bibo/",
:wdrs => "http://www.w3.org/2007/05/powder-s#", :cito => "http://purl.org/spar/cito/", :pav => "http://purl.org/pav/", :nkos => "http://w3id.org/nkos/nkostype#",
:oboInOwl => "http://www.geneontology.org/formats/oboInOwl#", :idot => "http://identifiers.org/idot/", :sd => "http://www.w3.org/ns/sparql-service-description#",
:cclicense => "http://creativecommons.org/licenses/",
@@ -55,7 +55,6 @@ def get_apikey
end
end
-
def omniauth_providers_info
$OMNIAUTH_PROVIDERS
end
@@ -76,7 +75,6 @@ def current_user_admin?
session[:user] && session[:user].admin?
end
-
def child_id(child)
child.id.to_s.split('/').last
end
@@ -131,7 +129,7 @@ def at_slice?
def add_comment_button(parent_id, parent_type)
if session[:user].nil?
- link_to t('application.add_comment'), login_index_path(redirect: request.url), class: "secondary-button regular-button slim"
+ link_to t('application.add_comment'), login_index_path(redirect: request.url), class: "secondary-button regular-button slim", data: {'turbo-frame': '_top'}
else
link_to_modal t('application.add_comment'), notes_new_comment_path(parent_id: parent_id, parent_type: parent_type, ontology_id: @ontology.acronym),
class: "secondary-button regular-button slim", data: { show_modal_title_value: t('application.add_new_comment')}
@@ -148,14 +146,13 @@ def add_reply_button(parent_id)
def add_proposal_button(parent_id, parent_type)
if session[:user].nil?
- link_to t('application.add_proposal'), login_index_path(redirect: request.url), class: "secondary-button regular-button slim"
+ link_to t('application.add_proposal'), login_index_path(redirect: request.url), class: "secondary-button regular-button slim", data: {'turbo-frame': '_top'}
else
link_to_modal t('application.add_proposal'), notes_new_proposal_path(parent_id: parent_id, parent_type: parent_type, ontology_id: @ontology.acronym),
class: "secondary-button regular-button slim", data: { show_modal_title_value: t('application.add_new_proposal')}
end
end
-
def subscribe_button(ontology_id)
return if ontology_id.nil?
render TurboFrameComponent.new(id: 'subscribe_button', src: ontology_subscriptions_path(ontology_id: ontology_id.split('/').last), class: 'ml-1') do |t|
@@ -178,21 +175,15 @@ def admin_block(ontology: @ontology, user: session[:user], class_css: "admin-bor
end
def subscribed_to_ontology?(ontology_acronym, user)
- user = LinkedData::Client::Models::User.find(user.username, {include: 'subscription'}) if user.subscription.nil?
+ user = LinkedData::Client::Models::User.find(user.username, {include: 'all'}) if user.subscription.nil?
return false if user.subscription.nil? or user.subscription.empty?
user.subscription.each do |sub|
- #sub = {ontology: ontology_acronym, notification_type: "NOTES"}
sub_ont_acronym = sub[:ontology] ? sub[:ontology].split('/').last : nil # make sure we get the acronym, even if it's a full URI
return true if sub_ont_acronym == ontology_acronym
end
return false
end
- def ontolobridge_instructions_template(ontology)
- ont_data = Ontology.find_by(acronym: ontology.acronym)
- ont_data.nil? || ont_data.new_term_instructions.empty? ? t('concepts.request_term.new_term_instructions') : ont_data.new_term_instructions
- end
-
# http://stackoverflow.com/questions/1293573/rails-smart-text-truncation
def smart_truncate(s, opts = {})
opts = {:words => 20}.merge(opts)
@@ -226,95 +217,40 @@ def notification_type(flash_key)
bootstrap_alert_class[flash_key]
end
- def bp_ont_link(ont_acronym)
- return "/ontologies/#{ont_acronym}"
- end
+ def label_ajax_link(id, ont_acronym, ajax_uri, target)
+ ajax_uri = if ajax_uri.include?('?')
+ "#{ajax_uri}&ontology=#{ont_acronym}&id=#{escape(id)}"
+ else
+ "#{ajax_uri}?ontology=#{ont_acronym}&id=#{escape(id)}"
+ end
- def bp_class_link(cls_id, ont_acronym)
- return "#{bp_ont_link(ont_acronym)}?p=classes&conceptid=#{escape(cls_id)}&language=#{request_lang}"
- end
-
- def bp_scheme_link(scheme_id, ont_acronym)
- return "#{bp_ont_link(ont_acronym)}?p=schemes&schemeid=#{escape(scheme_id)}"
- end
-
- def bp_label_xl_link(label_xl_id, ont_acronym)
- return "#{bp_ont_link(ont_acronym)}/?label_xl_id=#{escape(label_xl_id)}"
- end
-
- def bp_collection_link(collection_id, ont_acronym)
- "#{bp_ont_link(ont_acronym)}?p=collection&collectionid=#{escape(collection_id)}"
- 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)
+ content_tag(:span, class: 'concepts-mapping-count') do
+ ajax_link_chip(id, ajax_src: ajax_uri, target: target)
end
end
def get_link_for_cls_ajax(cls_id, ont_acronym, target = nil)
if cls_id.start_with?('http://') || cls_id.start_with?('https://')
- link = bp_class_link(cls_id, ont_acronym)
ajax_url = '/ajax/classes/label'
- 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)
+ label_ajax_link(cls_id, ont_acronym, ajax_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)}' "
- data_ont = " data-ont='#{ont_acronym}' "
- return "
#{ont_acronym}"
- end
-
def get_link_for_scheme_ajax(scheme, ont_acronym, target = '_blank')
- link = bp_scheme_link(scheme, ont_acronym)
ajax_url = "/ajax/schemes/label?language=#{request_lang}"
- scheme_url = "?p=schemes&schemeid=#{CGI.escape(scheme)}"
- label_ajax_link(link, scheme, ont_acronym, ajax_url, scheme_url, target)
+ label_ajax_link(scheme, ont_acronym, ajax_url, target)
end
def get_link_for_collection_ajax(collection, ont_acronym, target = '_blank')
- link = bp_collection_link(collection, ont_acronym)
ajax_url = "/ajax/collections/label?language=#{request_lang}"
- collection_url = "?p=collections&collectionid=#{CGI.escape(collection)}"
- label_ajax_link(link, collection, ont_acronym, ajax_url, collection_url, target)
- end
-
- def get_link_for_label_xl_ajax(label_xl, ont_acronym, cls_id, modal: true)
- link = label_xl
- ajax_uri = "/ajax/label_xl/label?cls_id=#{CGI.escape(cls_id)}"
- label_xl_url = "/ajax/label_xl/?id=#{CGI.escape(label_xl)}&ontology=#{ont_acronym}&cls_id=#{CGI.escape(cls_id)}"
- data = label_ajax_data_h(label_xl, ont_acronym, ajax_uri, label_xl_url)
- data[:data][:controller] = 'label-ajax'
- if modal
- link_to_modal(cls_id, link, {data: data[:data] , class: 'btn btn-sm btn-light m-1'})
- else
- link_to(link,'', {data: data[:data], class: 'btn btn-sm btn-light m-1', target: '_blank'})
- end
-
+ label_ajax_link(collection, ont_acronym, ajax_url, target)
+ end
+ def get_link_for_label_xl_ajax(label_xl, ont_acronym, cls_id, target = nil)
+ ajax_url = "/ajax/label_xl/label?cls_id=#{CGI.escape(cls_id)}"
+ label_ajax_link(label_xl, ont_acronym, ajax_url, target)
end
def ontology_viewer_page_name(ontology_name, concept_label, page)
@@ -449,14 +385,14 @@ def prefixed_url(url)
def show_advanced_options_button(text: nil, init: nil)
content_tag(:div, class: "#{init ? 'd-none' : ''} advanced-options-button", 'data-action': 'click->reveal-component#show', 'data-reveal-component-target': 'showButton') do
inline_svg_tag('icons/settings.svg') +
- content_tag(:div, text, class: 'text')
+ content_tag(:div, text, class: 'text')
end
end
def hide_advanced_options_button(text: nil, init: nil)
content_tag(:div, class: "#{init ? '' : 'd-none'} advanced-options-button", 'data-action': 'click->reveal-component#hide', 'data-reveal-component-target': 'hideButton') do
inline_svg_tag('icons/hide.svg') +
- content_tag(:div, text, class: 'text')
+ content_tag(:div, text, class: 'text')
end
end
diff --git a/app/helpers/collections_helper.rb b/app/helpers/collections_helper.rb
index 9a80d24111..f8593cba2e 100644
--- a/app/helpers/collections_helper.rb
+++ b/app/helpers/collections_helper.rb
@@ -1,5 +1,5 @@
module CollectionsHelper
- include MultiLanguagesHelper
+ include MultiLanguagesHelper, UrlsHelper
def get_collections(ontology, add_colors: false)
@@ -49,8 +49,8 @@ def no_collections_alert
end
end
- def collection_path(collection_id = '', language = '')
- "/ontologies/#{@ontology.acronym}/collections/show?id=#{escape(collection_id)}&language=#{language}"
+ def collection_path(collection_id: '', ontology_id: @ontology.acronym, language: request_lang)
+ "/ontologies/#{ontology_id}/collections/show?id=#{escape(collection_id)}&language=#{language}"
end
def request_collection_id
@@ -65,8 +65,8 @@ def link_to_collection(collection, selected_collection_id)
pref_label_lang, pref_label_html = get_collection_label(collection)
tooltip = pref_label_lang.to_s.eql?('@none') ? '' : "data-controller='tooltip' data-tooltip-position-value='right' title='#{pref_label_lang.upcase}'"
<<-EOS
-
#{pref_label_html}
diff --git a/app/helpers/components_helper.rb b/app/helpers/components_helper.rb
index a63ba8edb5..53a5e34cb6 100644
--- a/app/helpers/components_helper.rb
+++ b/app/helpers/components_helper.rb
@@ -107,7 +107,7 @@ def paginated_list_component(id:, results:, next_page_url:, child_url:, child_tu
end
def resolvability_check_tag(url)
- content_tag(:span, check_resolvability_container(url), style: 'display: inline-block;', onClick: "window.open('#{check_resolvability_url(url: url)}', '_blank');")
+ content_tag(:span, check_resolvability_container(url), class: 'resolvability-check',style: 'display: inline-block;', onClick: "window.open('#{check_resolvability_url(url: url)}', '_blank');")
end
def rounded_button_component(link)
@@ -172,6 +172,10 @@ def tree_component(root, selected, target_frame:, sub_tree: false, id: nil, auto
end
end
+ def ajax_link_chip(id, label = nil, link = nil, external: false, open_in_modal: false, ajax_src: nil, target: '_blank')
+ render LabelFetcherComponent.new(id: id, label: label, link: link, open_in_modal: open_in_modal, ajax_src: ajax_src, target: target, external: external)
+ end
+
def chart_component(title: '', type:, labels:, datasets:, index_axis: 'x', show_legend: false)
data = {
controller: 'load-chart',
@@ -270,14 +274,14 @@ def properties_dropdown(id, title, tooltip, properties, is_open: false, &block)
end
end
- def regular_button(id, value, variant: "secondary", state: "regular", size: "slim", &block)
- render Buttons::RegularButtonComponent.new(id:id, value: value, variant: variant, state: state, size: size) do |btn|
+ def regular_button(id, value, variant: "secondary", state: "regular", size: "slim", href: nil, &block)
+ render Buttons::RegularButtonComponent.new(id:id, value: value, variant: variant, state: state, size: size, href: href) do |btn|
capture(btn, &block) if block_given?
end
end
- def form_save_button
- render Buttons::RegularButtonComponent.new(id: 'save-button', value: t('components.save_button'), variant: "primary", size: "slim", type: "submit") do |btn|
+ def form_save_button(enable_loading: true)
+ render Buttons::RegularButtonComponent.new(id: 'save-button', value: t('components.save_button'), variant: "primary", size: "slim", type: "submit", state: enable_loading ? 'animate' : '') do |btn|
btn.icon_left do
inline_svg_tag "check.svg"
end
diff --git a/app/helpers/concepts_helper.rb b/app/helpers/concepts_helper.rb
index 3cec8ade6b..1b62c06d76 100644
--- a/app/helpers/concepts_helper.rb
+++ b/app/helpers/concepts_helper.rb
@@ -1,6 +1,11 @@
# frozen_string_literal: true
module ConceptsHelper
- include TermsReuses
+ include TermsReuses, UrlsHelper
+
+ def concept_path(id, ontology_id, language)
+ "/ontologies/#{ontology_id}?p=classes&conceptid=#{escape(id)}&language=#{language}"
+ end
+
def concept_link(acronym, child, language)
child.id.eql?('bp_fake_root') ? '#' : "/ontologies/#{acronym}/concepts/show?id=#{CGI.escape(child.id)}&language=#{language}"
end
@@ -76,14 +81,9 @@ def default_sub_menu_class
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)
+ ontology_not_found(ont_id) if @ontology.nil? || @ontology.errors
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
+ cls&.prefLabel || cls_id
end
def concept_id_param_exist?(params)
diff --git a/app/helpers/federation_helper.rb b/app/helpers/federation_helper.rb
index d961712bc0..f0b2fc409d 100644
--- a/app/helpers/federation_helper.rb
+++ b/app/helpers/federation_helper.rb
@@ -3,6 +3,11 @@ module FederationHelper
def federated_portals
$FEDERATED_PORTALS ||= LinkedData::Client.settings.federated_portals
+ $FEDERATED_PORTALS.each do |key, portal|
+ portal[:ui] += "/" unless portal[:ui].end_with?("/")
+ portal[:api] += "/" unless portal[:api].end_with?("/")
+ end
+ $FEDERATED_PORTALS
end
def internal_portal_config(id)
@@ -53,13 +58,17 @@ def ontology_portal_color(id)
end
def ontoportal_ui_link(id)
+ if id.include?($REST_URL)
+ return id.gsub($REST_URL,'')
+ end
+
portal_key, config = ontology_portal_config(id)
return nil unless portal_key
ui_link = config[:ui]
api_link = config[:api]
- id.gsub(api_link, "#{ui_link}/") rescue id
+ id.gsub(api_link, "#{ui_link}") rescue id
end
def internal_ontology?(id)
@@ -210,14 +219,18 @@ def init_federation_portals_status
end
def federated_search_counts(search_results)
- ids = search_results.map do |result|
- result.dig(:root, :ontology_id) || rest_url
- end
+ ids = search_results.flat_map do |result|
+ ontology_id = result.dig(:root, :ontology_id) || rest_url
+ other_portal_ids = result.dig(:root, :other_portals)&.map { |portal| portal[:link].split('?').first } || []
+ [ontology_id] + other_portal_ids
+ end.uniq
counts_ontology_ids_by_portal_name(ids)
end
def federated_browse_counts(ontologies)
- ids = ontologies.map { |ontology| ontology[:id] }
+ ids = ontologies.flat_map do |ontology|
+ [ontology[:id]] + (ontology[:sources] || [])
+ end.uniq
counts_ontology_ids_by_portal_name(ids)
end
@@ -230,8 +243,9 @@ def counts_ontology_ids_by_portal_name(portals_ids)
counts[current_portal.downcase] += 1 if id.include?(current_portal.to_s.downcase)
federation_portals.each do |portal|
- portal_api = federated_portals[portal.downcase.to_sym][:api]
- counts[portal.downcase] += 1 if id.include?(portal_api)
+ portal_api = federated_portals[portal.downcase.to_sym][:api].sub(/^https?:\/\//, '')
+ portal_ui = federated_portals[portal.downcase.to_sym][:ui].sub(/^https?:\/\//, '')
+ counts[portal.downcase] += 1 if (id.include?(portal_api) || id.include?(portal_ui))
end
end
diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb
index 2ddcdc5275..d521b517e1 100644
--- a/app/helpers/home_helper.rb
+++ b/app/helpers/home_helper.rb
@@ -13,6 +13,8 @@ def render_footer_link(options = {})
def format_number_abbreviated(number)
+ number = 0 if number.nil?
+
if number >= 1_000_000
(number / 1_000_000).to_s + 'M'
elsif number >= 1_000
diff --git a/app/helpers/mappings_helper.rb b/app/helpers/mappings_helper.rb
index c1e503b547..129b1e4bf8 100644
--- a/app/helpers/mappings_helper.rb
+++ b/app/helpers/mappings_helper.rb
@@ -20,24 +20,18 @@ def mapping_links(mapping, concept)
process = mapping.process || {}
if inter_portal_mapping?(target_concept)
- cls_link = ajax_to_inter_portal_cls(target_concept)
+ cls_link = target_concept.id
ont_name = target_concept.links['ontology']
ont_link = link_to ont_name, get_inter_portal_ui_link(ont_name, process['name']), target: '_blank'
source_tooltip = 'Internal-portal'
elsif internal_mapping?(target_concept)
- begin
- ont = target_concept.explore.ontology
- ont_name = ont.acronym
- ont_link = link_to ont_name, ontology_path(ont_name), 'data-turbo-frame': '_top'
- rescue
- ont_name = target_concept.links['ontology'] || target_concept.id
- ont_link = ont_name
- end
+ ont_name = target_concept.links['ontology'].split('/').last
+ ont_link = link_to ont_name, ontology_path(ont_name), 'data-turbo-frame': '_top'
cls_link = raw(get_link_for_cls_ajax(target_concept.id, ont_name, '_top'))
source_tooltip = 'Internal'
else
cls_label = ExternalLinkTextComponent.new(text: target_concept.links['self']).call
- cls_link = raw("#{cls_label}")
+ cls_link = raw("
#{cls_label}")
ont_name = target_concept.links['ontology']
ont_link = link_to ExternalLinkTextComponent.new(text: ont_name).call, target_concept.links['ontology'],
target: '_blank'
@@ -77,24 +71,10 @@ def get_prefixed_uri(uri)
uri
end
- # method to get (using http) prefLabel for interportal classes
- # Using bp_ajax_controller.ajax_process_interportal_cls will try to resolve class labels.
- def ajax_to_inter_portal_cls(cls)
- inter_portal_acronym = get_inter_portal_acronym(cls.links['ui'])
- href_cls = " href='#{cls.links["ui"]}' "
- if inter_portal_acronym
- data_cls = " data-cls='#{cls.links["self"]}?apikey=' "
- portal_cls = " portal-cls='#{inter_portal_acronym}' "
- raw("
#{cls.id}")
- else
- raw("
#{cls.id}")
- end
-
- end
-
def ajax_to_internal_cls(cls)
- link_to("#{cls.id}
".html_safe,
- ontology_path(cls.explore.ontology.acronym, p: 'classes', conceptid: cls.id), target: '_blank')
+ cls_id = cls.id
+ ont_acronym = cls.links['ontology'].split('/').last
+ get_link_for_cls_ajax(cls_id, ont_acronym, '_blank')
end
# to get the apikey from the interportal instance of the interportal class.
@@ -111,18 +91,15 @@ def get_inter_portal_acronym(class_ui_url)
end
end
- # method to extract the prefLabel from the external class URI
- def get_label_for_external_cls(class_uri)
- prefLabel = if class_uri.include? '#'
- class_uri.split('#')[-1]
- else
- class_uri.split('/')[-1]
- end
- return prefLabel
- end
-
def ajax_to_external_cls(cls)
- raw("
#{get_label_for_external_cls(cls.id)}")
+ class_uri = cls.id
+ text = if class_uri.include? '#'
+ class_uri.split('#')[-1]
+ else
+ class_uri.split('/')[-1]
+ end
+ text = render(ExternalLinkTextComponent.new(text: text))
+ link_to text, cls.links['self'], target: '_blank'
end
# Replace the inter_portal mapping ontology URI (that link to the API) by the link to the ontology in the UI
diff --git a/app/helpers/multi_languages_helper.rb b/app/helpers/multi_languages_helper.rb
index 6e127b94e0..ada13053b1 100644
--- a/app/helpers/multi_languages_helper.rb
+++ b/app/helpers/multi_languages_helper.rb
@@ -22,6 +22,10 @@ def portal_languages
}
end
+ def portal_language_enabled?(lang)
+ portal_languages.reject { |_k, x| x[:disabled] }.keys.include?(lang)
+ end
+
def portal_language_selector
languages = portal_languages
selected_language = portal_lang
diff --git a/app/helpers/ontologies_helper.rb b/app/helpers/ontologies_helper.rb
index f3a7ae05f7..bc840b6c35 100644
--- a/app/helpers/ontologies_helper.rb
+++ b/app/helpers/ontologies_helper.rb
@@ -529,12 +529,15 @@ def render_concepts_json_button(link)
def ontology_object_details_component(frame_id: , ontology_id:, objects_title:, object:, &block)
render TurboFrameComponent.new(id: frame_id, data: {"turbo-frame-target": "frame"}) do
- return if !object.present?
- return alert_component(object.errors.join) if object.errors
+ return unless object.present?
- ontology_object_tabs_component(ontology_id: ontology_id, objects_title: objects_title, object_id: object["@id"]) do |tabs|
- tab_item_component(container_tabs: tabs, title: t('concepts.details'), path: '#details', selected: true) do
- capture(&block)
+ if object.errors
+ alert_component(object.errors.join)
+ else
+ ontology_object_tabs_component(ontology_id: ontology_id, objects_title: objects_title, object_id: object["@id"]) do |tabs|
+ tab_item_component(container_tabs: tabs, title: t('concepts.details'), path: '#details', selected: true) do
+ capture(&block)
+ end
end
end
end
@@ -627,7 +630,7 @@ def ontology_depiction_card
def count_subscriptions(ontology_id)
ontology_id = ontology_id.split('/').last
- users = LinkedData::Client::Models::User.all(include: 'subscription', display_context: false, display_links: false)
+ users = LinkedData::Client::Models::User.all(include: 'all', display_context: false, display_links: false)
users.select { |u| u.subscription.find { |s| s.ontology && s.ontology.split('/').last.eql?(ontology_id) } }.count
end
diff --git a/app/helpers/schemes_helper.rb b/app/helpers/schemes_helper.rb
index 9d3019cd36..7eec737c73 100644
--- a/app/helpers/schemes_helper.rb
+++ b/app/helpers/schemes_helper.rb
@@ -1,4 +1,5 @@
module SchemesHelper
+ include UrlsHelper
def get_schemes(ontology)
ontology.explore.schemes(language: request_lang)
@@ -47,8 +48,8 @@ def section_name(section)
t("ontology_details.sections.#{section}")
end
- def scheme_path(scheme_id = '', language = '')
- "/ontologies/#{@ontology.acronym}/schemes/show?id=#{escape(scheme_id)}&lang=#{language}"
+ def scheme_path(ontology_id: @ontology.acronym, scheme_id: '', language: request_lang)
+ "/ontologies/#{ontology_id}/schemes/show?id=#{escape(scheme_id)}&lang=#{language}"
end
def no_main_scheme?
@@ -64,6 +65,7 @@ def no_main_scheme_alert
t('schemes.no_main_scheme_alert')
end
end
+
def no_schemes_alert
render Display::AlertComponent.new do
t('schemes.no_schemes_alert', acronym: @ontology.acronym)
@@ -88,7 +90,6 @@ def schemes_tree(schemes_labels, main_scheme_label, selected_scheme_id, submissi
scheme
end.compact
-
main_scheme = nil
if main_scheme_label.nil?
children = schemes
@@ -105,8 +106,8 @@ def schemes_tree(schemes_labels, main_scheme_label, selected_scheme_id, submissi
root.children = children
selected_scheme = selected_scheme || main_scheme || root.children.first
tree_component(root, selected_scheme, target_frame: 'scheme', auto_click: false, submission: submission) do |child|
- href = scheme_path(child['@id'], request_lang) rescue ''
- data = { schemeid: (child['@id'] rescue '')}
+ href = scheme_path(scheme_id: child['@id'], ontology_id: @ontology.acronym, language: request_lang)
+ data = { schemeid: child['@id']}
["#", data, href]
end
end
diff --git a/app/helpers/submission_inputs_helper.rb b/app/helpers/submission_inputs_helper.rb
index 06ecee5b39..2636fdc68e 100644
--- a/app/helpers/submission_inputs_helper.rb
+++ b/app/helpers/submission_inputs_helper.rb
@@ -108,12 +108,12 @@ def attribute_input(attr_key, long_text: false, label: nil, show_tooltip: true,
end
- def ontology_name_input(ontology = @ontology)
- text_input(name: 'ontology[name]', value: ontology.name)
+ def ontology_name_input(ontology = @ontology, label: 'Name')
+ text_input(name: 'ontology[name]', value: ontology.name, label: label_required(label))
end
- def ontology_acronym_input(ontology = @ontology, update: @is_update_ontology)
- out = text_input(name: 'ontology[acronym]', value: ontology.acronym, disabled: update)
+ def ontology_acronym_input(ontology = @ontology, update: @is_update_ontology, label: 'Acronym')
+ out = text_input(name: 'ontology[acronym]', value: ontology.acronym, disabled: update, label: label_required(label))
out += hidden_field_tag('ontology[acronym]', ontology.acronym) if update
out
end
@@ -123,7 +123,7 @@ def ontology_administered_by_input(ontology = @ontology, users_list = @user_sele
users_list = LinkedData::Client::Models::User.all(include: "username").map { |u| [u.username, u.id] }
users_list.sort! { |a, b| a[1].downcase <=> b[1].downcase }
end
- select_input(label: t('submission_inputs.administrators'), name: "ontology[administeredBy]", values: users_list, selected: ontology.administeredBy || session[:user].id, multiple: true)
+ select_input(label: label_required(t('submission_inputs.administrators')), name: "ontology[administeredBy]", values: users_list, selected: ontology.administeredBy || session[:user].id, multiple: true)
end
def ontology_categories_input(ontology = @ontology, categories = @categories)
@@ -213,7 +213,7 @@ def ontology_visibility_input(ontology = @ontology)
render(Layout::RevealComponent.new(possible_values: %w[private public], selected: ontology.viewingRestriction)) do |c|
c.button do
- select_input(label: t('submission_inputs.visibility'), name: "ontology[viewingRestriction]", required: true,
+ select_input(label: label_required(t('submission_inputs.visibility')), name: "ontology[viewingRestriction]", required: true,
values: %w[public private],
selected: ontology.viewingRestriction)
end
@@ -248,7 +248,7 @@ def contact_input(label: '', name: t('submission_inputs.contact'), show_help: tr
render NestedFormInputsComponent.new(object_name: 'contact', default_empty_row: true) do |c|
c.header do
- content_tag(:div, name.blank? ? '' : t('submission_inputs.contact_name', name: name), class: 'w-50') + content_tag(:div, name.blank? ? '' : t('submission_inputs.contact_email', name: name), class: 'w-50')
+ content_tag(:div, name.blank? ? '' : label_required(t('submission_inputs.contact_name', name: name)), class: 'w-50') + content_tag(:div, name.blank? ? '' : label_required(t('submission_inputs.contact_email', name: name)), class: 'w-50')
end
c.template do
@@ -531,4 +531,11 @@ def attribute_help_text(attr)
help_text
end
end
+
+ def label_required(label)
+ content_tag(:div) do
+ label.html_safe +
+ content_tag(:span, '*', style: 'color: var(--error-color);')
+ end
+ end
end
diff --git a/app/javascript/controllers/class_search_auto_complete_controller.js b/app/javascript/controllers/class_search_auto_complete_controller.js
index 831cfee410..0a42a8d343 100644
--- a/app/javascript/controllers/class_search_auto_complete_controller.js
+++ b/app/javascript/controllers/class_search_auto_complete_controller.js
@@ -11,14 +11,9 @@ export default class extends OntoportalAutocompleteController {
onFindValue(li) {
if (li == null) {
- // User performs a search
- let search = confirm("Class could not be found.\n\nPress OK to go to the Search page or Cancel to continue browsing");
-
- if (search) {
- jQuery("#search_keyword").val(jQuery("#search_box").val());
- jQuery("#search_form").submit();
- return
- }
+ // No result found
+ // TODO in this case show a message to redirect to the global search page
+ return
}
// Appropriate value selected
diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js
index fa09b85416..7b99fc21d4 100644
--- a/app/javascript/controllers/index.js
+++ b/app/javascript/controllers/index.js
@@ -34,12 +34,6 @@ 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)
diff --git a/app/javascript/controllers/label_ajax_controller.js b/app/javascript/controllers/label_ajax_controller.js
deleted file mode 100644
index d3cbcfff46..0000000000
--- 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 a8f606114c..0000000000
--- 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/turbo_frame_error_controller.js b/app/javascript/controllers/turbo_frame_error_controller.js
index 782166bc54..16d2cbbd28 100644
--- a/app/javascript/controllers/turbo_frame_error_controller.js
+++ b/app/javascript/controllers/turbo_frame_error_controller.js
@@ -34,7 +34,10 @@ export default class extends Turbo_frame_controller {
Array.from(styles).forEach(e => el.removeChild(e))
let body = el.querySelector('h1')
- this.errorMessageTarget.firstElementChild.querySelector('.alert-message').innerHTML = (body ? body.innerText : el.innerHTML)
+ let alertContainer = this.errorMessageTarget.firstElementChild?.querySelector('.alert-message')
+ if(alertContainer){
+ alertContainer.innerHTML = (body ? body.innerText : el.innerHTML)
+ }
$(this.errorMessageTarget).show()
}
diff --git a/app/views/collections/_list_view.html.haml b/app/views/collections/_list_view.html.haml
index a50abe0ce2..d0594f157f 100644
--- a/app/views/collections/_list_view.html.haml
+++ b/app/views/collections/_list_view.html.haml
@@ -11,6 +11,6 @@
- scheme = OpenStruct.new(collection)
- scheme.prefLabel = Array(get_collection_label(collection)).last
- scheme.id = scheme['@id']
- - tree_child.child(child: scheme, href: collection_path(collection['@id'], request_lang),
+ - tree_child.child(child: scheme, href: collection_path(collection_id: collection['@id'], ontology_id: @ontology.acronym, language: request_lang),
children_href: '#', selected: scheme.id.eql?(selected_collection_id),
target_frame: 'collection', data: {collectionid: collection['@id']}, is_reused: concept_reused?(submission: @submission, concept_id: scheme.id))
diff --git a/app/views/concepts/_list.html.haml b/app/views/concepts/_list.html.haml
index 9c9a28a848..45d56b6f41 100644
--- a/app/views/concepts/_list.html.haml
+++ b/app/views/concepts/_list.html.haml
@@ -10,6 +10,9 @@
= render TreeLinkComponent.new(child: concept, href: href,
children_href: '#', selected: concept.id.eql?(concepts.first.id) && c.auto_click?,
target_frame: 'concept_show', data: data, is_reused: concept_reused?(submission: @submission, concept_id: concept.id))
- - c.error do
- = t('concepts.list_error')
+ - c.error do
+ - if @collection.nil?
+ = t("ontologies.concepts_browsers.select_collection")
+ - else
+ = t('concepts.list_error')
diff --git a/app/views/concepts/_request_term.html.haml b/app/views/concepts/_request_term.html.haml
deleted file mode 100644
index 85c364f60e..0000000000
--- a/app/views/concepts/_request_term.html.haml
+++ /dev/null
@@ -1,47 +0,0 @@
-:plain
-
-.notes_list_container
- .add_request_term{style: "float: left; margin-right: 1em;"}
- %div#ob_success_message{class: "message-box success-msg", style: "display: none; margin: 10px 0;"}
- %div#ob_error_message{class: "message-box error-msg", style: "display: none; margin: 10px 0;"}
- - if !session[:user].nil? && @ontology.admin?(session[:user])
- %p
- %em
- = t('concepts.request_terms_instructions', acronym: @ontology.acronym)
- %div#new_term_instructions_container{style: 'clear: both;'}
- %form#new_term_instructions_form
- = hidden_field nil, :acronym, value: @ontology.acronym
- = hidden_field nil, :new_term_instructions_old, value: @ob_instructions.html_safe
- %div#new_term_instructions
- = @ob_instructions.html_safe
- %button#new_term_instructions_submit{class: "btn", type: "button", title: t('concepts.submit_changes'), alt: "Submit Changes", style: 'display: none;'}
- = t('concepts.submit_changes')
- %button#new_term_instructions_cancel{class: "btn", type: "button", title: t('concepts.cancel'), alt: "Cancel", style: 'display: none;'}
- = t('concepts.cancel')
- %span#progress_message{style: 'display: none; margin-left: 20px;'}
- - else
- %div
- = @ob_instructions.html_safe
- - if session[:user].nil?
- = link_to t('concepts.request_new_term'), login_index_path, style: "font-size: .9em;"
- - else
- = link_to t('concepts.request_new_term'), "javascript:void(0);", class: "add_request_term", style: "font-size: .9em;", data: { parent_id: "#{@concept.id}" }
- %div.request_term_form_div{style: "display: none; clear: both; padding-top: 1em;"}
-
-:javascript
- var g_prefLabel;
-
- jQuery(document).ready(function() {
- g_prefLabel = '#{@concept.prefLabel({:use_html => false}).html_safe}';
-
- if (!g_prefLabel) {
- g_prefLabel = '#{@concept.id}';
- }
- var isPopulated = window.localStorage.getItem('request_term_form_populated');
-
- if (isPopulated) {
- addRequestTermBox("#{@concept.id}");
- }
- });
diff --git a/app/views/concepts/_show.html.haml b/app/views/concepts/_show.html.haml
index 8d690b65fd..bbbb95614b 100644
--- a/app/views/concepts/_show.html.haml
+++ b/app/views/concepts/_show.html.haml
@@ -1,4 +1,4 @@
-= render TurboFrameComponent.new(id: 'concept_show', data: {controller:'labels-ajax-container', 'action': 'turbo:before-fetch-request->labels-ajax-container#abortAll', 'labels-ajax-container-label-ajax-outlet': '#concept_show a[data-controller="label-ajax"]'}) do
+= render TurboFrameComponent.new(id: 'concept_show') do
- if @concept.id.eql?("bp_fake_root")
= render Display::AlertComponent.new do
= t('concepts.use_jump_to')
diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml
index 8bc39eba97..43fc5ff02b 100644
--- a/app/views/home/index.html.haml
+++ b/app/views/home/index.html.haml
@@ -22,18 +22,18 @@
.home-bubble.home-bubble-one
%a.h5{href:"/ontologies/#{@anal_ont_names[0]}", style: "color: white !important"}
= @anal_ont_names[0]
- %p
- = @anal_ont_numbers[0].to_s + " " + t('visits.visits')
+ %p
+ = format_number_abbreviated(@anal_ont_numbers[0]) + " " + (@analytics.empty? ? t('visits.count') : t('visits.visits'))
.home-bubble.home-bubble-two
%a.h5{href:"/ontologies/#{@anal_ont_names[1]}", style: "color: white !important"}
= @anal_ont_names[1]
- %p
- = @anal_ont_numbers[1].to_s + " " + t('visits.visits')
+ %p
+ = format_number_abbreviated(@anal_ont_numbers[1]) + " " + (@analytics.empty? ? t('visits.count') : t('visits.visits'))
.home-bubble.home-bubble-three
%a.h5{href:"/ontologies/#{@anal_ont_names[2]}", style: "color: white !important"}
= @anal_ont_names[2]
- %p
- = @anal_ont_numbers[2].to_s + " " + t('visits.visits')
+ %p
+ = format_number_abbreviated(@anal_ont_numbers[2]) + " " + (@analytics.empty? ? t('visits.count') : t('visits.visits'))
%a.home-bubble.home-bubble-four{:href => "/visits"}
.h5 ...
@@ -47,7 +47,7 @@
.home-body-container
.home-section
- %h4= t('home.ontology_upload')
+ %h4= t('home.ontology_upload', site: portal_name)
%hr.home-section-line/
%p= t('home.ontology_upload_desc')
%p= t('home.ontology_upload_benefits', site: $SITE)
@@ -62,6 +62,56 @@
= upload_ontology_button
.discover-ontologies
= discover_ontologies_button
+ .home-section
+ %h4
+ = t('home.agroportal_figures', site: current_slice_name || portal_name)
+ %hr.home-section-line/
+ .home-statistics-container
+ .home-statistics
+ .home-statistics-item
+ %hr/
+ %div
+ %h4
+ = format_number_abbreviated(@metrics[:ontologies_count])
+ %p= t("home.ontologies")
+ .home-statistics-item
+ %hr/
+ %div
+ %h4
+ = format_number_abbreviated(@metrics[:class_count])
+ %p= t("home.classes")
+ .home-statistics-item
+ %hr/
+ %div
+ %h4
+ = format_number_abbreviated(@metrics[:individuals_count])
+ %p= t("home.individuals")
+ .home-statistics-item
+ %hr/
+ %div
+ %h4
+ = format_number_abbreviated(@metrics[:properties_count])
+ %p= t("home.properties")
+ .home-statistics-item
+ %hr/
+ %div
+ %h4
+ = format_number_abbreviated(@metrics[:projects_count])
+ %p= t("home.projects")
+ .home-statistics-item
+ %hr/
+ %div
+ %h4
+ = format_number_abbreviated(@metrics[:mappings_count])
+ %p= t("home.mappings")
+ .home-statistics-item
+ %hr/
+ %div
+ %h4
+ = format_number_abbreviated(@metrics[:users_count])
+ %p= t("home.users")
+ .home-statistics-link.justify-content-end{style: @analytics.empty? && "visibility: hidden"}
+ = link_to t("home.see_details"),'/statistics', target: "_blank"
.home-section
%h4
@@ -125,57 +175,6 @@
= render LoaderComponent.new(type: 'pulsing')
%script{:async => "", :charset => "utf-8", :src => "https://platform.twitter.com/widgets.js"}
- .home-section
- %h4
- = t('home.agroportal_figures', site: current_slice_name || portal_name)
- %hr.home-section-line/
- .home-statistics-container
- .home-statistics
- .home-statistics-item
- %hr/
- %div
- %h4
- = format_number_abbreviated(@metrics[:ontologies_count])
- %p= t("home.ontologies")
- .home-statistics-item
- %hr/
- %div
- %h4
- = format_number_abbreviated(@metrics[:class_count])
- %p= t("home.classes")
- .home-statistics-item
- %hr/
- %div
- %h4
- = format_number_abbreviated(@metrics[:individuals_count])
- %p= t("home.individuals")
- .home-statistics-item
- %hr/
- %div
- %h4
- = format_number_abbreviated(@metrics[:properties_count])
- %p= t("home.properties")
- .home-statistics-item
- %hr/
- %div
- %h4
- = format_number_abbreviated(@metrics[:projects_count])
- %p= t("home.projects")
- .home-statistics-item
- %hr/
- %div
- %h4
- = format_number_abbreviated(@metrics[:mappings_count])
- %p= t("home.mappings")
- .home-statistics-item
- %hr/
- %div
- %h4
- = format_number_abbreviated(@metrics[:users_count])
- %p= t("home.users")
- .home-statistics-link.justify-content-end{style: @analytics.empty? && "visibility: hidden"}
- = link_to t("home.see_details"),'/statistics', target: "_blank"
-
- if slices_enabled?
.home-section
.home-section-title
@@ -238,4 +237,4 @@
}
function submitRecommender(){
document.getElementById("recommender_submit").click()
- }
+ }
\ No newline at end of file
diff --git a/app/views/home/portal_config.html.haml b/app/views/home/portal_config.html.haml
index b484e9431c..15f04baf13 100644
--- a/app/views/home/portal_config.html.haml
+++ b/app/views/home/portal_config.html.haml
@@ -4,21 +4,21 @@
.div.d-flex.align-items-center
%div
%div.text-center
- = link_to @portal_config[:ui] || @config[:ui], target: '_blank', class: 'home-logo-instances mr-1 m-0', style: "background-color: #{@portal_config[:color] || @config[:color]}" do
+ = link_to @portal_config[:ui] || @config[:ui], target: '_blank', class: 'home-logo-instances mr-1 m-0', style: "background-color: #{@color}" do
= inline_svg 'logo-white.svg', width: "35", height: "26"
%div
- %div.portal-configuration-title{style: "color: #{@portal_config[:color] || @config[:color]}"}
+ %div.portal-configuration-title{style: "color: #{@color}"}
%h3
- = @portal_config[:title] || @config[:name]
+ = @name
- if @portal_config[:numberOfArtefacts]
.portal-config-ontologies
= inline_svg_tag 'icons/ontology.svg'
%span
= "#{@portal_config[:numberOfArtefacts]} ontologies"
- - if @portal_config[:description]
+ - if @portal_config[:description].present?
.portal-description
= @portal_config[:description]
- - if @portal_config[:federated_portals]
+ - if @portal_config[:federated_portals].present?
%div.mb-1
.home-section-title
.text
@@ -31,7 +31,7 @@
%p{style: "color: #{portal[:color]}"}
= portal[:name]
- - if @portal_config[:fundedBy]
+ - if @portal_config[:fundedBy].present?
%div.mb-1
.home-section-title
.portal-config-title-text
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index 1340bdbb26..9e765dbe00 100644
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -46,10 +46,6 @@
{
}
;
- jQuery(document).data().bp.ontolobridge_ontologies =
- <%=$NEW_TERM_REQUEST_ONTOLOGIES.to_json.html_safe%> ||
- [];
- jQuery(document).data().bp.ont_viewer = {};
jQuery(document).data().bp.ont_chart = {};
@@ -60,4 +56,4 @@
<%= turbo_frame_tag :cookies_modal, src: cookies_path if cookies[:cookies_accepted].nil? && !(Rails.env.development? || Rails.env.test?) %>
-<%= render partial: 'layouts/notices' %>
\ No newline at end of file
+<%= render partial: 'layouts/notices' %>
diff --git a/app/views/layouts/_ontology_viewer.html.haml b/app/views/layouts/_ontology_viewer.html.haml
index e7f3010e16..95fe55300d 100644
--- a/app/views/layouts/_ontology_viewer.html.haml
+++ b/app/views/layouts/_ontology_viewer.html.haml
@@ -4,26 +4,6 @@
= render :partial =>'layouts/header'
%div#bd.bg-white.ontology-viewer
- :javascript
- // Ontology viewer vars
- jQuery(document).data().bp.ont_viewer = {};
- jQuery(document).data().bp.ont_viewer.ontology_id = jQuery(document).data().bp.ontology.acronym;
- jQuery(document).data().bp.ont_viewer.ontology_version_id = jQuery(document).data().bp.submission_latest.submissionId;
- jQuery(document).data().bp.ont_viewer.ontology_name = "#{@ontology.name}";
- jQuery(document).data().bp.ont_viewer.org_site = "#{$ORG_SITE}";
- jQuery(document).data().bp.ont_viewer.concept_id = "#{params[:conceptid] || (@concept ? @concept.id : 'root')}";
- jQuery(document).data().bp.ont_viewer.content_section = "#{sanitize(h(content_section))}";
- jQuery(document).data().bp.ont_viewer.concept_param = "#{"conceptid=\#{params[:conceptid]}" unless params[:conceptid].nil? || params[:conceptid].empty?}";
- jQuery(document).data().bp.ont_viewer.concept_name = "#{@concept.prefLabel unless @concept.nil?}";
- jQuery(document).data().bp.ont_viewer.metadata_only = "#{@ontology.summaryOnly}";
- jQuery(document).data().bp.ont_viewer.current_purl = "#{@current_purl}";
- jQuery(document).data().bp.ont_viewer.purl_prefix = "#{($PURL_ENABLED ? $PURL_PREFIX+"/"+@ontology.acronym : '')}";
- jQuery(document).data().bp.ont_viewer.concept_name_title = (jQuery(document).data().bp.ont_viewer.concept_name == "") ?
- "" : " - " + jQuery(document).data().bp.ont_viewer.concept_name;
-
-
-
-
= modal_frame_container
= render partial: 'concepts/perma_link_modal'
diff --git a/app/views/layouts/appliance.html.haml b/app/views/layouts/appliance.html.haml
index 3e306068c0..801d72caba 100644
--- a/app/views/layouts/appliance.html.haml
+++ b/app/views/layouts/appliance.html.haml
@@ -21,7 +21,6 @@
jQuery(document).data({bp: {config: #{bp_config_json.html_safe}, user: #{(session[:user] || {}).to_hash.to_json.html_safe}}});
jQuery(document).data().bp.ontology = #{@ontology.to_json.html_safe} || {};
jQuery(document).data().bp.submission_latest = #{@submission_latest.to_json.html_safe} || {};
- jQuery(document).data().bp.ont_viewer = {};
jQuery(document).data().bp.ont_chart = {};
%body{:class => "#{controller_name} #{action_name}"}
@@ -35,4 +34,3 @@
= yield
= render partial: "layouts/footer"
-
diff --git a/app/views/layouts/component_preview.html.erb b/app/views/layouts/component_preview.html.erb
index 429f630109..04686f6ce4 100644
--- a/app/views/layouts/component_preview.html.erb
+++ b/app/views/layouts/component_preview.html.erb
@@ -41,10 +41,6 @@
{
}
;
- jQuery(document).data().bp.ontolobridge_ontologies =
- <%=$NEW_TERM_REQUEST_ONTOLOGIES.to_json.html_safe%> ||
- [];
- jQuery(document).data().bp.ont_viewer = {};
jQuery(document).data().bp.ont_chart = {};
@@ -57,4 +53,4 @@