Skip to content

Commit

Permalink
Merge branch 'main' into stage-dl-viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
sourcefilter authored Oct 3, 2024
2 parents 8cb52e8 + 16736bf commit 11f5b2d
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 92 deletions.
1 change: 1 addition & 0 deletions app/assets/stylesheets/base/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@import 'templates/static-page';
@import 'templates/item-page';
@import 'templates/collection-page';
@import 'templates/error-page';
@import 'templates/index-page';
@import 'templates/homepage';
@import 'components/banner/collection-banner';
Expand Down
36 changes: 36 additions & 0 deletions app/assets/stylesheets/base/templates/_error-page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.content-container--error-page {
margin: 0 auto;
max-width: 832px;

.error-page__title-row {
margin-bottom: 48px;
color: $ucla-darkest-blue;

h1 {
font-size: 52px;
font-weight: 700;
line-height: 62px;
text-align: center;
}

h4 {
font-size: 24px;
line-height: 36px;
}
}

ul {
margin-left: 40px;

li {
margin-bottom: 10px;

a {
font-size: 16px;
line-height: 24px;
text-decoration: underline;
color: #000;
}
}
}
}
3 changes: 2 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ def cors_preflight_check
protect_from_forgery with: :exception

rescue_from Blacklight::AccessControls::AccessDenied, with: :render_404
rescue_from Blacklight::Exceptions::RecordNotFound, with: :render_404

def render_404
render file: Rails.root.join('public', '404.html'), status: :not_found, layout: false
render 'errors/not_found'
end

def solr_document_path(*args)
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/errors_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true
class ErrorsController < ApplicationController
def not_found; end
end
3 changes: 2 additions & 1 deletion app/views/catalog/_browse_results.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<% else %>
<div class='search-count-wrapper'>
<h2 class='search-count__heading'>
<span class="search-count__results-found"><%= @response['response'].dig(:numFound) %></span> <span class="search-count__catalog-results">Catalog Results</span>
<span class="search-count__results-found"><%= number_with_delimiter @response['response'].dig(:numFound) %></span>
<span class="search-count__catalog-results">Catalog Results</span>
</h2>
<%= render_results_collection_tools wrapping_class: "search-widgets search-widgets-wrapper search-widgets-wrapper--sinai" %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1 class='banner__title--collection'><%= document[:title_tesim][0] %></h1>
<div class='banner__collection-detail'>
<% if collection_count %>
<div class='banner__collection-count' itemprop="collectionSize"><%= collection_count %> items</div>
<div class='banner__collection-count' itemprop="collectionSize"><%= number_with_delimiter collection_count %> items</div>
<% end %>
<%= link_to 'Browse items in this collection', "/catalog?f%5Bmember_of_collections_ssim%5D%5B%5D=#{CGI.escape(document[:title_tesim][0])}", class: 'btn-base btn-outline-ursus--gold ur-link--gold banner__overlay-btn-text' %>
</div>
Expand Down
20 changes: 20 additions & 0 deletions app/views/errors/not_found.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="content-container--error-page">
<div class="error-page__title-row">
<h1 class="error-page__title">Page not found.</h1>
</div>

<div class="error-page__title-row">
<h4>
We can’t find the page you are looking for, but we're here to help. Try
these regularly visited links.
</h4>
</div>

<ul>
<li><a href="https://digital.library.ucla.edu/">UCLA Library Digital Collections Home</a></li>
<li><a href="https://www.library.ucla.edu/">UCLA Library Home</a></li>
<li><a href="https://www.library.ucla.edu/help/research-help/">Research Help</a></li>
<li><a href="https://www.library.ucla.edu/help/services-resources/ask-us/">Ask a Librarian</a></li>
<li><a href="https://www.ucla.edu/accessibility/">Accessibility Resources</a></li>
</ul>
</div>
6 changes: 6 additions & 0 deletions app/views/layouts/blacklight/base.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','<%= ENV["GOOGLE_TAG_MGR_ID"] %>');</script>
<% end %>

<% if ENV["RAILS_HOST"] && ENV["RAILS_HOST"].include?("stage") %>
<script defer src="https://test-librarystudy.library.ucla.edu/gsurvey.js"></script>
<% end $>
<% if ENV["RAILS_HOST"] && (ENV["RAILS_HOST"].include?("stage") || ENV["RAILS_HOST"].include?("test") || ENV["RAILS_HOST"].include?("dev") || ENV["RAILS_HOST"].include?("localhost")) %>
<script defer src="https://test-librarystudy.library.ucla.edu/gsurvey.js"></script>
<% else %>
<script defer src="https://librarystudy.library.ucla.edu/gsurvey.js"></script>
<% end %>
<title><%= render_page_title %></title>

Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/header/_header_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= render 'shared/header/alert-bar' %>
<%#= render 'shared/header/alert-bar' %>
<div class="container-full container-full--navbar site-navbar site-navbar--ursus">
<nav class="navbar navbar-expand-lg navbar-dark site-navbar__wrapper site-navbar__wrapper--ursus" role="navigation">
<div class="site-navbar__logo-block">
Expand Down
2 changes: 1 addition & 1 deletion app/views_legacy/catalog/_paginate_compact.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<%= render :partial => "paginate_compact", :object => @response-%>

<h4><b><%= @response['response'].dig(:numFound) %></b> Catalog Results</h4>
<h4><b><%= number_with_delimiter @response['response'].dig(:numFound) %></b> Catalog Results</h4>
<%= paginate paginate_compact, :page_entries_info => page_entries_info(paginate_compact), :theme => :blacklight_compact %>
4 changes: 2 additions & 2 deletions config/locales/blacklight.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ en:
illustrator_tesim: 'Illustrator'
identifier_tesim: 'Identifier'
human_readable_language_tesim: 'Language'
latitude_tesim: 'Longitude'
latitude_tesim: 'Latitude'
local_identifier_ssim: 'Local Identifier'
location_tesim: 'Location'
longitude_tesim: 'Latitude'
longitude_tesim: 'Longitude'
lyricist_tesim: 'Lyricist'
medium_tesim: 'Medium'
named_subject_tesim: 'Names'
Expand Down
82 changes: 0 additions & 82 deletions e2e/cypress/e2e/ursus_search.cy.js

This file was deleted.

11 changes: 9 additions & 2 deletions spec/controllers/catalog_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,16 @@
context 'when the URL contains the ID of a hyrax object without an ark (e.g. a permissions object)' do
let(:solr_document) { SolrDocument.new(id: 'cba-321') }

it 'raises an exception' do
before do
allow(SolrDocument).to receive(:find).and_call_original
expect { get('/catalog/cba-321') } .to raise_exception(Blacklight::Exceptions::RecordNotFound)
end

it 'catches not_found and renders errors/not_found' do
expect(get('/catalog/cba-321')).to render_template('errors/not_found')
end

it 'raises an exception' do
expect { get('/catalog/cba-321') }.not_to raise_exception(Blacklight::Exceptions::RecordNotFound)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/system/view_unauthorized_work_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@

it 'denies access' do
visit "/catalog/#{ark}"
expect(page).to have_content 'The page you were looking for doesn\'t exist'
expect(page).to have_content 'Page not found'
end
end

0 comments on commit 11f5b2d

Please sign in to comment.