Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
# - name: Lint
# run: bundle exec rubocop
- name: Lint
run: bundle exec rubocop
- name: Run tests
run: |
cp config/vars.yml.example config/vars.yml
Expand Down
17 changes: 17 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
AllCops:
Exclude:
- 'db/**/*'
- 'bin/*'
- 'config/**/*'
- 'vendor/**/*'

Style/Documentation:
Enabled: false

Metrics/MethodLength:
Enabled: false

Layout/LineLength:
Enabled: false


2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ group :development, :test do
gem 'geckodriver-helper'
gem 'puma'
gem 'rspec-rails'
gem 'rubocop', require: false
gem 'rubocop-rspec', require: false
gem 'selenium-webdriver'
gem 'simplecov'
gem 'spring'
Expand Down
23 changes: 23 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ GEM
archive-zip (0.12.0)
io-like (~> 0.3.0)
arel (9.0.0)
ast (2.4.2)
autoprefixer-rails (9.8.6.4)
execjs
bcrypt (3.1.16)
Expand Down Expand Up @@ -270,9 +271,14 @@ GEM
oauth2 (~> 1.0)
omniauth (~> 1.2)
orm_adapter (0.5.0)
parallel (1.23.0)
parser (3.2.2.3)
ast (~> 2.4.1)
racc
public_suffix (4.0.6)
puma (5.0.0)
nio4r (~> 2.0)
racc (1.7.1)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
Expand Down Expand Up @@ -330,6 +336,20 @@ GEM
rspec-mocks (~> 3.9)
rspec-support (~> 3.9)
rspec-support (3.9.3)
rubocop (0.92.0)
parallel (~> 1.10)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.5.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-rspec (1.44.1)
rubocop (~> 0.87)
rubocop-ast (>= 0.7.1)
ruby-progressbar (1.10.1)
rubyzip (2.3.2)
sanitize (5.2.1)
Expand Down Expand Up @@ -384,6 +404,7 @@ GEM
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.8.0)
warden (1.2.9)
rack (>= 2.0.9)
web-console (3.7.0)
Expand Down Expand Up @@ -422,6 +443,8 @@ DEPENDENCIES
rainbow
rsolr
rspec-rails
rubocop
rubocop-rspec
sass-rails
sdoc
selenium-webdriver
Expand Down
8 changes: 5 additions & 3 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base
# Adds a few additional behaviors into the application controller
include Blacklight::Controller
Expand All @@ -9,7 +11,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery with: :exception

# Alias new_session_path as login_path for default devise config
def new_session_path(scope)
def new_session_path(_scope)
login_path
end

Expand All @@ -20,7 +22,7 @@ def after_sign_in_path_for(resource)
def current_user_dev
@current_user ||= User.find_by_username('admin') || User.new
end
alias_method :current_user, :current_user_dev if Rails.env.development?
alias current_user current_user_dev if Rails.env.development?

# After signing out from the local application,
# redirect to the logout path for the Login app
Expand All @@ -33,7 +35,7 @@ def after_sign_out_path_for(resource_or_scope)
end

def logout_path
"https://login.library.nyu.edu/logout"
'https://login.library.nyu.edu/logout'
end
private :logout_path
end
51 changes: 22 additions & 29 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- encoding : utf-8 -*-
# frozen_string_literal: true

require 'blacklight/catalog'

class CatalogController < ApplicationController

# include BlacklightRangeLimit::ControllerOverride

include Blacklight::Catalog
Expand All @@ -11,17 +11,17 @@ class CatalogController < ApplicationController
configure_blacklight do |config|
## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
config.default_solr_params = {
:start => 0,
:rows => 10,
'q.alt' => '*:*'
:start => 0,
:rows => 10,
'q.alt' => '*:*'
}

## Default parameters to send on single-document requests to Solr. These settings are the Blackligt defaults (see SolrHelper#solr_doc_params) or
## parameters included in the Blacklight-jetty document requestHandler.
#
config.default_document_solr_params = {
:qt => 'document',
:q => '{!raw f=layer_slug_s v=$id}'
qt: 'document',
q: '{!raw f=layer_slug_s v=$id}'
}

config.index.document_presenter_class = Geoblacklight::DocumentPresenter
Expand Down Expand Up @@ -71,19 +71,19 @@ class CatalogController < ApplicationController
# :years_25 => { :label => 'within 25 Years', :fq => "pub_date:[#{Time.now.year - 25 } TO *]" }
# }

config.add_facet_field Settings.FIELDS.PROVENANCE, label: 'Institution', limit: 8, partial: "icon_facet"
config.add_facet_field Settings.FIELDS.CREATOR, :label => 'Author', :limit => 8
config.add_facet_field Settings.FIELDS.PUBLISHER, :label => 'Publisher', :limit => 8
config.add_facet_field Settings.FIELDS.SUBJECT, :label => 'Subject', :limit => 8
config.add_facet_field Settings.FIELDS.SPATIAL_COVERAGE, :label => 'Place', :limit => 8
config.add_facet_field Settings.FIELDS.PART_OF, :label => 'Collection', :limit => 8
config.add_facet_field Settings.FIELDS.SOURCE, :label => 'Source Dataset', :limit => 0
config.add_facet_field Settings.FIELDS.PROVENANCE, label: 'Institution', limit: 8, partial: 'icon_facet'
config.add_facet_field Settings.FIELDS.CREATOR, label: 'Author', limit: 8
config.add_facet_field Settings.FIELDS.PUBLISHER, label: 'Publisher', limit: 8
config.add_facet_field Settings.FIELDS.SUBJECT, label: 'Subject', limit: 8
config.add_facet_field Settings.FIELDS.SPATIAL_COVERAGE, label: 'Place', limit: 8
config.add_facet_field Settings.FIELDS.PART_OF, label: 'Collection', limit: 8
config.add_facet_field Settings.FIELDS.SOURCE, label: 'Source Dataset', limit: 0

config.add_facet_field Settings.FIELDS.YEAR, :label => 'Year', :limit => 10
config.add_facet_field Settings.FIELDS.YEAR, label: 'Year', limit: 10

config.add_facet_field Settings.FIELDS.RIGHTS, label: 'Access', limit: 8, partial: "icon_facet"
config.add_facet_field Settings.FIELDS.GEOM_TYPE, label: 'Data type', limit: 8, partial: "icon_facet"
config.add_facet_field Settings.FIELDS.FILE_FORMAT, :label => 'Format', :limit => 8
config.add_facet_field Settings.FIELDS.RIGHTS, label: 'Access', limit: 8, partial: 'icon_facet'
config.add_facet_field Settings.FIELDS.GEOM_TYPE, label: 'Data type', limit: 8, partial: 'icon_facet'
config.add_facet_field Settings.FIELDS.FILE_FORMAT, label: 'Format', limit: 8

# Have BL send all facet field names to Solr, which has been the default
# previously. Simply remove these lines if you'd rather use Solr request
Expand Down Expand Up @@ -112,8 +112,6 @@ class CatalogController < ApplicationController
config.add_index_field Settings.FIELDS.DESCRIPTION, helper_method: :snippit
config.add_index_field Settings.FIELDS.PUBLISHER



# solr fields to be displayed in the show (single result) view
# The ordering of the field names is the order of the display
#
Expand Down Expand Up @@ -202,10 +200,10 @@ class CatalogController < ApplicationController
# label in pulldown is followed by the name of the SOLR field to sort by and
# whether the sort is ascending or descending (it must be asc or desc
# except in the relevancy case).
config.add_sort_field 'score desc, dc_title_sort asc', :label => 'relevance'
config.add_sort_field "#{Settings.FIELDS.YEAR} desc, dc_title_sort asc", :label => 'year'
config.add_sort_field "#{Settings.FIELDS.PUBLISHER} asc, dc_title_sort asc", :label => 'publisher'
config.add_sort_field 'dc_title_sort asc', :label => 'title'
config.add_sort_field 'score desc, dc_title_sort asc', label: 'relevance'
config.add_sort_field "#{Settings.FIELDS.YEAR} desc, dc_title_sort asc", label: 'year'
config.add_sort_field "#{Settings.FIELDS.PUBLISHER} asc, dc_title_sort asc", label: 'publisher'
config.add_sort_field 'dc_title_sort asc', label: 'title'

# If there are more than this many search results, no spelling ("did you
# mean") suggestion is offered.
Expand All @@ -225,13 +223,8 @@ class CatalogController < ApplicationController

config.basemap_provider = 'positron'


# Configuration for autocomplete suggestor
config.autocomplete_enabled = true
config.autocomplete_path = 'suggest'

end



end
9 changes: 4 additions & 5 deletions app/controllers/concerns/nyu_slug_concern.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# frozen_string_literal: true

module NyuSlugConcern
extend Blacklight::Catalog

# Override of main show method to catch old-style
# NYU slugs ("nyu_2451_12345") and turn them into
# new style ("nyu-2451-12345")
def show
if /^nyu_\d{4}_\d{5}$/.match(params[:id])
params[:id] = params[:id].gsub("_","-")
end
params[:id] = params[:id].gsub('_', '-') if /^nyu_\d{4}_\d{5}$/.match(params[:id])
@response, @document = fetch params[:id]
respond_to do |format|
format.html { setup_next_and_previous_documents }
format.json { render json: { response: { document: @document } } }
additional_export_formats(@document, format)
end
end

end
end
Loading