Skip to content

Commit

Permalink
AR-1750 don't include repo facet for agents and subjects in a repo co…
Browse files Browse the repository at this point in the history
…ntext
  • Loading branch information
jambun authored and marktriggs committed Jun 19, 2017
1 parent 5d0f4d6 commit fa0ad50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions public-new/app/controllers/agents_controller.rb
Expand Up @@ -5,7 +5,7 @@ class AgentsController < ApplicationController
skip_before_filter :verify_authenticity_token

DEFAULT_AG_TYPES = %w{repository resource archival_object digital_object}
DEFAULT_AG_FACET_TYPES = %w{primary_type subjects used_within_published_repository}
DEFAULT_AG_FACET_TYPES = %w{primary_type subjects}
DEFAULT_AG_SEARCH_OPTS = {
'sort' => 'title_sort asc',
'resolve[]' => ['repository:id', 'resource:id@compact_resource', 'ancestors:id@compact_resource'],
Expand All @@ -29,9 +29,11 @@ def index
search_opts = default_search_opts(DEFAULT_AG_SEARCH_OPTS)
search_opts['fq'] = ["used_within_published_repository:\"/repositories/#{repo_id}\""] if repo_id
@base_search = repo_id ? "/repositories/#{repo_id}/agents?" : '/agents?'
default_facets = DEFAULT_AG_FACET_TYPES
default_facets.push('used_within_published_repository') unless repo_id
page = Integer(params.fetch(:page, "1"))
begin
set_up_and_run_search( DEFAULT_AG_TYPES, DEFAULT_AG_FACET_TYPES, search_opts, params)
set_up_and_run_search( DEFAULT_AG_TYPES, default_facets, search_opts, params)
rescue Exception => error
flash[:error] = error
redirect_back(fallback_location: '/') and return
Expand Down
3 changes: 2 additions & 1 deletion public-new/app/controllers/subjects_controller.rb
Expand Up @@ -26,9 +26,10 @@ def index
search_opts = default_search_opts(DEFAULT_SUBJ_SEARCH_OPTS)
search_opts['fq'] = ["used_within_published_repository:\"/repositories/#{repo_id}\""] if repo_id
@base_search = repo_id ? "/repositories/#{repo_id}/subjects?" : '/subjects?'
default_facets = repo_id ? [] : ['used_within_published_repository']
page = Integer(params.fetch(:page, "1"))
begin
set_up_and_run_search(['subject'],['used_within_published_repository'],search_opts, params)
set_up_and_run_search(['subject'],default_facets,search_opts, params)
rescue Exception => error
flash[:error] = error
redirect_back(fallback_location: '/' ) and return
Expand Down

0 comments on commit fa0ad50

Please sign in to comment.