-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* include searchtips modal * moving view component test support to rails helper, using blacklight icon for info button, styling * refactoring based on upstream spotlight refactoring, putting components in top level directory * fixing rubocop errors * updated spotlight release * updates to placement of component * update to new spotlight version * updating exhibitnavbar component configuration in catalog controller * removing blacklight icon style
- Loading branch information
Showing
15 changed files
with
132 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module Blacklight | ||
module Icons | ||
# Icon for outline info button | ||
class OutlineInfoComponent < Spotlight::IconComponent | ||
self.svg = <<~SVG | ||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16"> | ||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/> | ||
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/> | ||
</svg> | ||
SVG | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
# Overrides Spotlight ExhibitNavbarComponent and provides Search Tips link | ||
class ExhibitNavbarComponent < Spotlight::ExhibitNavbarComponent | ||
def prepend_to_search_bar | ||
render SearchTipsLinkComponent.new | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<%= render Blacklight::System::ModalComponent.new do |component| %> | ||
<% component.with_title do %> | ||
<div><h2 class="modal-title"> <%= t('search_tips.title') %> </h2></div> | ||
<div><h3> <%= t('search_tips.subtitle') %> </h3></div> | ||
<% end %> | ||
<% component.with_body do %> | ||
<ul class="mt-3 pr-4 pb-2"> | ||
<li> Use quotation marks to search as a <span class="font-weight-bold">phrase</span>. (Word-stemming will still be applied to words within the phrase.) </li> | ||
<li> Use "+" (no space) before a word to make it <span class="font-weight-bold">required</span>. </li> | ||
<li> Use "-" (no space) before a word or phrase to <span class="font-weight-bold">exclude</span>. </li> | ||
<li> Use "OR", "AND", and "NOT" (uppercase) to create <span class="font-weight-bold">Boolean</span> logic within a field. You can use parentheses in your complex expressions. </li> | ||
<li> Use "*" to search a <span class="font-weight-bold">truncated</span> term. (Word-stemming is done automatically.) </li> | ||
<li> Use "?" as a <span class="font-weight-bold">wildcard</span> to replace a character in a word. </li> | ||
<li> <span class="font-weight-bold">Word-stemming</span> automatically includes plural and singular forms, and common suffix and tense variations. </li> | ||
</ul> | ||
<% end %> | ||
<% component.with_footer do %> | ||
<button type="button" class="btn btn-outline-primary" data-bs-dismiss="modal" data-dismiss="modal"> | ||
<span aria-hidden="true" class="visually-hidden"><%= t('search_tips.close') %> </span> | ||
</button> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class SearchTipsComponent < ViewComponent::Base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class="navbar-nav searchtips-link"> | ||
<a class="nav-link" data-blacklight-modal="trigger" href="/search_tips"> | ||
<%= blacklight_icon('outline_info', classes: 'mr-1 pt-0 d-inline-block') %><%= t('search_tips.title') %></a> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class SearchTipsLinkComponent < ViewComponent::Base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= render SearchTipsComponent.new %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe SearchTipsComponent, type: :component do | ||
subject(:rendered) { Capybara::Node::Simple.new(render_inline(described_class.new)) } | ||
|
||
it 'displays a title with a subheading' do | ||
expect(rendered).to have_selector('h2.modal-title'), text: 'Search tips' | ||
expect(rendered).to have_selector('h3'), text: 'Refine your search' | ||
end | ||
|
||
it 'includes search tips text' do | ||
expect(rendered).to have_selector('ul.mt-3 li', count: 7) | ||
expect(rendered).to have_content('Use quotation marks to search') | ||
end | ||
|
||
it 'includes a close button' do | ||
expect(rendered).to have_selector('button.btn-outline-primary span'), text: 'Close' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe SearchTipsLinkComponent, type: :component do | ||
subject(:rendered) { Capybara::Node::Simple.new(render_inline(described_class.new)) } | ||
|
||
it 'displays seearch tips links' do | ||
expect(rendered).to have_link('Search tips'), href: '/search_tips' | ||
end | ||
|
||
it 'displays info icon' do | ||
expect(rendered).to have_selector('div.searchtips-link span svg.bi-info-circle') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters