diff --git a/Gemfile b/Gemfile index adaeb43a..20094378 100644 --- a/Gemfile +++ b/Gemfile @@ -51,7 +51,7 @@ gem 'ncbo_cron', git: 'https://github.com/ontoportal-lirmm/ncbo_cron.git', branc gem 'ncbo_ontology_recommender', git: 'https://github.com/ncbo/ncbo_ontology_recommender.git', branch: 'master' gem 'goo', github: 'ontoportal-lirmm/goo', branch: 'development' gem 'sparql-client', github: 'ontoportal-lirmm/sparql-client', branch: 'development' -gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'development' +gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'feature/add-portal-config-model' group :development do # bcrypt_pbkdf and ed35519 is required for capistrano deployments when using ed25519 keys; see https://github.com/miloserdow/capistrano-deploy/issues/42 diff --git a/Gemfile.lock b/Gemfile.lock index b2273ce2..e3ec9bda 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -57,8 +57,8 @@ GIT GIT remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git - revision: 9605eb44c4271c60bedda0520e85d8c3fa2513ac - branch: development + revision: d893c08a2c2f11c743fad520873b7f98b0805240 + branch: feature/add-portal-config-model specs: ontologies_linked_data (0.0.1) activesupport @@ -164,7 +164,7 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - ffi (1.17.0) + ffi (1.17.0-x86_64-linux-gnu) gapic-common (0.21.1) faraday (>= 1.9, < 3.a) faraday-retry (>= 1.0, < 3.a) @@ -258,7 +258,7 @@ GEM mutex_m (0.2.0) net-http-persistent (4.0.2) connection_pool (~> 2.2) - net-imap (0.4.14) + net-imap (0.4.15) date net-protocol net-pop (0.1.2) diff --git a/config/environments/config.rb.sample b/config/environments/config.rb.sample index f143b8f9..4e7900b7 100644 --- a/config/environments/config.rb.sample +++ b/config/environments/config.rb.sample @@ -87,6 +87,37 @@ LinkedData.config do |config| link: 'https://www.googleapis.com/oauth2/v3/userinfo' } } + config.ui_name = 'Bioportal' + config.title = 'NCBO BioPortal' + config.description = "The world's most comprehensive repository of biomedical ontologies " + config.color = '#234979' + config.logo = '' + config.fundedBy = [ + { + img_src: 'https://identity.stanford.edu/wp-content/uploads/sites/3/2020/07/block-s-right.png', + url: 'https://www.stanford.edu', + + }, + { + img_src: 'https://ontoportal.org/images/logo.png', + url: 'https://ontoportal.org/', + } + ] + config.federated_portals = { + 'agroportal' => { + api: 'http://data.agroportal.lirmm.fr', + ui: 'http://agroportal.lirmm.fr', + apikey: '1cfae05f-9e67-486f-820b-b393dec5764b', + color: '#1e2251' + }, + 'bioportal' => { + api: 'http://data.bioontology.org', + ui: 'http://bioportal.bioontology.org', + apikey: '4a5011ea-75fa-4be6-8e89-f45c8c84844e', + color: '#234979' + }, + + } end Annotator.config do |config| diff --git a/controllers/home_controller.rb b/controllers/home_controller.rb index a44fd22e..140d4522 100644 --- a/controllers/home_controller.rb +++ b/controllers/home_controller.rb @@ -4,7 +4,7 @@ class HomeController < ApplicationController CLASS_MAP = { - Property: "LinkedData::Models::ObjectProperty" + Property: "LinkedData::Models::ObjectProperty" } namespace "/" do @@ -28,14 +28,22 @@ class HomeController < ApplicationController next if route.length < 3 || route.split("/").length > 2 route_no_slash = route.gsub("/", "") context[route_no_slash] = route_to_class_map[route].type_uri.to_s if route_to_class_map[route] && route_to_class_map[route].respond_to?(:type_uri) - routes_hash[route_no_slash] = LinkedData.settings.rest_url_prefix+route_no_slash + routes_hash[route_no_slash] = LinkedData.settings.rest_url_prefix + route_no_slash end - routes_hash["@context"] = context - reply ({links: routes_hash}) + + config = LinkedData::Models::PortalConfig.current_portal_config + + federated_portals = config.federated_portals + federated_portals. transform_values! { |v| v.delete(:apikey) ; v } + config.init_federated_portals_settings(federated_portals) + + config.class.link_to *routes_hash.map { |key, url| LinkedData::Hypermedia::Link.new(key, url, context[key]) } + + reply config end get "documentation" do - @metadata_all = metadata_all.sort {|a,b| a[0].name <=> b[0].name} + @metadata_all = metadata_all.sort { |a, b| a[0].name <=> b[0].name } haml "documentation/documentation".to_sym, :layout => "documentation/layout".to_sym end