Skip to content

Commit

Permalink
oh no, rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Constabaris committed Jul 27, 2022
1 parent 71e3077 commit d2b9c24
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
24 changes: 13 additions & 11 deletions lib/blacklight_advanced_search/render_constraints_override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,40 @@ module RenderConstraintsOverride

# copied directly from upstream, deals with TD-1219
# the other `render_constraints_` methods will be handled
# by the base implementation in BL rather than by the
# implementation in the adv_search plugin
# by the base implementation in BL rather than by the
# implementation in the adv_search plugin
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
def render_constraints_query(my_params = params)
if (advanced_query.nil? || advanced_query.keyword_queries.empty?)
return super(my_params)
if advanced_query.nil? || advanced_query.keyword_queries.empty?
super(my_params)
else
content = []
advanced_query.keyword_queries.each_pair do |field, query|
label = blacklight_config.search_fields[field][:label]
content << render_constraint_element(
label, query,
:remove =>
search_action_path(remove_advanced_keyword_query(field, my_params).except(:controller, :action))
remove: search_action_path(remove_advanced_keyword_query(field, my_params).except(:controller, :action))
)
end
if (advanced_query.keyword_op == "OR" &&
advanced_query.keyword_queries.length > 1)
content.unshift content_tag(:span, "Any of:", class: 'operator')
content_tag :span, class: "inclusive_or appliedFilter well" do
if advanced_query.keyword_op == 'OR' &&
advanced_query.keyword_queries.length > 1
content.unshift content_tag(:span, 'Any of:', class: 'operator')
content_tag :span, class: 'inclusive_or appliedFilter well' do
safe_join(content.flatten, "\n")
end
else
safe_join(content.flatten, "\n")
end
end
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength

def remove_advanced_keyword_query(field, my_params = params)
my_params = Blacklight::SearchState.new(my_params, blacklight_config).to_h
my_params.delete(field)
my_params
end

end
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module TrlnArgon
module ViewHelpers
module RenderConstraintsHelperBehavior

include BlacklightAdvancedSearch::RenderConstraintsOverride

# handles a special case only in TRLN
Expand Down

0 comments on commit d2b9c24

Please sign in to comment.