Skip to content

Commit

Permalink
Merge branch 'main' into searchtips
Browse files Browse the repository at this point in the history
  • Loading branch information
hudajkhan authored Oct 2, 2024
2 parents 6bd6358 + 7d2bebd commit 2976d5f
Show file tree
Hide file tree
Showing 22 changed files with 224 additions and 192 deletions.
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ end
group :development, :test do
gem 'solr_wrapper'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.7'
gem 'sqlite3', '~> 2.0'

# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem 'debug', platforms: %i(mri mingw x64_mingw)
Expand Down Expand Up @@ -132,7 +132,6 @@ gem 'acts-as-taggable-on'
gem 'mods_display', '~> 1.6'
gem 'slack-ruby-client'
gem 'blacklight-oembed', '~> 1.0'
gem 'view_component', '~> 2.82' # ViewComponent 3.x breaks blacklight_range_limit 8.3.0

# Used for shared reporting https://github.com/sul-dlss/exhibits/issues/2069
gem 'redis', '~> 5.0'
Expand Down
83 changes: 65 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,17 @@ GEM
racc (~> 1.7)
bigdecimal (3.1.8)
bindex (0.8.1)
blacklight (7.38.0)
blacklight (7.39.0)
deprecation
globalid
hashdiff
i18n (>= 1.7.0)
jbuilder (~> 2.7)
kaminari (>= 0.15)
ostruct (>= 0.3.2)
rails (>= 5.1, < 7.3)
rails (>= 6.1, < 7.3)
view_component (>= 2.66, < 4)
zeitwerk
blacklight-gallery (4.6.0)
blacklight (>= 7.17, < 9)
rails (>= 6.1, < 8)
Expand All @@ -121,7 +122,7 @@ GEM
blacklight (>= 7.25, < 9)
rails
ruby-oembed
blacklight-spotlight (4.1.0)
blacklight-spotlight (4.1.2)
activejob-status
acts-as-taggable-on (>= 5.0, < 12)
autoprefixer-rails
Expand Down Expand Up @@ -315,9 +316,16 @@ GEM
net-http
faraday-retry (2.2.1)
faraday (~> 2.0)
ffi (1.17.0-aarch64-linux-gnu)
ffi (1.17.0-aarch64-linux-musl)
ffi (1.17.0-arm-linux-gnu)
ffi (1.17.0-arm-linux-musl)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86-linux-gnu)
ffi (1.17.0-x86-linux-musl)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
ffi (1.17.0-x86_64-linux-musl)
ffi-compiler (1.3.2)
ffi (>= 1.15.5)
rake
Expand Down Expand Up @@ -351,9 +359,18 @@ GEM
google-cloud-env (2.2.0)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.4.0)
google-protobuf (4.28.2)
bigdecimal
rake (>= 13)
google-protobuf (4.28.2-aarch64-linux)
bigdecimal
rake (>= 13)
google-protobuf (4.28.2-arm64-darwin)
bigdecimal
rake (>= 13)
google-protobuf (4.28.2-x86-linux)
bigdecimal
rake (>= 13)
google-protobuf (4.28.2-x86_64-darwin)
bigdecimal
rake (>= 13)
Expand All @@ -373,9 +390,18 @@ GEM
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
grpc (1.66.0)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
grpc (1.66.0-aarch64-linux)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
grpc (1.66.0-arm64-darwin)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
grpc (1.66.0-x86-linux)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
grpc (1.66.0-x86_64-darwin)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
Expand Down Expand Up @@ -413,7 +439,7 @@ GEM
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
io-console (0.7.2)
irb (1.14.0)
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
iso-639 (0.3.6)
Expand Down Expand Up @@ -520,8 +546,14 @@ GEM
net-ssh (7.2.3)
newrelic_rpm (9.13.0)
nio4r (2.7.3)
nokogiri (1.16.7-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.7-arm-linux)
racc (~> 1.4)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86-linux)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
Expand Down Expand Up @@ -640,7 +672,7 @@ GEM
actionpack (>= 5.2)
railties (>= 5.2)
retriable (3.1.2)
rexml (3.3.7)
rexml (3.3.8)
riiif (2.6.0)
deprecation (>= 1.0.0)
iiif-image-api (>= 0.1.0)
Expand Down Expand Up @@ -758,9 +790,11 @@ GEM
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
solr_wrapper (4.0.2)
http
solr_wrapper (4.1.0)
faraday
faraday-follow_redirects
minitar
ostruct
retriable
ruby-progressbar
sprockets (4.2.1)
Expand All @@ -770,9 +804,16 @@ GEM
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
sqlite3 (1.7.3-arm64-darwin)
sqlite3 (1.7.3-x86_64-darwin)
sqlite3 (1.7.3-x86_64-linux)
sqlite3 (2.1.0-aarch64-linux-gnu)
sqlite3 (2.1.0-aarch64-linux-musl)
sqlite3 (2.1.0-arm-linux-gnu)
sqlite3 (2.1.0-arm-linux-musl)
sqlite3 (2.1.0-arm64-darwin)
sqlite3 (2.1.0-x86-linux-gnu)
sqlite3 (2.1.0-x86-linux-musl)
sqlite3 (2.1.0-x86_64-darwin)
sqlite3 (2.1.0-x86_64-linux-gnu)
sqlite3 (2.1.0-x86_64-linux-musl)
sshkit (1.23.1)
base64
net-scp (>= 1.1.2)
Expand Down Expand Up @@ -821,7 +862,7 @@ GEM
uri (0.13.1)
useragent (0.16.10)
version_gem (1.1.4)
view_component (2.83.0)
view_component (3.15.0)
activesupport (>= 5.2.0, < 8.0)
concurrent-ruby (~> 1.0)
method_source (~> 1.0)
Expand All @@ -847,13 +888,20 @@ GEM
zeitwerk (2.6.18)

PLATFORMS
arm64-darwin-21
aarch64-linux
aarch64-linux-gnu
aarch64-linux-musl
arm-linux
arm-linux-gnu
arm-linux-musl
arm64-darwin-23
x86_64-darwin-19
x86_64-darwin-20
x86_64-darwin-21
x86_64-darwin-22
x86-linux
x86-linux-gnu
x86-linux-musl
x86_64-darwin
x86_64-linux
x86_64-linux-gnu
x86_64-linux-musl

DEPENDENCIES
acts-as-taggable-on
Expand Down Expand Up @@ -931,14 +979,13 @@ DEPENDENCIES
slowpoke
solr_wrapper
sprockets-rails
sqlite3 (~> 1.7)
sqlite3 (~> 2.0)
stanford-mods (~> 3.0)
sul_styles
traject
turbolinks (~> 5)
twitter-typeahead-rails (= 0.11.1.pre.corejavascript)
tzinfo-data
view_component (~> 2.82)
web-console (>= 4.1.0)
webmock

Expand Down
64 changes: 64 additions & 0 deletions app/components/site_navbar_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<div id="site-navbar" class="site-navbar navbar navbar-light navbar-expand-md" role="navigation" aria-label="<%= t('spotlight.exhibitnavbar.label') %>">
<div class="container flex-column flex-md-row">
<ul class="site-search-nav navbar-nav mr-auto mr-md-3 mr-lg-auto w-100 order-1 order-md-0 mt-3 mt-md-0">
<li class="navbar-item d-flex flex-grow-1">
<% if Settings.feature_flags.search_across || in_search_across? %>
<%= render SiteSearchFormComponent.new(url: helpers.search_action_url, params: helpers.search_state.params_for_search.except(:qt)) %>
<% end %>
</li>
</ul>

<ul class="navbar-nav align-self-start order-0 order-md-1">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
About
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
<%= link_to "How does Stanford use Spotlight?",
"https://exhibits.stanford.edu/exhibits-documentation/about/how-does-stanford-use-spotlight", class: 'dropdown-item' %>
<%= link_to "Exhibit documentation & marketing",
"https://exhibits.stanford.edu/exhibits-documentation", class: 'dropdown-item' %>
<%= link_to "https://consul.stanford.edu/x/g4A-CQ", class: 'dropdown-item' do %>
Request an exhibit <%= image_tag("stanford_s.png", class: "stanford-only", alt: "Stanford only") %>
<% end %>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="d-md-none d-lg-inline">More</span> at Stanford
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
<%= link_to "Explore library collections at Stanford",
"https://library.stanford.edu/explore-collections", class: 'dropdown-item' %>
<%= link_to "Special Collections & University Archives",
"https://library.stanford.edu/libraries/special-collections", class: 'dropdown-item' %>
<%= link_to "Support the Stanford Libraries",
"https://library.stanford.edu/support-stanford-libraries", class: 'dropdown-item' %>
</div>
</li>
<% if helpers.can?([:create, :manage], Spotlight::Exhibit) || helpers.can?(:manage, Spotlight::Site.instance) %>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Admin
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
<% if helpers.can?(:create, Spotlight::Exhibit) %>
<%= link_to "Create a new exhibit", helpers.spotlight.new_exhibit_path, class: 'dropdown-item' %>
<% end %>
<%= link_to t('.documentation'), 'https://github.com/sul-dlss/spotlight/wiki/Configuration-settings', class: 'dropdown-item' %>
<% if helpers.can? :manage, Spotlight::Site.instance %>
<%= link_to t(:'spotlight.sites.edit.page_title'), helpers.spotlight.edit_site_path, class: 'dropdown-item' %>
<% end %>
<% if helpers.can? :manage, Spotlight::Exhibit %>
<%= link_to t(:'spotlight.sites.edit_exhibits.page_title'), helpers.spotlight.edit_site_exhibits_path, class: 'dropdown-item' %>
<%= link_to t(:'spotlight.admin_users.index.page_title'), helpers.spotlight.admin_users_path, class: 'dropdown-item' %>
<% end %>
</div>
</li>
<% end %>
</ul>
</div>
</div>
5 changes: 5 additions & 0 deletions app/components/site_navbar_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

# Builds the site navbar
class SiteNavbarComponent < ViewComponent::Base
end
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<%= form_tag search_action_url, method: :get, class: 'd-flex flex-grow-1 search-across-form search-query-form', role: 'search', 'aria-label' => t('blacklight.search.form.submit') do %>
<%= render Blacklight::HiddenSearchStateComponent.new(params: search_state.params_for_search.except(:q, :search_field, :qt, :page, :utf8)) %>
<%= form_tag @url, method: :get, class: 'd-flex flex-grow-1 search-across-form search-query-form', role: 'search', 'aria-label' => t('blacklight.search.form.submit') do %>
<%= render Blacklight::HiddenSearchStateComponent.new(params: helpers.search_state.params_for_search.except(:q, :search_field, :qt, :page, :utf8)) %>
<% if search_fields.length > 1 %>
<label for="search_field" class="sr-only"><%= t('blacklight.search.form.search_field.label') %></label>
<% end %>

<div class="input-group">
<div class="dropdown input-group-prepend" data-behavior="site-search-type-toggle" data-enabled="<%= in_search_across? ? '#item-search' : '#exhibit-search' %>" style="display: none">
<div class="dropdown input-group-prepend" data-behavior="site-search-type-toggle" data-enabled="<%= helpers.in_search_across? ? '#item-search' : '#exhibit-search' %>" style="display: none">
<button type="button" class="btn btn-outline-secondary dropdown-toggle" id="site-search-type" data-toggle="dropdown" aria-expanded="false">
<% if in_search_across? %>
<%= t('.find_all_items') %>
<% if helpers.in_search_across? %>
<%= t('site_search_form.find_all_items') %>
<% else %>
<%= t('.find_exhibits_by_title') %>
<%= t('site_search_form.find_exhibits_by_title') %>
<% end %>
</button>

<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-target="#exhibit-search" data-button-text="<%= t('.find_exhibits_by_title') %>">
<%= t('.exhibits_by_title') %>
<a class="dropdown-item" href="#" data-target="#exhibit-search" data-button-text="<%= t('site_search_form.find_exhibits_by_title') %>">
<%= t('site_search_form.exhibits_by_title') %>
</a>
<a class="dropdown-item" href="#" data-target="#item-search" data-button-text="<%= t('.find_all_items') %>">
<%= t('.all_items') %>
<a class="dropdown-item" href="#" data-target="#item-search" data-button-text="<%= t('site_search_form.find_all_items') %>">
<%= t('site_search_form.all_items') %>
</a>
</div>
</div>
Expand All @@ -34,7 +34,7 @@
<noscript>
<label for="q" class="sr-only"><%= t('blacklight.search.form.search.label') %></label>
</noscript>
<%= text_field_tag :q, params[:q], class: "search-q q form-control", id: "q", 'aria-labelledby': "site-search-type", autofocus: presenter.autofocus?, data: { autocomplete_enabled: presenter.autocomplete_enabled?, autocomplete_path: search_action_path(action: :suggest) } %>
<%= text_field_tag :q, params[:q], class: "search-q q form-control", id: "q", 'aria-labelledby': "site-search-type", autofocus: autofocus, data: { autocomplete_enabled: autocomplete_path.present?, autocomplete_path: autocomplete_path } %>

<span class="input-group-append">
<button type="submit" class="btn btn-primary search-btn" id="search">
Expand Down
5 changes: 5 additions & 0 deletions app/components/site_search_form_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

# Builds the site search form
class SiteSearchFormComponent < Blacklight::SearchBarComponent
end
2 changes: 0 additions & 2 deletions app/models/concerns/exhibit_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ def send_publish_state_change_notification
end

def index_exhibit_metadata
return unless FeatureFlags.new.exhibits_index?

if published?
IndexExhibitMetadataJob.perform_later(exhibit: self, action: 'add')
elsif saved_change_to_published?
Expand Down
6 changes: 3 additions & 3 deletions app/views/layouts/spotlight/base.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
<body class="<%= render_body_class %>">
<div id="su-wrap"> <!-- #su-wrap start -->
<div id="su-content"> <!-- #su-content start -->
<nav id="skip-link" role="navigation" aria-label="<%= t('blacklight.skip_links.label') %>">
<%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
<%= link_to t('blacklight.skip_links.main_content'), '#main-container', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
<nav id="skip-link" role="navigation" class="visually-hidden-focusable sr-only sr-only-focusable" aria-label="<%= t('blacklight.skip_links.label') %>">
<%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: 'd-inline-flex p-2 m-1', data: { turbolinks: 'false' } %>
<%= link_to t('blacklight.skip_links.main_content'), '#main-container', class: 'd-inline-flex p-2 m-1', data: { turbolinks: 'false' } %>
<%= content_for(:skip_links) %>
</nav>

Expand Down
19 changes: 0 additions & 19 deletions app/views/shared/_old_site_search_form.html.erb

This file was deleted.

Loading

0 comments on commit 2976d5f

Please sign in to comment.