Skip to content

Commit

Permalink
removes author and subject feature gates
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Sep 11, 2023
1 parent 5889526 commit a74c268
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 32 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,3 @@ If you are working on features, set up a gate so that the feature can be turned
In this project we create an environment variable for the feature. If it is true the feature is enabled. If it is false then it is turned off.

Current Features:
* `AUTHOR_ON='true'` for enabling Browse By Author
* `SUBJECT_ON='true'` for enabling Browse By Subject
41 changes: 19 additions & 22 deletions catalog-browse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,28 @@
config.solr_url = ENV.fetch("BIBLIO_SOLR")
end

if ENV.fetch("SUBJECT_ON") == "true"
get "/subject" do
subject = StringCleaner.clean_browse_string(params[:query])
reference_id = params[:reference_id] || subject
begin
list = SubjectList.for(direction: params[:direction], reference_id: reference_id, num_rows_to_display: 20, original_reference: subject, banner_reference: params[:banner_reference])
rescue => e
logger.error(e.message)
list = SubjectList::Error.new(reference_id)
end
erb :subject, locals: {list: list}
get "/subject" do
subject = StringCleaner.clean_browse_string(params[:query])
reference_id = params[:reference_id] || subject
begin
list = SubjectList.for(direction: params[:direction], reference_id: reference_id, num_rows_to_display: 20, original_reference: subject, banner_reference: params[:banner_reference])
rescue => e
logger.error(e.message)
list = SubjectList::Error.new(reference_id)
end
erb :subject, locals: {list: list}
end
if ENV.fetch("AUTHOR_ON") == "true"
get "/author" do
author = StringCleaner.clean_browse_string(params[:query])
reference_id = params[:reference_id] || author
begin
list = AuthorList.for(direction: params[:direction], reference_id: reference_id, num_rows_to_display: 20, original_reference: author, banner_reference: params[:banner_reference])
rescue => e
logger.error(e.message)
list = AuthorList::Error.new(reference_id)
end
erb :authors, locals: {list: list}

get "/author" do
author = StringCleaner.clean_browse_string(params[:query])
reference_id = params[:reference_id] || author
begin
list = AuthorList.for(direction: params[:direction], reference_id: reference_id, num_rows_to_display: 20, original_reference: author, banner_reference: params[:banner_reference])
rescue => e
logger.error(e.message)
list = AuthorList::Error.new(reference_id)
end
erb :authors, locals: {list: list}
end
get "/callnumber" do
callnumber = params[:query]
Expand Down
2 changes: 0 additions & 2 deletions env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ BIBLIO_SOLR='http://biblio-server/solr'
CATALOG_SOLR='http://catalog-solr-server/solr'
CALLNUMBERS_CORE='callnumbers'
AUTHORS_CORE='authors'
AUTHOR_ON='true'
SUBJECT_ON='true'
6 changes: 0 additions & 6 deletions views/layout/search_box.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<%
fields = YAML.load_file("./config/search_dropdown.yml")
active_browse_option = 'browse_by_' + request.path_info[1..-1]
if ENV.fetch("SUBJECT_ON") == "false"
browse_by = fields.find{|x| x[:label] == "Browse by [BETA]"}
browse_by_subject = browse_by[:options].find{|x| x[:label] == "Browse by subject"}
browse_by_subject[:label] = "Browse by subject (coming soon)"
browse_by_subject[:disabled] = "disabled"
end
%>

<form class="search-box" role="search" method="post" action="<%= ENV.fetch('BASE_URL') %>/search">
Expand Down

0 comments on commit a74c268

Please sign in to comment.