Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app/assets/stylesheets/partials/_results.scss
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,23 @@
}
}

.no-results.use {
border: 0;
font-size: 1.6rem;
line-height: $lh-xloose;
margin: 0;
max-width: 760px;

a {
@include underlinedLinks;
font-weight: $fw-medium;
}

p:last-child {
margin-bottom: 0;
}
}

// -----------------------------
// Result list and Sidebar - USE
// -----------------------------
Expand Down
22 changes: 22 additions & 0 deletions app/views/search/_no_results.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div class="no-results use">
<h2>No results were found</h2>
<p>Any misspellings in your search terms?</p>

<p>Even if we don't own it, we can often get it for you:</p>
<ul>
<li>Articles: Request via <a href="https://libraries.mit.edu/illiad">ILLiad</a>
<li>Books, physical materials: Search <a href="https://mit.on.worldcat.org/">WorldCat</a> and submit a request.
</ul>

<p>A specialized or advanced search may work better:</p>
<ul>
<li><a href="https://libraries.mit.edu/search-collections">Search our Collections</a>: MIT Libraries catalog
<li><a href="https://libguides.mit.edu/az.php">A-Z Databases</a>: Browse or search for databases.
<li><a href="http://archivesspace.mit.edu/">ArchivesSpace</a>: Archives and manuscripts in our Distinctive Collections.
<li><a href="https://libraries.mit.edu/dspace">DSpace@MIT</a>: MIT theses, articles and other research materials.
<li><a href="https://geodata.libraries.mit.edu/">GeoData</a>: GIS/spatial data available at MIT.
<li><a href="https://libraries.mit.edu/experts">Subject guides</a>: Created by our librarians for targeted research by subject.
</ul>

<p><a href="http://libraries.mit.edu/ask">Ask Us</a> for more help!</p>
</div>
4 changes: 1 addition & 3 deletions app/views/search/results.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@

<div id="results-layout-wrapper">
<main id="results">
<div class="no-results">
<p class="hd-2">No results found for your search</p>
</div>
<%= render partial: "no_results" %>
</main>
</div>

Expand Down
6 changes: 3 additions & 3 deletions test/controllers/search_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def mock_timdex_search_with_hits(total_hits)
# Result list contents state "no results"
assert_select '#results'
assert_select '#results', { count: 1 }
assert_select '#results .no-results p', 'No results found for your search'
assert_select '#results .no-results h2', 'No results were found'

# Filter sidebar is not shown
assert_select '#filters', { count: 0 }
Expand Down Expand Up @@ -927,7 +927,7 @@ def source_filter_count(controller)
get '/results?q=nonexistentterm&tab=primo'
assert_response :success
assert_select '.no-results', count: 1
assert_select '.no-results p', text: /No results found for your search/
assert_select '.no-results h2', text: /No results were found/
refute_select '.primo-continuation'
end

Expand All @@ -952,7 +952,7 @@ def source_filter_count(controller)
get '/results?q=nonexistentterm&tab=timdex'
assert_response :success
assert_select '.no-results', count: 1
assert_select '.no-results p', text: /No results found for your search/
assert_select '.no-results h2', text: /No results were found/
refute_select '.primo-continuation'
end

Expand Down