Skip to content

Commit

Permalink
Merge branch 'cleanup/remove_BPIDResolver'
Browse files Browse the repository at this point in the history
  • Loading branch information
jvendetti committed Dec 4, 2024
2 parents 26d12fd + 13a25c3 commit e055ea0
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 67 deletions.
28 changes: 0 additions & 28 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,34 +231,6 @@ def redirect_to_home # Redirect to Home Page
redirect_to "/"
end

def redirect_new_api(class_view = false)
# Hack to make ontologyid and conceptid work in addition to id and ontology params
params[:ontology] = params[:ontology].nil? ? params[:ontologyid] : params[:ontology]
# Error checking
if params[:ontology].nil? || params[:id] && params[:ontology].nil?
@error = "Please provide an ontology id or concept id with an ontology id."
return
end
acronym = BPIDResolver.id_to_acronym(params[:ontology])
not_found unless acronym
if class_view
@ontology = LinkedData::Client::Models::Ontology.find_by_acronym(acronym).first
@submission = get_ontology_submission_ready(@ontology)
concept = get_class(params, @submission).first.to_s
redirect_to "/ontologies/#{acronym}?p=classes#{params_string_for_redirect(params, prefix: "&")}", :status => :moved_permanently
else
redirect_to "/ontologies/#{acronym}#{params_string_for_redirect(params)}", :status => :moved_permanently
end
end

def params_cleanup_new_api
params = @_params
if params[:ontology] && params[:ontology].to_i > 0
params[:ontology] = BPIDResolver.id_to_acronym(params[:ontology])
end

params
end

def params_string_for_redirect(params, options = {})
prefix = options[:prefix] || "?"
Expand Down
9 changes: 0 additions & 9 deletions app/controllers/concepts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

class ConceptsController < ApplicationController
include MappingsHelper
before_action :redirect_new_api, except: [:show, :biomixer]

layout 'ontology'

Expand Down Expand Up @@ -113,14 +112,6 @@ def biomixer
render partial: 'biomixer', layout: false
end

def redirect_new_api
return unless params[:ontology].to_i.positive?

params_cleanup_new_api
redirect_to "#{request.path}#{params_string_for_redirect(params, stop_words: %w[controller action])}",
status: :moved_permanently
end

private

# Load data for a concept or retrieve a concept's children, depending on the value of the :callback parameter.
Expand Down
6 changes: 0 additions & 6 deletions app/controllers/notes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@ def archive
end
end

def show_concept_list
params[:p] = 'classes'
params[:t] = 'notes'
redirect_new_api
end

private

def note_params
Expand Down
12 changes: 0 additions & 12 deletions app/controllers/ontologies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,6 @@ def show
return
end

if params[:ontology].to_i > 0
acronym = BPIDResolver.id_to_acronym(params[:ontology])
if acronym
redirect_new_api
return
end
end

# Note: find_by_acronym includes ontology views
@ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology], include: 'all').first
not_found if @ontology.nil? || (@ontology.errors && [401, 403, 404].include?(@ontology.status))
Expand Down Expand Up @@ -361,10 +353,6 @@ def update
end
end

def virtual
redirect_new_api
end

def widgets
if request.xhr?
render :partial => 'widgets', :layout => false
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/search_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ def check_params_ontologies(params)
else
params[:ontologies] = [params[:ontologies]]
end
if params[:ontologies].first.to_i > 0
params[:ontologies].map! {|o| BPIDResolver.id_to_acronym(o)}
end
params[:ontologies] = params[:ontologies].join(",")
end
end
Expand Down
6 changes: 0 additions & 6 deletions app/models/bpid_resolver.rb

This file was deleted.

1 change: 0 additions & 1 deletion config/initializers/zeitwerk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Rails.autoloaders.each do |autoloader|
autoloader.inflector = Zeitwerk::Inflector.new
autoloader.inflector.inflect(
'bpid_resolver' => 'BPIDResolver',
'kgcl' => 'KGCL'
)
end
2 changes: 0 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
get '/robots.txt' => 'robots#index'

# Ontologies
get '/ontologies/virtual/:ontology' => 'ontologies#virtual', :as => :ontology_virtual
get '/ontologies/success/:id' => 'ontologies#submit_success'
match '/ontologies/:acronym' => 'ontologies#update', via: [:get, :post]
match '/ontologies/:acronym/submissions/:id' => 'submissions#update', via: [:get, :post]
Expand Down Expand Up @@ -93,7 +92,6 @@
get '/ajax/json_class' => 'ajax_proxy#json_class'
get '/ajax/loading_spinner' => 'ajax_proxy#loading_spinner'
get '/ajax/notes/delete' => 'notes#destroy'
get '/ajax/notes/concept_list' => 'notes#show_concept_list'
get '/ajax/classes/label' => 'concepts#show_label'
get '/ajax/classes/definition' => 'concepts#show_definition'
get '/ajax/classes/treeview' => 'concepts#show_tree'
Expand Down

0 comments on commit e055ea0

Please sign in to comment.