Skip to content

Commit

Permalink
Merge pull request #402 from trln/td-1278-adv-search-edit-facet-select
Browse files Browse the repository at this point in the history
Td 1278 adv search edit facet select
  • Loading branch information
kazymovae authored May 23, 2023
2 parents bb869c5 + 6548091 commit e74478d
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 66 deletions.
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ruby:2.7.5 AS app_bootstrap
ARG RUBY_VERSION=2.7.6
FROM ruby:${RUBY_VERSION} AS app_bootstrap

RUN apt-get update && apt-get install -y nodejs vim tree
RUN apt-get update && apt-get install -y nodejs vim less

FROM app_bootstrap AS builder

Expand All @@ -10,11 +11,9 @@ COPY lib/trln_argon/version.rb /build/lib/trln_argon/version.rb

WORKDIR /build

RUN tree

RUN $(./bundler_config.rb path /gems) && bundle install -j $(nproc)

FROM app_bootstrap
FROM app_bootstrap AS runnable

COPY --from=builder /gems /gems
COPY ./bundler_config.rb .
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.9
2.2.10
55 changes: 0 additions & 55 deletions app/components/blacklight/advanced_search_form_component.html.erb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="col-12 col-md-9">
<select multiple="multiple" name="<%= field_param %>" id="<%= facet_field.key %>" class="form-control custom-select advanced-search-facet-select">
<% facet_field.display_facet.items.each do |item| %>
<option value="<%= item.value %>"><%= display_value(item) %></option>
<option value="<%= item.value %>"<%= selected?(item) %>><%= display_value(item) %></option>
<% end %>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def display_value(facet_item)
"#{facet_value_label(facet_item)}&nbsp;&nbsp;(#{number_with_delimiter facet_item.hits})".html_safe
end

def selected?(item)
' selected="selected"' if params[:f_inclusive]&.fetch(facet_field.key, [])&.include?(item.value)
end

def render?
!!display_facet&.items
end
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

check_bundle() {
bundle check || bundle install -j "$(nproc)"
bundle config set path /gems && bundle check || bundle install -j "$(nproc)"
}

cd /app || exit
Expand Down
7 changes: 4 additions & 3 deletions lib/trln_argon/controller_override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,10 @@ def action_documents
[solr_response, solr_response.documents]
end

# rubocop:disable Style/PredicateName
# rubocop:disable Naming/PredicateName
def has_search_parameters?
%i[q f op seach_field range doc_ids].any? { |p| params[p].present? }
# rubocop:enable Style/PredicateName
# rubocop:enable Naming/PredicateName
end

def query_has_constraints?(localized_params = params)
Expand All @@ -653,11 +653,12 @@ def query_has_constraints?(localized_params = params)
end
end

# rubocop:disable Style/PredicateName
# rubocop:disable Naming/PredicateName
def is_advanced_search?(req_params = params)
(req_params[:search_field] == blacklight_config.advanced_search[:url_key]) ||
req_params[:f_inclusive]
end
# rubocop:enable Naming/PredicateName

def render_ris_action?
doc = @document || (@document_list || []).first
Expand Down

0 comments on commit e74478d

Please sign in to comment.