diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 001b274d..76aa9ffc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,6 @@ jobs: run: bundle exec rubocop - name: Run tests run: | - cp config/vars.yml.example config/vars.yml bundle exec rake db:schema:load bundle exec rake ci - name: Audit gems diff --git a/.rubocop.yml b/.rubocop.yml index b5bd5c48..40087c74 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,9 @@ +require: + - rubocop-rails + - rubocop-performance + - rubocop-rspec + - rubocop-capybara + AllCops: Exclude: - 'db/**/*' @@ -5,6 +11,8 @@ AllCops: - 'config/**/*' - 'vendor/**/*' - 'Vagrantfile' + - 'app/helpers/geoblacklight_helper.rb' + NewCops: enable Style/Documentation: Enabled: false diff --git a/.ruby-version b/.ruby-version index 6a81b4c8..be94e6f5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.8 +3.2.2 diff --git a/.tool-versions b/.tool-versions index dc859079..c93772d9 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -ruby 2.7.8 +ruby 3.2.2 nodejs 18.10.0 diff --git a/Capfile b/Capfile new file mode 100644 index 00000000..a6059d49 --- /dev/null +++ b/Capfile @@ -0,0 +1,38 @@ +# Load DSL and set up stages +require 'capistrano/setup' + +# Include default deployment tasks +require 'capistrano/deploy' + +# Load the SCM plugin appropriate to your project: +# +# require "capistrano/scm/hg" +# install_plugin Capistrano::SCM::Hg +# or +# require "capistrano/scm/svn" +# install_plugin Capistrano::SCM::Svn +# or +require 'capistrano/scm/git' +install_plugin Capistrano::SCM::Git + +# Include tasks from other gems included in your Gemfile +# +# For documentation on these, see for example: +# +# https://github.com/capistrano/rvm +# https://github.com/capistrano/rbenv +# https://github.com/capistrano/chruby +# https://github.com/capistrano/bundler +# https://github.com/capistrano/rails +# https://github.com/capistrano/passenger +# +# require "capistrano/rvm" +require 'capistrano/rbenv' +# require "capistrano/chruby" +require 'capistrano/bundler' +require 'capistrano/rails/assets' +# require 'capistrano/rails/migrations' +# require 'capistrano/passenger' + +# Load custom tasks from `lib/capistrano/tasks` if you have any defined +Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } diff --git a/Gemfile b/Gemfile index da03c2e8..29b381e1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,50 +1,62 @@ -# frozen_string_literal: true - source 'https://rubygems.org' +git_source(:github) { |repo| "https://github.com/#{repo}.git" } + +ruby '3.2.2' -gem 'blacklight' +gem 'blacklight', '~> 7.0' +gem 'bootsnap', require: false +gem 'bootstrap', '~> 4.0' +gem 'capistrano', '~> 3.17' +gem 'capistrano-passenger', '~> 0.2.1' +gem 'capistrano-rails', '~> 1.6' +gem 'capistrano-rbenv', '~> 2.2' gem 'config' gem 'devise' -gem 'geoblacklight', '~> 1.9.0' +gem 'geoblacklight', '~> 4.0' +gem 'importmap-rails' gem 'jbuilder' gem 'jquery-rails' -gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f' gem 'mysql2' -gem 'omniauth' +gem 'omniauth', '1.9.2' gem 'omniauth-oauth2' -gem 'rails' -gem 'rainbow' -gem 'rsolr' -gem 'sass-rails' +gem 'omniauth-rails_csrf_protection' +gem 'puma', '~> 5.0' +gem 'rails', '~> 7.0.6' +gem 'rsolr', '>= 1.0', '< 3' +gem 'sassc-rails', '~> 2.1' gem 'sdoc', group: :doc -gem 'solr_wrapper' -gem 'sqlite3' -gem 'turbolinks' -gem 'twitter-typeahead-rails' -gem 'uglifier' -gem 'whenever' +gem 'sdr_cli', github: 'NYULibraries/sdr-cli' +gem 'sprockets', '< 4.0' +gem 'sprockets-rails' +gem 'stimulus-rails' +gem 'turbo-rails' +gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript' +gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] +gem 'view_component' +gem 'whenever', require: false -# Range limit gem for slider on Solr integer fields (year) -# Currently broken (9/2/2016) -# gem 'blacklight_range_limit' +group :test do + gem 'whenever-test' +end group :development, :test do + gem 'axe-core-rspec' gem 'bundler-audit' gem 'byebug' gem 'capybara' gem 'capybara-screenshot' gem 'database_cleaner' - gem 'dotenv-rails' gem 'factory_bot_rails' gem 'geckodriver-helper' - gem 'puma' gem 'rspec-rails' gem 'rubocop', require: false + gem 'rubocop-performance', require: false + gem 'rubocop-rails', require: false gem 'rubocop-rspec', require: false gem 'selenium-webdriver' gem 'simplecov' + gem 'solr_wrapper' gem 'spring' + gem 'sqlite3' gem 'timecop' - gem 'web-console' - gem 'whenever-test' end diff --git a/Gemfile.lock b/Gemfile.lock index 5d6518ab..5cae73c3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,352 +1,480 @@ GIT - remote: https://github.com/mimemagicrb/mimemagic.git - revision: 01f92d86d15d85cfd0f20dabd025dcbd36a8a60f - ref: 01f92d86d15d85cfd0f20dabd025dcbd36a8a60f + remote: https://github.com/NYULibraries/sdr-cli.git + revision: 45cbc9e648a6ad3ce7071b84adf6e2d0168cae77 specs: - mimemagic (0.3.5) + sdr_cli (0.1.0) + dotenv (~> 2.7) + faraday (~> 2.7) + thor (~> 1.2.2) GEM remote: https://rubygems.org/ specs: - actioncable (5.2.4.4) - actionpack (= 5.2.4.4) + actioncable (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4.4) - actionpack (= 5.2.4.4) - actionview (= 5.2.4.4) - activejob (= 5.2.4.4) + actionmailbox (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.0.8) + actionpack (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activesupport (= 7.0.8) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (5.2.4.4) - actionview (= 5.2.4.4) - activesupport (= 5.2.4.4) - rack (~> 2.0, >= 2.0.8) + actionpack (7.0.8) + actionview (= 7.0.8) + activesupport (= 7.0.8) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4.4) - activesupport (= 5.2.4.4) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (7.0.8) + actionpack (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.0.8) + activesupport (= 7.0.8) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.4.4) - activesupport (= 5.2.4.4) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (7.0.8) + activesupport (= 7.0.8) globalid (>= 0.3.6) - activemodel (5.2.4.4) - activesupport (= 5.2.4.4) - activerecord (5.2.4.4) - activemodel (= 5.2.4.4) - activesupport (= 5.2.4.4) - arel (>= 9.0) - activestorage (5.2.4.4) - actionpack (= 5.2.4.4) - activerecord (= 5.2.4.4) - marcel (~> 0.3.1) - activesupport (5.2.4.4) + activemodel (7.0.8) + activesupport (= 7.0.8) + activerecord (7.0.8) + activemodel (= 7.0.8) + activesupport (= 7.0.8) + activestorage (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activesupport (= 7.0.8) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (7.0.8) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + addressable (2.8.5) + public_suffix (>= 2.0.2, < 6.0) + airbrussh (1.4.2) + sshkit (>= 1.6.1, != 1.7.0) 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) - bindex (0.8.1) - blacklight (6.23.0) - bootstrap-sass (~> 3.2) + autoprefixer-rails (10.4.15.0) + execjs (~> 2) + axe-core-api (4.7.0) + dumb_delegator + virtus + axe-core-rspec (4.7.0) + axe-core-api + dumb_delegator + virtus + axiom-types (0.1.1) + descendants_tracker (~> 0.0.4) + ice_nine (~> 0.11.0) + thread_safe (~> 0.3, >= 0.3.1) + base64 (0.1.1) + bcrypt (3.1.19) + blacklight (7.33.1) deprecation globalid + hashdiff + i18n (>= 1.7.0) jbuilder (~> 2.7) kaminari (>= 0.15) - nokogiri (~> 1.6) - rails (>= 4.2, < 6) - rsolr (>= 1.0.6, < 3) - twitter-typeahead-rails (= 0.11.1.pre.corejavascript) - bootstrap-sass (3.4.1) - autoprefixer-rails (>= 5.2.1) - sassc (>= 2.0.0) + ostruct (>= 0.3.2) + rails (>= 5.1, < 7.1) + view_component (~> 2.66) + bootsnap (1.16.0) + msgpack (~> 1.2) + bootstrap (4.6.2) + autoprefixer-rails (>= 9.1.0) + popper_js (>= 1.16.1, < 2) + sassc-rails (>= 2.0.0) builder (3.2.4) - bundler-audit (0.7.0.1) + bundler-audit (0.9.1) bundler (>= 1.2.0, < 3) - thor (>= 0.18, < 2) + thor (~> 1.0) byebug (11.1.3) - capybara (3.33.0) + capistrano (3.17.3) + airbrussh (>= 1.0.0) + i18n + rake (>= 10.0.0) + sshkit (>= 1.9.0) + capistrano-bundler (2.1.0) + capistrano (~> 3.1) + capistrano-passenger (0.2.1) + capistrano (~> 3.0) + capistrano-rails (1.6.3) + capistrano (~> 3.1) + capistrano-bundler (>= 1.1, < 3) + capistrano-rbenv (2.2.0) + capistrano (~> 3.1) + sshkit (~> 1.3) + capybara (3.39.2) addressable + matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (~> 1.5) + regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - capybara-screenshot (1.0.24) + capybara-screenshot (1.0.26) capybara (>= 1.0, < 4) launchy - childprocess (4.1.0) chronic (0.10.2) coderay (1.1.3) - concurrent-ruby (1.1.7) - config (2.2.1) + coercible (1.0.0) + descendants_tracker (~> 0.0.1) + concurrent-ruby (1.2.2) + config (4.2.1) deep_merge (~> 1.2, >= 1.2.1) dry-validation (~> 1.0, >= 1.0.0) + connection_pool (2.4.1) crass (1.0.6) - database_cleaner (1.8.5) - deep_merge (1.2.1) - deprecation (1.0.0) + database_cleaner (2.0.2) + database_cleaner-active_record (>= 2, < 3) + database_cleaner-active_record (2.1.0) + activerecord (>= 5.a) + database_cleaner-core (~> 2.0.0) + database_cleaner-core (2.0.1) + date (3.3.3) + deep_merge (1.2.2) + deprecation (1.1.0) activesupport - devise (4.7.2) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) + devise (4.9.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - diff-lcs (1.4.4) - docile (1.3.2) + diff-lcs (1.5.0) + docile (1.4.0) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) dotenv (2.8.1) - dotenv-rails (2.8.1) - dotenv (= 2.8.1) - railties (>= 3.2) - dry-configurable (0.11.6) + dry-configurable (1.1.0) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) + dry-core (1.0.1) concurrent-ruby (~> 1.0) - dry-core (~> 0.4, >= 0.4.7) - dry-equalizer (~> 0.2) - dry-container (0.7.2) + zeitwerk (~> 2.6) + dry-inflector (1.0.0) + dry-initializer (3.1.1) + dry-logic (1.5.0) concurrent-ruby (~> 1.0) - dry-configurable (~> 0.1, >= 0.1.3) - dry-core (0.4.9) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) + dry-schema (1.13.3) concurrent-ruby (~> 1.0) - dry-equalizer (0.3.0) - dry-inflector (0.2.0) - dry-initializer (3.0.3) - dry-logic (1.0.7) - concurrent-ruby (~> 1.0) - dry-core (~> 0.2) - dry-equalizer (~> 0.2) - dry-schema (1.5.4) - concurrent-ruby (~> 1.0) - dry-configurable (~> 0.8, >= 0.8.3) - dry-core (~> 0.4) - dry-equalizer (~> 0.2) + dry-configurable (~> 1.0, >= 1.0.1) + dry-core (~> 1.0, < 2) dry-initializer (~> 3.0) - dry-logic (~> 1.0) - dry-types (~> 1.4) - dry-types (1.4.0) + dry-logic (>= 1.4, < 2) + dry-types (>= 1.7, < 2) + zeitwerk (~> 2.6) + dry-types (1.7.1) concurrent-ruby (~> 1.0) - dry-container (~> 0.3) - dry-core (~> 0.4, >= 0.4.4) - dry-equalizer (~> 0.3) - dry-inflector (~> 0.1, >= 0.1.2) - dry-logic (~> 1.0, >= 1.0.2) - dry-validation (1.5.6) + dry-core (~> 1.0) + dry-inflector (~> 1.0) + dry-logic (~> 1.4) + zeitwerk (~> 2.6) + dry-validation (1.10.0) concurrent-ruby (~> 1.0) - dry-container (~> 0.7, >= 0.7.1) - dry-core (~> 0.4) - dry-equalizer (~> 0.2) + dry-core (~> 1.0, < 2) dry-initializer (~> 3.0) - dry-schema (~> 1.5, >= 1.5.2) - erubi (1.9.0) - execjs (2.7.0) - factory_bot (6.1.0) + dry-schema (>= 1.12, < 2) + zeitwerk (~> 2.6) + dumb_delegator (1.0.0) + erubi (1.12.0) + execjs (2.9.0) + factory_bot (6.2.1) activesupport (>= 5.0.0) - factory_bot_rails (6.1.0) - factory_bot (~> 6.1.0) + factory_bot_rails (6.2.0) + factory_bot (~> 6.2.0) railties (>= 5.0.0) - faraday (0.9.2) - multipart-post (>= 1.2, < 3) - faraday_middleware (0.14.0) - faraday (>= 0.7.4, < 1.0) + faraday (2.7.11) + base64 + faraday-net_http (>= 2.0, < 3.1) + ruby2_keywords (>= 0.0.4) + faraday-net_http (3.0.2) + faraday-net_http_persistent (2.1.0) + faraday (~> 2.5) + net-http-persistent (~> 4.0) ffi (1.15.5) - font-awesome-rails (4.7.0.5) - railties (>= 3.2, < 6.1) + ffi-compiler (1.0.1) + ffi (>= 1.0.0) + rake geckodriver-helper (0.24.0) archive-zip (~> 0.7) - geo_combine (0.5.0) + geo_combine (0.8.0) activesupport + faraday-net_http_persistent (~> 2.0) + git json-schema - net-http-persistent (~> 2.0) nokogiri rsolr sanitize thor - geoblacklight (1.9.1) - blacklight (~> 6.11) + geoblacklight (4.1.0) + blacklight (~> 7.33) coderay config deprecation - faraday - faraday_middleware - font-awesome-rails - geo_combine (>= 0.3) - geoblacklight-icons (>= 0.2) + faraday (>= 1.0) + geo_combine (~> 0.8) handlebars_assets - leaflet-rails (~> 1.3.0) mime-types - rails (~> 5.0) - geoblacklight-icons (1.4.0) - globalid (0.4.2) - activesupport (>= 4.2.0) - handlebars_assets (0.23.8) + rails (>= 6.1, < 7.1) + rgeo-geojson + git (1.18.0) + addressable (~> 2.8) + rchardet (~> 1.8) + globalid (1.2.1) + activesupport (>= 6.1) + handlebars_assets (0.23.9) execjs (~> 2.0) sprockets (>= 2.0.0) tilt (>= 1.2) + hashdiff (1.0.1) hashie (5.0.0) - i18n (1.8.5) + http (5.1.1) + addressable (~> 2.8) + http-cookie (~> 1.0) + http-form_data (~> 2.2) + llhttp-ffi (~> 0.4.0) + http-cookie (1.0.5) + domain_name (~> 0.5) + http-form_data (2.3.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) + ice_nine (0.11.2) + importmap-rails (1.2.1) + actionpack (>= 6.0.0) + railties (>= 6.0.0) io-like (0.3.1) - jbuilder (2.10.1) + jbuilder (2.11.5) + actionview (>= 5.0.0) activesupport (>= 5.0.0) - jquery-rails (4.4.0) + jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json-schema (2.8.1) - addressable (>= 2.4) - jwt (2.2.2) - kaminari (1.2.1) + json (2.6.3) + json-schema (4.0.0) + addressable (>= 2.8) + jwt (2.7.1) + kaminari (1.2.2) activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.1) - kaminari-activerecord (= 1.2.1) - kaminari-core (= 1.2.1) - kaminari-actionview (1.2.1) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) actionview - kaminari-core (= 1.2.1) - kaminari-activerecord (1.2.1) + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) activerecord - kaminari-core (= 1.2.1) - kaminari-core (1.2.1) - launchy (2.5.0) - addressable (~> 2.7) - leaflet-rails (1.3.1) - rails (>= 4.2.0) - loofah (2.7.0) + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) + language_server-protocol (3.17.0.3) + launchy (2.5.2) + addressable (~> 2.8) + llhttp-ffi (0.4.0) + ffi-compiler (~> 1.0) + rake (~> 13.0) + loofah (2.21.3) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) + nokogiri (>= 1.12.0) + mail (2.8.1) mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) + net-imap + net-pop + net-smtp + marcel (1.0.2) + matrix (0.4.2) method_source (1.0.0) - mime-types (3.3.1) + mime-types (3.5.1) mime-types-data (~> 3.2015) - mime-types-data (3.2020.0512) - mini_mime (1.0.2) - mini_portile2 (2.8.2) - minitest (5.14.2) - multi_json (1.15.0) + mime-types-data (3.2023.0808) + mini_mime (1.1.5) + minitar (0.9) + minitest (5.20.0) + msgpack (1.7.2) multi_xml (0.6.0) - multipart-post (2.1.1) - mysql2 (0.5.3) - net-http-persistent (2.9.4) + mysql2 (0.5.5) + net-http-persistent (4.0.2) + connection_pool (~> 2.2) + net-imap (0.3.7) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-scp (4.0.0) + net-ssh (>= 2.6.5, < 8.0.0) + net-smtp (0.3.3) + net-protocol + net-ssh (7.2.0) nio4r (2.5.9) - nokogiri (1.15.3) - mini_portile2 (~> 2.8.2) + nokogiri (1.15.4-arm64-darwin) racc (~> 1.4) - oauth2 (1.4.4) - faraday (>= 0.8, < 2.0) + nokogiri (1.15.4-x86_64-linux) + racc (~> 1.4) + oauth2 (2.0.9) + faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) - multi_json (~> 1.3) multi_xml (~> 0.5) - rack (>= 1.2, < 3) + rack (>= 1.2, < 4) + snaky_hash (~> 2.0) + version_gem (~> 1.1) omniauth (1.9.2) hashie (>= 3.4.6) rack (>= 1.6.2, < 3) - omniauth-oauth2 (1.2.0) - faraday (>= 0.8, < 0.10) - multi_json (~> 1.3) - oauth2 (~> 1.0) - omniauth (~> 1.2) + omniauth-oauth2 (1.7.3) + oauth2 (>= 1.4, < 3) + omniauth (>= 1.9, < 3) + omniauth-rails_csrf_protection (0.1.2) + actionpack (>= 4.2) + omniauth (>= 1.3.1) orm_adapter (0.5.0) + ostruct (0.5.5) parallel (1.23.0) parser (3.2.2.3) ast (~> 2.4.1) racc - public_suffix (4.0.6) + popper_js (1.16.1) + psych (5.1.0) + stringio + public_suffix (5.0.3) puma (5.6.7) nio4r (~> 2.0) racc (1.7.1) rack (2.2.8) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (5.2.4.4) - actioncable (= 5.2.4.4) - actionmailer (= 5.2.4.4) - actionpack (= 5.2.4.4) - actionview (= 5.2.4.4) - activejob (= 5.2.4.4) - activemodel (= 5.2.4.4) - activerecord (= 5.2.4.4) - activestorage (= 5.2.4.4) - activesupport (= 5.2.4.4) - bundler (>= 1.3.0) - railties (= 5.2.4.4) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rack-test (2.1.0) + rack (>= 1.3) + rails (7.0.8) + actioncable (= 7.0.8) + actionmailbox (= 7.0.8) + actionmailer (= 7.0.8) + actionpack (= 7.0.8) + actiontext (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activemodel (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) + bundler (>= 1.15.0) + railties (= 7.0.8) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - railties (5.2.4.4) - actionpack (= 5.2.4.4) - activesupport (= 5.2.4.4) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) method_source - rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) - rainbow (3.0.0) - rake (13.0.1) - rdoc (6.2.1) - regexp_parser (1.7.1) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) + rainbow (3.1.1) + rake (13.0.6) + rchardet (1.8.0) + rdoc (6.5.0) + psych (>= 4.0.0) + regexp_parser (2.8.1) + responders (3.1.0) + actionpack (>= 5.2) + railties (>= 5.2) retriable (3.1.2) - rexml (3.2.5) - rsolr (2.3.0) + rexml (3.2.6) + rgeo (3.0.0) + rgeo-geojson (2.1.1) + rgeo (>= 1.0.0) + rsolr (2.5.0) builder (>= 2.1.2) - faraday (>= 0.9.0) - rspec-core (3.9.2) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.2) + faraday (>= 0.9, < 3, != 2.0.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.1) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-rails (4.0.1) - actionpack (>= 4.2) - activesupport (>= 4.2) - railties (>= 4.2) - rspec-core (~> 3.9) - rspec-expectations (~> 3.9) - rspec-mocks (~> 3.9) - rspec-support (~> 3.9) - rspec-support (3.9.3) - rubocop (0.92.0) + rspec-support (~> 3.12.0) + rspec-rails (6.0.3) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) + rspec-support (3.12.1) + rubocop (1.56.3) + base64 (~> 0.1.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 2.7.1.5) + parser (>= 3.2.2.3) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.7) - rexml - rubocop-ast (>= 0.5.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) + unicode-display_width (>= 2.4.0, < 3.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) + rubocop-capybara (2.18.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.23.1) + rubocop (~> 1.33) + rubocop-performance (1.19.0) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rails (2.21.1) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) + rubocop-rspec (2.24.0) + rubocop (~> 1.33) + rubocop-capybara (~> 2.17) + rubocop-factory_bot (~> 2.22) + ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) rubyzip (2.3.2) sanitize (6.0.2) crass (~> 1.0.2) nokogiri (>= 1.12.0) - sass-rails (6.0.0) - sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) ffi (~> 1.9) sassc-rails (2.1.2) @@ -355,54 +483,74 @@ GEM sprockets (> 3.0) sprockets-rails tilt - sdoc (1.1.0) + sdoc (2.6.1) rdoc (>= 5.0) - selenium-webdriver (4.1.0) - childprocess (>= 0.5, < 5.0) + selenium-webdriver (4.12.0) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2) - simplecov (0.19.0) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) - simplecov-html (0.12.2) - solr_wrapper (2.2.0) - faraday + simplecov_json_formatter (~> 0.1) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + snaky_hash (2.0.1) + hashie + version_gem (~> 1.1, >= 1.1.1) + solr_wrapper (4.0.2) + http + minitar retriable ruby-progressbar - rubyzip - spring (2.1.1) - sprockets (4.0.2) + spring (4.1.1) + sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.4.2) - thor (1.0.1) + sqlite3 (1.6.6-arm64-darwin) + sqlite3 (1.6.6-x86_64-linux) + sshkit (1.21.5) + net-scp (>= 1.1.2) + net-ssh (>= 2.8.0) + stimulus-rails (1.2.2) + railties (>= 6.0.0) + stringio (3.0.8) + thor (1.2.2) thread_safe (0.3.6) - tilt (2.0.10) - timecop (0.9.6) - turbolinks (5.2.1) - turbolinks-source (~> 5.2) - turbolinks-source (5.2.0) + tilt (2.2.0) + timecop (0.9.8) + timeout (0.4.0) + turbo-rails (1.4.0) + actionpack (>= 6.0.0) + activejob (>= 6.0.0) + railties (>= 6.0.0) twitter-typeahead-rails (0.11.1.pre.corejavascript) actionpack (>= 3.1) jquery-rails railties (>= 3.1) - tzinfo (1.2.7) - thread_safe (~> 0.1) - uglifier (4.2.0) - execjs (>= 0.3.0, < 3) - unicode-display_width (1.8.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.8.2) + unicode-display_width (2.4.2) + version_gem (1.1.3) + view_component (2.82.0) + activesupport (>= 5.2.0, < 8.0) + concurrent-ruby (~> 1.0) + method_source (~> 1.0) + virtus (2.0.0) + axiom-types (~> 0.1) + coercible (~> 1.0) + descendants_tracker (~> 0.0, >= 0.0.3) warden (1.2.9) rack (>= 2.0.9) - web-console (3.7.0) - actionview (>= 5.0) - activemodel (>= 5.0) - bindex (>= 0.4.0) - railties (>= 5.0) - websocket-driver (0.7.3) + websocket (1.2.9) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) whenever (1.0.0) @@ -411,50 +559,67 @@ GEM whenever xpath (3.2.0) nokogiri (~> 1.8) + zeitwerk (2.6.11) PLATFORMS - ruby + arm64-darwin-22 + x86_64-linux DEPENDENCIES - blacklight + axe-core-rspec + blacklight (~> 7.0) + bootsnap + bootstrap (~> 4.0) bundler-audit byebug + capistrano (~> 3.17) + capistrano-passenger (~> 0.2.1) + capistrano-rails (~> 1.6) + capistrano-rbenv (~> 2.2) capybara capybara-screenshot config database_cleaner devise - dotenv-rails factory_bot_rails geckodriver-helper - geoblacklight (~> 1.9.0) + geoblacklight (~> 4.0) + importmap-rails jbuilder jquery-rails - mimemagic! mysql2 - omniauth + omniauth (= 1.9.2) omniauth-oauth2 - puma - rails - rainbow - rsolr + omniauth-rails_csrf_protection + puma (~> 5.0) + rails (~> 7.0.6) + rsolr (>= 1.0, < 3) rspec-rails rubocop + rubocop-performance + rubocop-rails rubocop-rspec - sass-rails + sassc-rails (~> 2.1) sdoc + sdr_cli! selenium-webdriver simplecov solr_wrapper spring + sprockets (< 4.0) + sprockets-rails sqlite3 + stimulus-rails timecop - turbolinks - twitter-typeahead-rails - uglifier - web-console + turbo-rails + twitter-typeahead-rails (= 0.11.1.pre.corejavascript) + tzinfo-data + view_component whenever whenever-test +RUBY VERSION + ruby 3.2.2p53 + BUNDLED WITH - 2.1.4 + 2.4.17 diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 0f67efa9..ddd546a0 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,4 +1,4 @@ //= link_tree ../images -//= link_tree ../javascripts -//= link_tree ../stylesheets //= link_directory ../stylesheets .css +//= link_tree ../../javascript .js +//= link_tree ../../../vendor/javascript .js diff --git a/app/assets/images/blacklight/search.svg b/app/assets/images/blacklight/search.svg new file mode 100644 index 00000000..0ef5f99b --- /dev/null +++ b/app/assets/images/blacklight/search.svg @@ -0,0 +1 @@ + diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 38180744..f84bb9b5 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,23 +1,15 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, -// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// compiled file. -// -// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details -// about supported directives. -// -//= require jquery -//= require jquery_ujs +//= require jquery3 +//= require rails-ujs // // Required by Blacklight +//= require popper +// Twitter Typeahead for autocomplete +//= require twitter/typeahead +//= require bootstrap //= require blacklight/blacklight -// For blacklight_range_limit built-in JS, if you don't want it you don't need -// this: -//= require_tree . +// Required by GeoBlacklight +//= require geoblacklight +//= require geoblacklight/basemaps diff --git a/app/assets/javascripts/basemaps.js b/app/assets/javascripts/basemaps.js deleted file mode 100644 index bc7c853b..00000000 --- a/app/assets/javascripts/basemaps.js +++ /dev/null @@ -1,76 +0,0 @@ -//= require handlebars.runtime -//= require geoblacklight/geoblacklight -//= require geoblacklight/controls -//= require geoblacklight/viewers -//= require geoblacklight/modules -//= require geoblacklight/downloaders -//= require leaflet-iiif -//= require esri-leaflet -//= require readmore.min -//= require Leaflet.fullscreen.js - -GeoBlacklight.Basemaps = { - darkMatter: L.tileLayer( - 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{retina}.png', { - attribution: '© OpenStreetMap contributors, © Carto', - maxZoom: 18, - worldCopyJump: true, - retina: '@2x', - detectRetina: false - } - ), - positron: L.tileLayer( - 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{retina}.png', { - attribution: '© OpenStreetMap contributors, © Carto', - maxZoom: 18, - worldCopyJump: true, - retina: '@2x', - detectRetina: false - } - ), - positronLite: L.tileLayer( - 'https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}{retina}.png', { - attribution: '© OpenStreetMap contributors, © Carto', - maxZoom: 18, - worldCopyJump: true, - retina: '@2x', - detectRetina: false - } - ), - worldAntique: L.tileLayer( - 'https://cartocdn_{s}.global.ssl.fastly.net/base-antique/{z}/{x}/{y}{retina}.png', { - attribution: '© OpenStreetMap contributors, © Carto', - maxZoom: 18, - worldCopyJump: true, - retina: '@2x', - detectRetina: false - } - ), - worldEco: L.tileLayer( - 'https://cartocdn_{s}.global.ssl.fastly.net/base-eco/{z}/{x}/{y}{retina}.png', { - attribution: '© OpenStreetMap contributors, © Carto', - maxZoom: 18, - worldCopyJump: true, - retina: '@2x', - detectRetina: false - } - ), - flatBlue: L.tileLayer( - 'https://cartocdn_{s}.global.ssl.fastly.net/base-flatblue/{z}/{x}/{y}{retina}.png', { - attribution: '© OpenStreetMap contributors, © Carto', - maxZoom: 18, - worldCopyJump: true, - retina: '@2x', - detectRetina: false - } - ), - midnightCommander: L.tileLayer( - 'https://cartocdn_{s}.global.ssl.fastly.net/base-midnight/{z}/{x}/{y}{retina}.png', { - attribution: '© OpenStreetMap contributors, © Carto', - maxZoom: 18, - worldCopyJump: true, - retina: '@2x', - detectRetina: false - } - ) -}; diff --git a/app/assets/javascripts/geoblacklight.js b/app/assets/javascripts/geoblacklight.js index b2f0bdab..47b30f7e 100644 --- a/app/assets/javascripts/geoblacklight.js +++ b/app/assets/javascripts/geoblacklight.js @@ -6,12 +6,13 @@ //= require geoblacklight/modules //= require geoblacklight/downloaders //= require leaflet-iiif -//= require esri-leaflet -//= require readmore.min +//= require esri-leaflet-debug +//= require readmore.min.js + //= require Leaflet.fullscreen.js GeoBlacklight.Controls.Fullscreen = function() { - this.map.addControl(new L.Control.Fullscreen({ - position: 'topright' - })); + this.map.addControl(new L.Control.Fullscreen({ + position: 'topright' + })); }; diff --git a/app/assets/javascripts/modules/analytics.js b/app/assets/javascripts/modules/analytics.js deleted file mode 100644 index 2a3f95b3..00000000 --- a/app/assets/javascripts/modules/analytics.js +++ /dev/null @@ -1,84 +0,0 @@ -// Inspired by and modified from http://railsapps.github.io/rails-google-analytics.html -// This page taken from Stanford's Earthworks - -GoogleAnalytics = (function() { - function GoogleAnalytics() {} - - GoogleAnalytics.load = function() { - var firstScript, ga; - window._gaq = []; - GoogleAnalytics.analyticsId = GoogleAnalytics.getAnalyticsId(); - window._gaq.push(['_setAccount', GoogleAnalytics.analyticsId]); - ga = document.createElement('script'); - ga.type = 'text/javascript'; - ga.async = true; - ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - firstScript = document.getElementsByTagName('script')[0]; - firstScript.parentNode.insertBefore(ga, firstScript); - }; - - GoogleAnalytics.trackPageview = function(url) { - if (!GoogleAnalytics.isLocalRequest()) { - if (url) { - window._gaq.push(['_trackPageview', url]); - } else { - window._gaq.push(['_trackPageview']); - } - return window._gaq.push(['_trackPageLoadTime']); - } - }; - - GoogleAnalytics.isLocalRequest = function() { - return GoogleAnalytics.documentDomainIncludes('local'); - }; - - GoogleAnalytics.documentDomainIncludes = function(str) { - return document.domain.indexOf(str) !== -1; - }; - - GoogleAnalytics.getAnalyticsId = function() { - return $('[data-analytics-id]').data('analytics-id'); - }; - - return GoogleAnalytics; - -})(); - -Blacklight.onLoad(function() { - GoogleAnalytics.load(); - if (GoogleAnalytics.analyticsId) { - GoogleAnalytics.trackPageview(); - } - - // Log spatial search events - - // Map Moved - History.Adapter.bind(window, 'statechange', function(e) { - var state = History.getState(); - window._gaq.push(['_trackEvent', 'Spatial Search', 'Map Moved', state.url]); - }); - - // Initiate search in an area - $('.leaflet-control.search-control a.btn-primary').on('click', function(e) { - window._gaq.push(['_trackEvent', 'Spatial Search', 'Search Here', e.currentTarget.baseURI]); - }); - - // Log download clicks - $(document).on('click', '[data-download="trigger"]', function(e) { - var data = $(e.target).data(); - window._gaq.push(['_trackEvent', 'Download', data.downloadId, data.downloadType]); - }); - - // Log failed download - $(document).on('DOMNodeInserted', function(e) { - var data = $('[data-download="error"]').data(); - if (data) { - window._gaq.push(['_trackEvent', 'Failed Download', data.downloadId, data.downloadType]); - } - }); - - // Log Open in CartoDB Clicks - $(document).on('click', 'li.exports a:contains("Open in Carto")', function(e) { - window._gaq.push(['_trackEvent', 'Open in Carto', window.location.pathname.replace('/catalog/', '')]); - }); -}); diff --git a/app/assets/stylesheets/_blacklight.scss b/app/assets/stylesheets/_blacklight.scss new file mode 100644 index 00000000..e97a2afe --- /dev/null +++ b/app/assets/stylesheets/_blacklight.scss @@ -0,0 +1 @@ +@import 'blacklight/blacklight'; diff --git a/app/assets/stylesheets/_customizations.scss b/app/assets/stylesheets/_customizations.scss new file mode 100644 index 00000000..2ac820d0 --- /dev/null +++ b/app/assets/stylesheets/_customizations.scss @@ -0,0 +1,32 @@ +$nyu-ultra-violet: #8900e1; +$nyu-dark-violet: #330662; + +a { + color: $nyu-ultra-violet; + &:hover { + color: $nyu-dark-violet; + } +} + +.navbar-dark .navbar-nav .nav-link { + color: white; +} + +.btn-primary { + background-color: $nyu-ultra-violet; +} + +dd.col-md-9.blacklight-dct_description_sm > button { + color: $nyu-ultra-violet; + &:hover { + color: $nyu-dark-violet; + } +} + +#main-container > div > section.page-sidebar.col-lg-3 > div:nth-child(3) > div > ul > li > a { + color: $nyu-ultra-violet; + &:hover { + color: $nyu-dark-violet; + } + font-weight: 600; +} diff --git a/app/assets/stylesheets/geoblacklight.scss b/app/assets/stylesheets/_geoblacklight.scss similarity index 81% rename from app/assets/stylesheets/geoblacklight.scss rename to app/assets/stylesheets/_geoblacklight.scss index df6557ba..46ad864e 100644 --- a/app/assets/stylesheets/geoblacklight.scss +++ b/app/assets/stylesheets/_geoblacklight.scss @@ -1,5 +1,4 @@ -@import 'geoblacklight/application'; -@import 'leaflet-label'; +@import 'geoblacklight/geoblacklight'; @import 'geoblacklight/modules/icons'; @import 'geoblacklight/modules/header_navbar'; @import 'geoblacklight/modules/nyu_footer'; diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index ff4a5675..b90c8e90 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,2 +1,4 @@ +@import 'bootstrap'; @import 'blacklight'; @import 'geoblacklight'; +@import 'customizations'; diff --git a/app/assets/stylesheets/blacklight.scss b/app/assets/stylesheets/blacklight.scss deleted file mode 100644 index d0f9ac24..00000000 --- a/app/assets/stylesheets/blacklight.scss +++ /dev/null @@ -1,8 +0,0 @@ -@import 'bootstrap-sprockets'; - -@import 'bootstrap'; - -@import 'blacklight/blacklight'; - -@import 'geoblacklight/application'; -@import 'bootstrap-variables'; diff --git a/app/assets/stylesheets/bootstrap-variables.scss b/app/assets/stylesheets/bootstrap-variables.scss deleted file mode 100644 index 30d9ba68..00000000 --- a/app/assets/stylesheets/bootstrap-variables.scss +++ /dev/null @@ -1,59 +0,0 @@ - - - -// Bootstrap Overrides - -//Colors -$beige: #9d9573; -$beige-10-percent: #f2f1eb; -$beige-20-percent: #e9e6df; -$beige-30-percent: #e3dfd5; -$beige-40-percent: #d5d0c0; -$beige-5-percent: #fbfbf9; -$black: #2e2d29; -$cardinal-red: #8c1515; -$dark-red: #820000; -$gray-41-percent: #696969; -$gray-46-percent: #767676; -$gray-60-percent: #8a887d; -$gray-70-percent: #b3b3b3; -$gray-80-percent: #ccc; -$gray-90-percent: #565347; -$gray: #3f3c30; -$gray-brown: #81785a; -$pantone-2925: #0098db; -$pantone-334: #009b76; -$pantone-405: #5f574f; - -// NYU colors -$nyu-purple: #57068c; -$nyu-linkred: #d11255; -$nyu-blue: #448ccb; -$nyu-gray: #818790; -$nyu-darkcyan: #005b7f; -$nyu-green: #0e7d8e; -$nyu-cyan: #0077a2; -$nyu-brown: #816c5d; - - -// Scaffolding -$link-color: $nyu-cyan; - -// Typography -$font-family-sans-serif: 'Source Sans Pro', sans-serif; - -// Dropdowns -$dropdown-link-hover-color: #fff; -$dropdown-link-hover-bg: #005b7f; - -// Navbar -$navbar-default-bg: #DCDCDC; -$navbar-height: 70px; -$navbar-inverse-bg: #57068c; -$navbar-inverse-link-color: #fff; -$navbar-inverse-brand-hover-color: $beige-10-percent; -$navbar-inverse-link-hover-color: $beige-10-percent; -$navbar-inverse-toggle-hover-bg: #833DB1; - -// Jumbotron -$jumbotron-bg: #DCDCDC; diff --git a/app/assets/stylesheets/geoblacklight/modules/cards.scss b/app/assets/stylesheets/geoblacklight/modules/cards.scss index 578c05ac..80187064 100644 --- a/app/assets/stylesheets/geoblacklight/modules/cards.scss +++ b/app/assets/stylesheets/geoblacklight/modules/cards.scss @@ -59,6 +59,12 @@ text-decoration: none; } +.card-text { + font-size: 12px; + text-decoration: none; +} + + .card-description { } @@ -81,4 +87,4 @@ /* Add some padding inside the card container */ .container { padding: 2px 16px; -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/geoblacklight/modules/icons.scss b/app/assets/stylesheets/geoblacklight/modules/icons.scss index 28346952..088e30cc 100644 --- a/app/assets/stylesheets/geoblacklight/modules/icons.scss +++ b/app/assets/stylesheets/geoblacklight/modules/icons.scss @@ -14,11 +14,11 @@ color: #777777; } -.geoblacklight-relations-ancestor { - @extend .fa, .fa-pagelines; -} +/*.geoblacklight-relations-ancestor {*/ +/* @extend .fa, .fa-pagelines;*/ +/*}*/ -.geoblacklight-relations-descendant { - @extend .fa, .fa-leaf; -} +/*.geoblacklight-relations-descendant {*/ +/* @extend .fa, .fa-leaf;*/ +/*}*/ diff --git a/app/assets/stylesheets/original/application.css b/app/assets/stylesheets/original/application.css deleted file mode 100644 index f9cd5b34..00000000 --- a/app/assets/stylesheets/original/application.css +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, - * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the bottom of the - * compiled file so the styles you add here take precedence over styles defined in any styles - * defined in the other CSS/SCSS files in this directory. It is generally better to create a new - * file per style scope. - * - *= require_tree . - *= require_self - */ diff --git a/app/assets/stylesheets/original/blacklight.css.scss b/app/assets/stylesheets/original/blacklight.css.scss deleted file mode 100644 index 3519d906..00000000 --- a/app/assets/stylesheets/original/blacklight.css.scss +++ /dev/null @@ -1,5 +0,0 @@ -@import 'bootstrap-sprockets'; - -@import 'bootstrap'; - -@import 'blacklight/blacklight'; diff --git a/app/assets/stylesheets/original/geoblacklight.css.scss b/app/assets/stylesheets/original/geoblacklight.css.scss deleted file mode 100644 index f7b22eec..00000000 --- a/app/assets/stylesheets/original/geoblacklight.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -/* -*= require geoblacklight/application -*/ diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb new file mode 100644 index 00000000..d6726972 --- /dev/null +++ b/app/channels/application_cable/channel.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb new file mode 100644 index 00000000..0ff5442f --- /dev/null +++ b/app/channels/application_cable/connection.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/app/components/blacklight/document_metadata_restricted_component.html.erb b/app/components/blacklight/document_metadata_restricted_component.html.erb new file mode 100644 index 00000000..d9377f1b --- /dev/null +++ b/app/components/blacklight/document_metadata_restricted_component.html.erb @@ -0,0 +1,10 @@ +<% if @document.rights_text %> + +<% end %> +<% if (@document["dct_isPartOf_sm"]) && (@document["dct_isPartOf_sm"].include? ("2015 Dublin LiDAR")) %> + <%= render 'laefer_notice' %> +<% end %> +<% if (@document["dct_isPartOf_sm"]) && (@document["dct_isPartOf_sm"].include? ("2019 Sunset Park LiDAR")) %> + <%= render 'laefer_sunset' %> +<% end %> diff --git a/app/components/blacklight/document_metadata_restricted_component.rb b/app/components/blacklight/document_metadata_restricted_component.rb new file mode 100644 index 00000000..63175257 --- /dev/null +++ b/app/components/blacklight/document_metadata_restricted_component.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Blacklight + class DocumentMetadataRestrictedComponent < Blacklight::Component + def initialize(document:) + super + @document = document + end + + def render? + @document.present? + end + end +end diff --git a/app/components/curated_collections/curated_collection_component.html.erb b/app/components/curated_collections/curated_collection_component.html.erb new file mode 100644 index 00000000..97ab0e2f --- /dev/null +++ b/app/components/curated_collections/curated_collection_component.html.erb @@ -0,0 +1,10 @@ +
+
+ <%= link_to search_catalog_path(f: @collection[:f] ) do %> +
+

<%= @collection[:title] %>

+

<%= @collection[:description] %>

+
+ <% end %> +
+
diff --git a/app/components/curated_collections/curated_collection_component.rb b/app/components/curated_collections/curated_collection_component.rb new file mode 100644 index 00000000..871cfa72 --- /dev/null +++ b/app/components/curated_collections/curated_collection_component.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module CuratedCollections + class CuratedCollectionComponent < ViewComponent::Base + def initialize(collection:) + super + @collection = collection + end + end +end diff --git a/app/components/curated_collections/curated_collections_component.html.erb b/app/components/curated_collections/curated_collections_component.html.erb new file mode 100644 index 00000000..e6c8a26e --- /dev/null +++ b/app/components/curated_collections/curated_collections_component.html.erb @@ -0,0 +1,8 @@ +
+

<%= @header %>

+
+ <% @collections.each do |collection| %> + <%= render CuratedCollections::CuratedCollectionComponent.new(collection: collection) %> + <% end %> +
+
diff --git a/app/components/curated_collections/curated_collections_component.rb b/app/components/curated_collections/curated_collections_component.rb new file mode 100644 index 00000000..a8bb5d71 --- /dev/null +++ b/app/components/curated_collections/curated_collections_component.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module CuratedCollections + class CuratedCollectionsComponent < ViewComponent::Base + def initialize(collections:, header:) + super + @collections = collections + @header = header + end + end +end diff --git a/app/components/curated_maps/curated_map_component.html.erb b/app/components/curated_maps/curated_map_component.html.erb new file mode 100644 index 00000000..6d67af6d --- /dev/null +++ b/app/components/curated_maps/curated_map_component.html.erb @@ -0,0 +1,13 @@ +
+ > +
+ <%= image_tag "thumb/#{@map[:slug]}.jpg", + { class: 'card-img-top', + "data-svg-fallback": image_path('real250.png').to_s, + alt: 'NYU Spatial Data Repository' } %> +
+

<%= @map[:title] %>

+
+
+
+
diff --git a/app/components/curated_maps/curated_map_component.rb b/app/components/curated_maps/curated_map_component.rb new file mode 100644 index 00000000..98c84852 --- /dev/null +++ b/app/components/curated_maps/curated_map_component.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module CuratedMaps + class CuratedMapComponent < ViewComponent::Base + def initialize(map:) + super + @map = map + end + end +end diff --git a/app/components/curated_maps/curated_maps_component.html.erb b/app/components/curated_maps/curated_maps_component.html.erb new file mode 100644 index 00000000..90f41b9e --- /dev/null +++ b/app/components/curated_maps/curated_maps_component.html.erb @@ -0,0 +1,8 @@ +
+

Featured Maps

+
+ <% @maps.each do |map| %> + <%= render CuratedMaps::CuratedMapComponent.new(map: map) %> + <% end %> +
+
diff --git a/app/components/curated_maps/curated_maps_component.rb b/app/components/curated_maps/curated_maps_component.rb new file mode 100644 index 00000000..aa5b6a5d --- /dev/null +++ b/app/components/curated_maps/curated_maps_component.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module CuratedMaps + class CuratedMapsComponent < ViewComponent::Base + def initialize(maps:) + super + @maps = maps + end + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 29cc5cce..e7fb2c1a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,18 +1,18 @@ -# frozen_string_literal: true - class ApplicationController < ActionController::Base # Adds a few additional behaviors into the application controller include Blacklight::Controller - skip_after_action :discard_flash_if_xhr - layout 'blacklight' + layout :determine_layout if respond_to? :layout + + before_action :allow_geoblacklight_params - # Prevent CSRF attacks by raising an exception. - # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :exception + def allow_geoblacklight_params + # Blacklight::Parameters will pass these to params.permit + blacklight_config.search_state_fields.append(Settings.GBL_PARAMS) + end # Alias new_session_path as login_path for default devise config def new_session_path(_scope) - login_path + user_shibboleth_omniauth_authorize_path end def after_sign_in_path_for(resource) @@ -20,8 +20,9 @@ def after_sign_in_path_for(resource) end def current_user_dev - @current_user_dev ||= User.find_by_username('admin') || User.new + @current_user_dev ||= User.find_by(username: 'admin', provider: 'nyulibraries') || User.find_or_create_by!(guest_user_params) end + alias current_user current_user_dev if Rails.env.development? # After signing out from the local application, @@ -31,8 +32,17 @@ def after_sign_out_path_for(resource_or_scope) super(resource_or_scope) end + private + def logout_path Settings.LOGOUT_URL || 'https://qa.auth.it.nyu.edu/oidc/logout' end - private :logout_path + + def guest_user_params + { provider: 'nyulibraries', + email: 'anon_guest@example.com', + username: 'admin', + firstname: 'Anon', + lastname: 'Guest' } + end end diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index 720d4488..288afad0 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -1,30 +1,38 @@ -# frozen_string_literal: true - require 'blacklight/catalog' -class CatalogController < ApplicationController - # include BlacklightRangeLimit::ControllerOverride - +class CatalogController < ApplicationController # rubocop:disable Metrics/ClassLength include Blacklight::Catalog - include NyuSlugConcern configure_blacklight do |config| + # Ensures that JSON representations of Solr Documents can be retrieved using + # the path /catalog/:id/raw + # Please see https://github.com/projectblacklight/blacklight/pull/2006/ + config.raw_endpoint.enabled = true + ## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params + ## @see https://lucene.apache.org/solr/guide/6_6/common-query-parameters.html + ## @see https://lucene.apache.org/solr/guide/6_6/the-dismax-query-parser.html#TheDisMaxQueryParser-Theq.altParameter config.default_solr_params = { :start => 0, - :rows => 10, 'q.alt' => '*:*' } + ## Default rows returned from Solr + ## @see https://lucene.apache.org/solr/guide/6_6/common-query-parameters.html + config.default_per_page = 10 + ## 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}' + q: "{!raw f=#{Settings.FIELDS.ID} v=$id}" } - config.index.document_presenter_class = Geoblacklight::DocumentPresenter + # GeoBlacklight Defaults + # * Adds the "map" split view for catalog#index + config.view.split(partials: ['index']) + config.view.delete_field('list') # solr field configuration for search results/index views # config.index.show_link = 'title_display' @@ -33,8 +41,20 @@ class CatalogController < ApplicationController config.index.title_field = Settings.FIELDS.TITLE # solr field configuration for document/show views - + # This sets the metadata to display below the map viewer. + # To move metadata above the map viewer, + # remove the lines deleting and re-adding the :show partial config.show.display_type_field = 'format' + config.show.partials.delete(:show) + config.show.partials << 'show_default_display_note' + config.show.partials << 'show_default_viewer_container' + config.show.partials << 'show_default_attribute_table' + config.show.partials << 'show_default_viewer_information' + config.show.partials << :show + + ## + # Configure the index document presenter. + config.index.document_presenter_class = Geoblacklight::DocumentPresenter # solr fields that will be treated as facets by the blacklight application # The ordering of the field names is the order of the display @@ -62,7 +82,6 @@ class CatalogController < ApplicationController # config.add_facet_field 'lc_1letter_facet', :label => 'Call Number' # config.add_facet_field 'subject_geo_facet', :label => 'Region' # config.add_facet_field 'solr_bbox', :fq => "solr_bbox:IsWithin(-88,26,-79,36)", :label => 'Spatial' - # config.add_facet_field 'example_pivot_field', :label => 'Pivot Field', :pivot => ['format', 'language_facet'] # config.add_facet_field 'example_query_facet_field', :label => 'Publish Date', :query => { @@ -71,62 +90,129 @@ 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' + # FACETS + + # DEFAULT FACETS + # to add additional facets, use the keys defined in the settings.yml file + config.add_facet_field Settings.FIELDS.PROVIDER, label: 'Institution', limit: 8, item_component: Geoblacklight::IconFacetItemComponent 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.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.IS_PART_OF, label: 'Collection', show: true + config.add_facet_field Settings.FIELDS.INDEX_YEAR, label: 'Year', limit: 10 + config.add_facet_field Settings.FIELDS.ACCESS_RIGHTS, label: 'Access', limit: 8, item_component: Geoblacklight::IconFacetItemComponent + config.add_facet_field Settings.FIELDS.RESOURCE_CLASS, label: 'Resource Class', limit: 8 + config.add_facet_field Settings.FIELDS.RESOURCE_TYPE, label: 'Data Type', limit: 8 + config.add_facet_field Settings.FIELDS.FORMAT, label: 'File Format', limit: 8 + # config.add_facet_field Settings.FIELDS.THEME, label: 'Theme', limit: 8 + config.add_facet_field Settings.FIELDS.PUBLISHER, label: 'Publisher', limit: 8 + # config.add_facet_field Settings.FIELDS.GEOREFERENCED, label: 'Georeferenced', limit: 3 + + # GEOBLACKLIGHT APPLICATION FACETS + + # Map-Based "Search Here" Feature + # item_presenter - Defines how the facet appears in the GBL UI + # filter_query_builder - Defines the query generated for Solr + # filter_class - Defines how to add/remove facet from query + # label - Defines the label used in contstraints container + config.add_facet_field Settings.FIELDS.GEOMETRY, item_presenter: Geoblacklight::BboxItemPresenter, filter_class: Geoblacklight::BboxFilterField, filter_query_builder: Geoblacklight::BboxFilterQuery, within_boost: Settings.BBOX_WITHIN_BOOST, overlap_boost: Settings.OVERLAP_RATIO_BOOST, overlap_field: Settings.FIELDS.OVERLAP_FIELD, label: 'Bounding Box' + + # Item Relationship Facets + # * Not displayed to end user (show: false) + # * Must be present for relationship "Browse all 4 records" links to work + # * Label value becomes the search contraint filter name + config.add_facet_field Settings.FIELDS.MEMBER_OF, label: 'Member Of', show: false + config.add_facet_field Settings.FIELDS.RELATION, label: 'Related', show: false + config.add_facet_field Settings.FIELDS.REPLACES, label: 'Replaces', show: false + config.add_facet_field Settings.FIELDS.IS_REPLACED_BY, label: 'Is Replaced By', show: false + config.add_facet_field Settings.FIELDS.SOURCE, label: 'Source', show: false + config.add_facet_field Settings.FIELDS.VERSION, label: 'Is Version Of', show: false # 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 # handler defaults, or have no facets. config.add_facet_fields_to_solr_request! + # SEARCH RESULTS FIELDS + # solr fields to be displayed in the index (search results) view # The ordering of the field names is the order of the display - # config.add_index_field 'title_display', :label => 'Title:' - # config.add_index_field 'title_vern_display', :label => 'Title:' - # config.add_index_field 'author_display', :label => 'Author:' - # config.add_index_field 'author_vern_display', :label => 'Author:' - # config.add_index_field 'format', :label => 'Format:' - # config.add_index_field 'language_facet', :label => 'Language:' - # config.add_index_field 'published_display', :label => 'Published:' - # config.add_index_field 'published_vern_display', :label => 'Published:' - # config.add_index_field 'lc_callnum_display', :label => 'Call number:' - - # config.add_index_field 'dc_title_t', :label => 'Display Name:' - # config.add_index_field Settings.FIELDS.PROVENANCE, :label => 'Institution:' + # config.add_index_field Settings.FIELDS.PROVIDER, :label => 'Institution:' # config.add_index_field Settings.FIELDS.RIGHTS, :label => 'Access:' # # config.add_index_field 'Area', :label => 'Area:' # config.add_index_field Settings.FIELDS.SUBJECT, :label => 'Keywords:' - config.add_index_field Settings.FIELDS.YEAR + config.add_index_field Settings.FIELDS.INDEX_YEAR config.add_index_field Settings.FIELDS.CREATOR config.add_index_field Settings.FIELDS.DESCRIPTION, helper_method: :snippit config.add_index_field Settings.FIELDS.PUBLISHER + # ITEM VIEW FIELDS + # solr fields to be displayed in the show (single result) view # The ordering of the field names is the order of the display - # # item_prop: [String] property given to span with Schema.org item property # link_to_search: [Boolean] that can be passed to link to a facet search # helper_method: [Symbol] method that can be used to render the value - config.add_show_field Settings.FIELDS.CREATOR, label: 'Author(s)', itemprop: 'author', link_to_search: true + + # DEFAULT FIELDS + # The following fields all feature string values. If there is a value present in the metadata, they fields will show up on the item show page. + # The labels and order can be customed. Comment out fields to hide them. + + config.add_show_field Settings.FIELDS.ALTERNATIVE_TITLE, label: 'Alternative Title', itemprop: 'alt_title' config.add_show_field Settings.FIELDS.DESCRIPTION, label: 'Description', itemprop: 'description', helper_method: :render_value_as_truncate_abstract - config.add_show_field Settings.FIELDS.PUBLISHER, label: 'Publisher', itemprop: 'publisher', link_to_search: true - config.add_show_field Settings.FIELDS.PART_OF, label: 'Collection', itemprop: 'isPartOf', link_to_search: true - config.add_show_field Settings.FIELDS.SPATIAL_COVERAGE, label: 'Place(s)', itemprop: 'spatial', link_to_search: true, separator: '; ' - config.add_show_field Settings.FIELDS.SUBJECT, label: 'Subject(s)', itemprop: 'keywords', link_to_search: true - config.add_show_field Settings.FIELDS.FILE_FORMAT, label: 'Format(s)', itemprop: 'formats', link_to_search: true - config.add_show_field Settings.FIELDS.TEMPORAL, label: 'Year(s)', itemprop: 'temporal' - config.add_show_field Settings.FIELDS.PROVENANCE, label: 'Held by', link_to_search: true + config.add_show_field Settings.FIELDS.CREATOR, label: 'Creator', itemprop: 'creator', link_to_facet: true + config.add_show_field Settings.FIELDS.PUBLISHER, label: 'Publisher', itemprop: 'publisher', link_to_facet: true + config.add_show_field Settings.FIELDS.PROVIDER, label: 'Provider', link_to_facet: true + config.add_show_field Settings.FIELDS.IS_PART_OF, label: 'Collection', link_to_facet: true + config.add_show_field Settings.FIELDS.RESOURCE_CLASS, label: 'Resource Class', itemprop: 'class', link_to_facet: true + config.add_show_field Settings.FIELDS.RESOURCE_TYPE, label: 'Resource Type', itemprop: 'type', link_to_facet: true + config.add_show_field Settings.FIELDS.SUBJECT, label: 'Subject', itemprop: 'keywords', link_to_facet: true + config.add_show_field Settings.FIELDS.THEME, label: 'Theme', itemprop: 'theme' + config.add_show_field Settings.FIELDS.TEMPORAL_COVERAGE, label: 'Temporal Coverage', itemprop: 'temporal' + config.add_show_field Settings.FIELDS.DATE_ISSUED, label: 'Date Issued', itemprop: 'issued' + config.add_show_field Settings.FIELDS.SPATIAL_COVERAGE, label: 'Spatial Coverage', itemprop: 'spatial', link_to_facet: true + config.add_show_field Settings.FIELDS.RIGHTS, label: 'Rights', itemprop: 'rights' + config.add_show_field Settings.FIELDS.RIGHTS_HOLDER, label: 'Rights Holder', itemprop: 'rights_holder' + config.add_show_field Settings.FIELDS.LICENSE, label: 'License', itemprop: 'license' + config.add_show_field Settings.FIELDS.ACCESS_RIGHTS, label: 'Access Rights', itemprop: 'access_rights' + config.add_show_field Settings.FIELDS.FORMAT, label: 'Format', itemprop: 'format', link_to_facet: true + config.add_show_field Settings.FIELDS.FILE_SIZE, label: 'File Size', itemprop: 'file_size' + config.add_show_field Settings.FIELDS.GEOREFERENCED, label: 'Georeferenced', itemprop: 'georeferenced' + config.add_show_field( + Settings.FIELDS.REFERENCES, + label: 'More details at', + accessor: [:external_url], + if: proc { |_, _, doc| doc.external_url }, + helper_method: :render_references_url + ) + + # ADDITIONAL FIELDS + # The following fields are not user friendly and are not set to appear on the item show page. They contain non-literal values, codes, URIs, or are otherwise designed to power features in the interface. + # These values might need a translations to be readable by users. + + # config.add_show_field Settings.FIELDS.LANGUAGE, label: 'Language', itemprop: 'language' + # config.add_show_field Settings.FIELDS.KEYWORD, label: 'Keyword(s)', itemprop: 'keyword' + + # config.add_show_field Settings.FIELDS.INDEX_YEAR, label: 'Year', itemprop: 'year' + # config.add_show_field Settings.FIELDS.DATE_RANGE, label: 'Date Range', itemprop: 'date_range' + + # config.add_show_field Settings.FIELDS.CENTROID, label: 'Centroid', itemprop: 'centroid' + # config.add_show_field Settings.FIELDS.OVERLAP_FIELD, label: 'Overlap BBox', itemprop: 'overlap_field' + + # config.add_show_field Settings.FIELDS.RELATION, label: 'Relation', itemprop: 'relation' + # config.add_show_field Settings.FIELDS.MEMBER_OF, label: 'Member Of', itemprop: 'member_of' + # config.add_show_field Settings.FIELDS.IS_PART_OF, label: 'Is Part Of', itemprop: 'is_part_of' + # config.add_show_field Settings.FIELDS.VERSION, label: 'Version', itemprop: 'version' + # config.add_show_field Settings.FIELDS.REPLACES, label: 'Replaces', itemprop: 'replaces' + # config.add_show_field Settings.FIELDS.IS_REPLACED_BY, label: 'Is Replaced By', itemprop: 'is_replaced_by' + + # config.add_show_field Settings.FIELDS.WXS_IDENTIFIER, label: 'Web Service Layer', itemprop: 'wxs_identifier' + # config.add_show_field Settings.FIELDS.ID, label: 'ID', itemprop: 'id' + # config.add_show_field Settings.FIELDS.IDENTIFIER, label: 'Identifier', itemprop: 'identifier' + + # config.add_show_field Settings.FIELDS.MODIFIED, label: 'Date Modified', itemprop: 'modified' + # config.add_show_field Settings.FIELDS.METADATA_VERSION, label: 'Metadata Version', itemprop: 'metadata_version' + # config.add_show_field Settings.FIELDS.SUPPRESSED, label: 'Suppressed', itemprop: 'suppresed' # "fielded" search configuration. Used by pulldown among other places. # For supported keys in hash, see rdoc for Blacklight::SearchFields @@ -146,9 +232,9 @@ class CatalogController < ApplicationController # solr request handler? The one set in config[:default_solr_parameters][:qt], # since we aren't specifying it otherwise. - # config.add_search_field 'text', :label => 'All Fields' - # config.add_search_field 'dc_title_ti', :label => 'Title' - # config.add_search_field 'dc_description_ti', :label => 'Description' + config.add_search_field 'all_fields', label: 'All Fields' + # config.add_search_field 'dct_title_ti', :label => 'Title' + # config.add_search_field 'dct_description_ti', :label => 'Description' # Now we see how to over-ride Solr request handler defaults, in this # case for a BL "search field", which is really a dismax aggregate @@ -200,26 +286,46 @@ 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, dct_title_sort asc', label: 'Relevance' + config.add_sort_field "#{Settings.FIELDS.INDEX_YEAR} desc, dct_title_sort asc", label: 'Year (Newest first)' + config.add_sort_field "#{Settings.FIELDS.INDEX_YEAR} asc, dct_title_sort asc", label: 'Year (Oldest first)' + config.add_sort_field 'dct_title_sort asc', label: 'Title (A-Z)' + config.add_sort_field 'dct_title_sort desc', label: 'Title (Z-A)' # If there are more than this many search results, no spelling ("did you # mean") suggestion is offered. config.spell_max = 5 + # Nav actions from Blacklight + config.add_nav_action(:bookmark, partial: 'blacklight/nav/bookmark', if: :render_bookmarks_control?) + config.add_nav_action(:search_history, partial: 'blacklight/nav/search_history') + + # Tools from Blacklight + config.add_results_collection_tool(:sort_widget) + config.add_results_collection_tool(:per_page_widget) + config.add_show_tools_partial(:bookmark, partial: 'bookmark_control', if: :render_bookmarks_control?) + config.add_show_tools_partial(:citation) + config.add_show_tools_partial(:email, callback: :email_action, validator: :validate_email_params) + config.add_show_tools_partial(:sms, if: :render_sms_action?, callback: :sms_action, validator: :validate_sms_params) + # Custom tools for GeoBlacklight - config.add_show_tools_partial :web_services, if: proc { |_context, _config, options| options[:document] && (Settings.WEBSERVICES_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any? } - config.add_show_tools_partial :metadata, if: proc { |_context, _config, options| options[:document] && (Settings.METADATA_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any? } - config.add_show_tools_partial :exports, partial: 'exports', if: proc { |_context, _config, options| options[:document] } - config.add_show_tools_partial :data_dictionary, partial: 'data_dictionary', if: proc { |_context, _config, options| options[:document] } - config.add_show_tools_partial :downloads, partial: 'downloads', if: proc { |_context, _config, options| options[:document] } - config.show.document_actions.delete(:sms) - config.show.document_actions.delete(:citation) - - # Us this menu to configure basemap provider for GeoBlacklight maps (uses https only basemap + config.add_show_tools_partial :metadata, if: proc { |_context, _config, options| options[:document] && Settings.METADATA_SHOWN.intersect?(options[:document].references.refs.map(&:type).map(&:to_s)) } # rubocop:disable Performance/MapMethodChain: + config.add_show_tools_partial :carto, partial: 'carto', if: proc { |_context, _config, options| options[:document] && options[:document].carto_reference.present? } + config.add_show_tools_partial :arcgis, partial: 'arcgis', if: proc { |_context, _config, options| options[:document] && options[:document].arcgis_urls.present? } + config.add_show_tools_partial :data_dictionary, partial: 'data_dictionary', if: proc { |_context, _config, options| options[:document] && options[:document].data_dictionary_download.present? } + + # Configure basemap provider for GeoBlacklight maps (uses https only basemap # providers with open licenses) + # Valid basemaps include: + # 'positron' + # 'darkMatter' + # 'positronLite' + # 'worldAntique' + # 'worldEco' + # 'flatBlue' + # 'midnightCommander' + # 'openstreetmapHot' + # 'openstreetmapStandard' config.basemap_provider = 'positron' @@ -227,4 +333,15 @@ class CatalogController < ApplicationController config.autocomplete_enabled = true config.autocomplete_path = 'suggest' end + + def web_services + @response, @documents = action_documents + + respond_to do |format| + format.html do + return render layout: false if request.xhr? + # Otherwise draw the full page + end + end + end end diff --git a/app/controllers/concerns/nyu_slug_concern.rb b/app/controllers/concerns/nyu_slug_concern.rb deleted file mode 100644 index 786f0a78..00000000 --- a/app/controllers/concerns/nyu_slug_concern.rb +++ /dev/null @@ -1,29 +0,0 @@ -# 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 - transform_id if /^nyu_\d{4}_\d{5}$/.match(params[:id]) - @response, @document = fetch_document(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 - - private - - def transform_id - params[:id].gsub!('_', '-') - end - - def fetch_document(id) - fetch(id) - end -end diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 3d99ef2d..17895ee9 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -2,6 +2,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController before_action :require_valid_omniauth, only: :shibboleth + skip_before_action :verify_authenticity_token, only: :shibboleth def shibboleth Rails.logger.info("OmniauthCallbacksController#shibboleth: #{omniauth.inspect}") @@ -73,10 +74,10 @@ def set_user # Find existing or initialize new user, # and save new attributes each time @user = find_user - @user.update_attributes(attributes_from_omniauth) + @user.update(attributes_from_omniauth) end def find_user - @find_user ||= User.create_from_provider_data(request.env['omniauth.auth']) + @find_user ||= User.from_omniauth(request.env['omniauth.auth']) end end diff --git a/app/controllers/wms_controller.rb b/app/controllers/wms_controller.rb deleted file mode 100644 index cdce79e3..00000000 --- a/app/controllers/wms_controller.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -class WmsController < ApplicationController - before_action :format_url - def handle - response = Geoblacklight::WmsLayer.new(wms_params).feature_info - - respond_to do |format| - format.json { render json: response } - end - end - - private - - def wms_params - params.permit('URL', 'LAYERS', 'BBOX', 'WIDTH', 'HEIGHT', 'QUERY_LAYERS', 'X', 'Y') - end - - def format_url - params['URL'] = Settings.RESTRICTED_URL if params['URL'].include? Settings.PROXY_URL - end -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 58509305..e0a6e20a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,100 +1,7 @@ # frozen_string_literal: true module ApplicationHelper - def construct_curated_maps - maps = NyuGeoblacklight::CuratedCollections.maps.sample(3) - to_return = "
-

Featured Maps

-
" - maps.each do |map| - to_return += create_map_portion(map) - end - to_return += "
-
" - to_return.html_safe - end - - def download_text_alt(format) - "#{t 'geoblacklight.download.download'} #{proper_case_format_alt(format)}".html_safe - end - - def proper_case_format_alt(format) - t "geoblacklight.formats.#{format.downcase}" || format - end - def download_text_laefer_alt(format) - format.to_s.html_safe - end - - def create_map_portion(map) - to_return = " -
-
" - to_return += (image_tag "thumb/#{map[:slug]}.jpg", { class: 'card-img-top', "data-svg-fallback": image_path('real250.png').to_s, alt: 'NYU Spatial Data Repository' }) - to_return += "
-

#{map[:title]}

-
-
-
-
" - to_return - end - - def construct_curated_collections - collections = NyuGeoblacklight::CuratedCollections.collections.sample(2) - to_return = "
-

Featured Collections

-
" - collections.each do |collection| - to_return += create_collection_portion(collection) - end - to_return += "
-
" - to_return.html_safe - end - - def create_collection_portion(collection) - to_return = link_to search_catalog_path({ f: collection[:f] }), { class: 'curated-card' } do - " -
-
-
-

#{collection[:title]}

-

#{collection[:description]}

-
-
-
- ".html_safe - end - to_return.html_safe - end - - def construct_recent_collections - collections = NyuGeoblacklight::CuratedCollections.recent[0..1] - to_return = "
-

Recently Updated

-
" - collections.each do |collection| - to_return += create_recent_portion(collection) - end - to_return += "
-
" - to_return.html_safe - end - - def create_recent_portion(collection) - to_return = link_to search_catalog_path({ f: collection[:f] }), { class: 'curated-card' } do - " -
-
-
-

#{collection[:title]}

-

#{collection[:description]}

-
-
-
- ".html_safe - end - to_return.html_safe + format.to_s end end diff --git a/app/helpers/geoblacklight_helper.rb b/app/helpers/geoblacklight_helper.rb new file mode 100644 index 00000000..9271b1c5 --- /dev/null +++ b/app/helpers/geoblacklight_helper.rb @@ -0,0 +1,244 @@ +# frozen_string_literal: true + +module GeoblacklightHelper # rubocop:disable Metrics/ModuleLength + def document_available? + @document.public? || (@document.same_institution? && user_signed_in?) + end + + def document_downloadable? + document_available? && @document.downloadable? + end + + def iiif_jpg_url + @document.references.iiif.endpoint.sub! 'info.json', 'full/full/0/default.jpg' + end + + def download_link_file(label, id, url) + link_to( + label, + url, + 'contentUrl' => url, + :data => { + download: 'trigger', + download_type: 'direct', + download_id: id + } + ) + end + + def download_link_hgl(text, document) + link_to( + text, + download_hgl_path(id: document), + data: { + blacklight_modal: 'trigger', + download: 'trigger', + download_type: 'harvard-hgl', + download_id: document.id + } + ) + end + + # Generates the link markup for the IIIF JPEG download + # @return [String] + def download_link_iiif + link_to( + download_text('JPG'), + iiif_jpg_url, + 'contentUrl' => iiif_jpg_url, + :data => { + download: 'trigger' + } + ) + end + + def download_link_generated(download_type, document) + link_to(export_format_label(download_type), + '', + data: { + download_path: download_path(document.id, type: download_type), + download: 'trigger', + download_type:, + download_id: document.id + }) + end + + ## + # Blacklight catalog controller helper method to truncate field value to 150 chars + # @param [SolrDocument] args + # @return [String] + def snippit(args) + truncate(Array(args[:value]).flatten.join(' '), length: 150) + end + + ## + # Returns an SVG icon or empty HTML span element + # @return [SVG or HTML tag] + def geoblacklight_icon(name, **args) + icon_name = name ? name.to_s.parameterize : 'none' + begin + blacklight_icon(icon_name, **args) + rescue Blacklight::Exceptions::IconNotFound + tag.span class: 'icon-missing geoblacklight-none' + end + end + + ## + # Looks up properly formatted names for formats + # + def proper_case_format(format) + t("geoblacklight.formats.#{format.to_s.parameterize(separator: '_')}") + end + + # Format labels are customized for exports - look up the appropriate key. + def export_format_label(format) + t("geoblacklight.download.export_#{format.to_s.parameterize(separator: '_')}_link") + end + + ## + # Looks up formatted names for references + # @param (String, Symbol) reference + # @return (String) + def formatted_name_reference(reference) + t "geoblacklight.references.#{reference}" + end + + ## + # Wraps download text with proper_case_format + # + def download_text(format) + download_format = proper_case_format(format) + value = t('geoblacklight.download.download_link', download_format:) + value.html_safe + end + + ## + # Deteremines if a feature should include help text popover + # @return [Boolean] + def show_help_text?(feature, key) + Settings&.HELP_TEXT&.send(feature)&.include?(key) + end + + ## + # Render help text popover for a given feature and translation key + # @return [HTML tag] + def render_help_text_entry(feature, key) + if I18n.exists?("geoblacklight.help_text.#{feature}.#{key}", locale) + help_text = I18n.t("geoblacklight.help_text.#{feature}.#{key}") + tag.h3 class: 'help-text viewer_protocol h6' do + tag.a data: { toggle: 'popover', title: help_text[:title], content: help_text[:content] } do + help_text[:title] + end + end + else + tag.span class: 'help-text translation-missing' + end + end + + ## + # Determines if item view should render the sidebar static map + # @return [Boolean] + def render_sidebar_map?(document) + Settings.SIDEBAR_STATIC_MAP&.any? { |vp| document.viewer_protocol == vp } + end + + ## + # Deteremines if item view should include attribute table + # @return [Boolean] + def show_attribute_table? + document_available? && @document.inspectable? + end + + ## + # Render value for a document's field as a truncate abstract + # div. Arguments come from Blacklight::DocumentPresenter's + # get_field_values method + # @param [Hash] args from get_field_values + def render_value_as_truncate_abstract(args) + tag.div class: 'truncate-abstract' do + Array(args[:value]).flatten.join(' ') + end + end + + ## + # Selects the basemap used for map displays + # @return [String] + def geoblacklight_basemap + blacklight_config.basemap_provider || 'positron' + end + + ## + # Renders the partials for a Geoblacklight::Reference in the web services + # modal + # @param [Geoblacklight::Reference] + def render_web_services(reference) + render( + partial: "web_services_#{reference.type}", + locals: { reference: } + ) + rescue ActionView::MissingTemplate + render partial: 'web_services_default', locals: { reference: } + end + + ## + # Returns a hash of the leaflet plugin settings to pass to the viewer. + # @return[Hash] + def leaflet_options + Settings.LEAFLET + end + + ## + # Renders the transformed metadata + # (Renders a partial when the metadata isn't available) + # @param [Geoblacklight::Metadata::Base] metadata the metadata object + # @return [String] + def render_transformed_metadata(metadata) + render partial: 'catalog/metadata/content', locals: { content: metadata.transform.html_safe } + rescue Geoblacklight::MetadataTransformer::TransformError => e + Geoblacklight.logger.warn e.message + render partial: 'catalog/metadata/markup', locals: { content: metadata.to_xml } + rescue StandardError => e + Geoblacklight.logger.warn e.message + render partial: 'catalog/metadata/missing' + end + + ## + # Determines whether or not the metadata is the first within the array of References + # @param [SolrDocument] document the Solr Document for the item + # @param [Geoblacklight::Metadata::Base] metadata the object for the metadata resource + # @return [Boolean] + def first_metadata?(document, metadata) + document.references.shown_metadata.first.type == metadata.type + end + + ## + # Renders a reference url for a document + # @param [Hash] document, field_name + def render_references_url(args) + return unless args[:document]&.references&.url + + link_to( + args[:document].references.url.endpoint, + args[:document].references.url.endpoint + ) + end + + ## Returns the icon used based off a Settings strategy + def relations_icon(document, icon) + icon_name = document[Settings.FIELDS.GEOM_TYPE] if Settings.USE_GEOM_FOR_RELATIONS_ICON + icon_name = icon if icon_name.blank? + icon_options = {} + icon_options = { classes: 'svg_tooltip' } if Settings.USE_GEOM_FOR_RELATIONS_ICON + geoblacklight_icon(icon_name, **icon_options) + end + + ## Returns the data-map attribute value used as the JS map selector + def results_js_map_selector(controller_name) + case controller_name + when 'bookmarks' + 'bookmarks' + else + 'index' + end + end +end diff --git a/app/javascript/application.js b/app/javascript/application.js new file mode 100644 index 00000000..0d7b4940 --- /dev/null +++ b/app/javascript/application.js @@ -0,0 +1,3 @@ +// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails +import "@hotwired/turbo-rails" +import "controllers" diff --git a/app/javascript/controllers/application.js b/app/javascript/controllers/application.js new file mode 100644 index 00000000..1213e85c --- /dev/null +++ b/app/javascript/controllers/application.js @@ -0,0 +1,9 @@ +import { Application } from "@hotwired/stimulus" + +const application = Application.start() + +// Configure Stimulus development experience +application.debug = false +window.Stimulus = application + +export { application } diff --git a/app/javascript/controllers/hello_controller.js b/app/javascript/controllers/hello_controller.js new file mode 100644 index 00000000..5975c078 --- /dev/null +++ b/app/javascript/controllers/hello_controller.js @@ -0,0 +1,7 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + connect() { + this.element.textContent = "Hello World!" + } +} diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js new file mode 100644 index 00000000..54ad4cad --- /dev/null +++ b/app/javascript/controllers/index.js @@ -0,0 +1,11 @@ +// Import and register all your controllers from the importmap under controllers/* + +import { application } from "controllers/application" + +// Eager load all controllers defined in the import map under controllers/**/*_controller +import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading" +eagerLoadControllersFrom("controllers", application) + +// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!) +// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading" +// lazyLoadControllersFrom("controllers", application) diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 00000000..d394c3d1 --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,7 @@ +class ApplicationJob < ActiveJob::Base + # Automatically retry jobs that encountered a deadlock + # retry_on ActiveRecord::Deadlocked + + # Most jobs are safe to ignore if the underlying records are no longer available + # discard_on ActiveJob::DeserializationError +end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb new file mode 100644 index 00000000..286b2239 --- /dev/null +++ b/app/mailers/application_mailer.rb @@ -0,0 +1,4 @@ +class ApplicationMailer < ActionMailer::Base + default from: 'from@example.com' + layout 'mailer' +end diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 00000000..b63caeb8 --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + primary_abstract_class +end diff --git a/app/models/concerns/rights_concern.rb b/app/models/concerns/rights_concern.rb index 1326dfa3..cbc5f71e 100644 --- a/app/models/concerns/rights_concern.rb +++ b/app/models/concerns/rights_concern.rb @@ -8,6 +8,6 @@ def rights_text end def nyu? - fetch(:dct_provenance_s).downcase == 'nyu' + fetch(:schema_provider_s).casecmp('nyu').zero? end end diff --git a/app/models/concerns/wms_rewrite_concern.rb b/app/models/concerns/wms_rewrite_concern.rb index 2070bdba..1bee6c7d 100644 --- a/app/models/concerns/wms_rewrite_concern.rb +++ b/app/models/concerns/wms_rewrite_concern.rb @@ -17,6 +17,6 @@ def nyu_restricted? end def nyu? - fetch(:dct_provenance_s).downcase == 'nyu' + fetch(:schema_provider_s).casecmp('nyu').zero? end end diff --git a/app/models/search_builder.rb b/app/models/search_builder.rb index 0871bce9..8b02577d 100644 --- a/app/models/search_builder.rb +++ b/app/models/search_builder.rb @@ -2,5 +2,13 @@ class SearchBuilder < Blacklight::SearchBuilder include Blacklight::Solr::SearchBuilderBehavior - include Geoblacklight::SpatialSearchBehavior + include Geoblacklight::SuppressedRecordsSearchBehavior + + ## + # @example Adding a new step to the processor chain + # self.default_processor_chain += [:add_custom_data_to_query] + # + # def add_custom_data_to_query(solr_parameters) + # solr_parameters[:custom] = blacklight_params[:user_value] + # end end diff --git a/app/models/solr_document.rb b/app/models/solr_document.rb index 4a9b1a07..8b79e4b8 100644 --- a/app/models/solr_document.rb +++ b/app/models/solr_document.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +# Represent a single document returned from Solr class SolrDocument include Blacklight::Solr::Document include Geoblacklight::SolrDocument @@ -7,7 +8,8 @@ class SolrDocument include RightsConcern include MultiDownloadConcern - self.unique_key = 'layer_slug_s' + # self.unique_key = 'id' + self.unique_key = Settings.FIELDS.UNIQUE_KEY # Email uses the semantic field mappings below to generate the body of an email. SolrDocument.use_extension(Blacklight::Document::Email) diff --git a/app/models/user.rb b/app/models/user.rb index 96f639ae..9f59d47d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,27 +1,23 @@ -# frozen_string_literal: true - -class User < ActiveRecord::Base - attr_accessible :email, :password, :password_confirmation if Blacklight::Utils.needs_attr_accessible? +class User < ApplicationRecord # Connects this user object to Blacklights Bookmarks. include Blacklight::User # Include default devise modules. Others available are: - # :confirmable, :lockable, :timeoutable and :omniauthable - + # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :omniauthable, omniauth_providers: [:shibboleth] # Method added by Blacklight; Blacklight uses #to_s on your # user class to get a user-displayable login/identifier for # the account. - def to_s - email - end - def self.create_from_provider_data(provider_data) - where(provider: provider_data.provider, - username: provider_data.uid) - .first_or_create do |user| - user.email = provider_data.info.email - user.username = provider_data.uid + def self.from_omniauth(auth) + find_or_create_by(provider: auth.provider, username: auth.uid) do |user| + user.email = "#{auth.uid}@nyu.edu" + user.firstname = auth.info['first_name'] + user.lastname = auth.info['last_name'] end end + + def to_s + "#{firstname} #{lastname}" + end end diff --git a/app/views/_user_util_links.html.erb b/app/views/_user_util_links.html.erb deleted file mode 100644 index 23f4deae..00000000 --- a/app/views/_user_util_links.html.erb +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/app/views/catalog/_downloads.html.erb b/app/views/catalog/_downloads.html.erb deleted file mode 100644 index bcc28e5b..00000000 --- a/app/views/catalog/_downloads.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<% document ||= @document %> -<% if document.restricted? && document.same_institution? %> -
- <%= link_to t('geoblacklight.tools.login_to_view'), login_path %> -
-<% end %> diff --git a/app/views/catalog/_downloads_collapse.html.erb b/app/views/catalog/_downloads_collapse.html.erb new file mode 100644 index 00000000..d8a58301 --- /dev/null +++ b/app/views/catalog/_downloads_collapse.html.erb @@ -0,0 +1,32 @@ +<%# Renders the options of the downloads dropdown button %> +<% document ||= @document %> + +<% if document.multi_direct_downloads.present? %> + <% document.multi_direct_downloads.each do |download| %> + <%= download_link_file(download[0], document.id, download[1]) %> + <% end %> +<% end %> +<% if document.direct_download.present? %> + <% if document.direct_download[:download].is_a? Array %> + <% document.direct_download[:download].each do |download| %> + <%= download_link_file(download['label'], document.id, download['url']) %> + <% end %> + <% end %> + <% if document.direct_download[:download].is_a? String %> + <%= download_link_file(download_text(document.file_format), document.id, document.direct_download[:download]) %> + <% end %> +<% end %> + +<% if document.hgl_download.present? %> + <%= download_link_hgl(download_text(document.download_types.first[0]), document) %> +<% end %> + +<% if document.iiif_download.present? %> + <%= download_link_iiif %> +<% end %> + +<% if document.download_types.present? %> + <% document.download_types.each do |type| %> + <%= download_link_generated(type.first, document) %> + <% end %> +<% end %> diff --git a/app/views/catalog/_downloads_primary_old.html.erb b/app/views/catalog/_downloads_primary_old.html.erb deleted file mode 100644 index 9026c33b..00000000 --- a/app/views/catalog/_downloads_primary_old.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -<%# Renders the primary download that is shown first %> -<% document ||= @document %> - -<% if document.direct_download.present? %> - <%= link_to(download_text_alt(document.file_format[0]), document.direct_download[:download], class: 'btn btn-default', 'contentUrl' => document.direct_download[:download], data: { download: 'trigger', download_type: 'direct', download_id: document.id }) %> -<% elsif document.hgl_download.present? %> - <%= link_to(download_text_alt(document.download_types.first[0]), - download_hgl_path(id: document), data: {ajax_modal: 'trigger', download: 'trigger', download_type: 'harvard-hgl', download_id: document.id }, - class: 'btn btn-default') %> -<% elsif document.iiif_download.present? %> - <%= link_to "Download JPG", iiif_jpg_url, class: 'btn btn-default', download: 'trigger' %> -<% else %> - <%= link_to(download_text_alt(document.download_types.first[0]), '', data: { download_path: "#{download_path(document.id, type: document.download_types.first[0])}", download: 'trigger', download_type: document.download_types.first[0], download_id: document.id }, class: 'btn btn-default') %> -<% end %> diff --git a/app/views/catalog/_downloads_secondary_old.html.erb b/app/views/catalog/_downloads_secondary_old.html.erb deleted file mode 100644 index e6e38f16..00000000 --- a/app/views/catalog/_downloads_secondary_old.html.erb +++ /dev/null @@ -1,49 +0,0 @@ -<%# Renders the secondary downloads displayed in the split dropdown %> -<% document ||= @document %> - - - \ No newline at end of file diff --git a/app/views/catalog/_home_text.html.erb b/app/views/catalog/_home_text.html.erb index 8ce5ee98..6ff9e38f 100644 --- a/app/views/catalog/_home_text.html.erb +++ b/app/views/catalog/_home_text.html.erb @@ -1,70 +1,21 @@ -
-
- <%= content_tag :h2, t('geoblacklight.home.headline') %> - <%= content_tag :h3, t('geoblacklight.home.search_heading') %> -
- <%= render_search_form_no_navbar %> -
-
-
-
+
+
+ <%= content_tag :h3, t('geoblacklight.home.category_heading') %> +
+ <%= render(Geoblacklight::HomepageFeatureFacetComponent.new(icon: 'home', label: 'geoblacklight.home.institution', facet_field: Settings.FIELDS.PROVIDER, response: @response)) %> - -
-
- <%= content_tag :h3, t('geoblacklight.home.category_heading'), class: 'text-center' %> -
-
- -
-

Institution

- <%= render_facet_tags [Settings.FIELDS.PROVENANCE] %> + <%= render(Geoblacklight::HomepageFeatureFacetComponent.new(icon: 'arrow-circle-down', label: 'geoblacklight.home.data_type', facet_field: Settings.FIELDS.RESOURCE_TYPE, response: @response)) %>
-
-
- -
-

Data type

- <%= render_facet_tags [Settings.FIELDS.GEOM_TYPE] %> -
-
-
- -
-

Placename

- <%= render_facet_tags [Settings.FIELDS.SPATIAL_COVERAGE] %> -
-
-
- -
-

Subject

- <%= render_facet_tags [Settings.FIELDS.SUBJECT] %> +
+ <%= render(Geoblacklight::HomepageFeatureFacetComponent.new(icon: 'globe', label: 'geoblacklight.home.placename', facet_field: Settings.FIELDS.SPATIAL_COVERAGE, response: @response)) %> + + <%= render(Geoblacklight::HomepageFeatureFacetComponent.new(icon: 'tags', label: 'geoblacklight.home.subject', facet_field: Settings.FIELDS.SUBJECT, response: @response)) %>
-
+
<%= content_tag :h3, t('geoblacklight.home.map_heading') %> - <%= content_tag :div, '', id: 'map', data: {map: 'home', 'catalog-path' => search_catalog_path, 'map-bbox' => '-74.349498 40.531859 -73.491191 41.051707', basemap: geoblacklight_basemap, leaflet_options: leaflet_options} %> -
-
- -
- -
- -
- <%= construct_curated_collections %> -
-
- <%= construct_recent_collections %> -
+ <%= content_tag :div, '', id: 'map', aria: { label: t('geoblacklight.map.label') }, data: { map: 'home', 'catalog-path'=> search_catalog_path , 'map-geom' => Settings.HOMEPAGE_MAP_GEOM, basemap: geoblacklight_basemap, leaflet_options: leaflet_options } %>
- - <%= construct_curated_maps %> - -
- -
diff --git a/app/views/catalog/_show_downloads.html.erb b/app/views/catalog/_show_downloads.html.erb index b298e194..c52755ea 100644 --- a/app/views/catalog/_show_downloads.html.erb +++ b/app/views/catalog/_show_downloads.html.erb @@ -1,53 +1,23 @@ <% document ||= @document %> <% if document_downloadable? %> - <% if document.multi_direct_downloads.present? %> -
-
-

<%= t('geoblacklight.download.download').pluralize %>

+ <% if document.direct_download.present? || document.hgl_download.present? || document.iiif_download.present? || document.download_types.present? %> +
+ <%# the dropdown-toggle class gives us the little arrow %> + +
+
+ <%= render 'downloads_collapse' %> +
-
    - <% document.multi_direct_downloads.each do |dd| %> - <%= content_tag(:li, class: "list-group-item export") do %> - <%= content_tag(:div, class:"export-label") do %> - <%= download_text_laefer_alt(dd[0]) %> - <% end %> - - <%= content_tag(:div, class:"export-link-container") do %> - <%= link_to(t('geoblacklight.download.export_link'), dd[1], 'contentUrl' => dd[1], data: {download: 'trigger', download_type: 'direct', download_id: document.id}, class: 'btn btn-primary btn-block download download-generated') %> - <% end %> - - <% end %> - <% end %> -
-
- - <% elsif document.direct_download.present? || document.hgl_download.present? || document.iiif_download.present? %> -
-
-

<%= t('geoblacklight.download.download').pluralize %>

-
- -
    - <%= render 'downloads_primary' %> -
<% end %> - - <% if document.download_types.present? %> -
-
-

<%= t('geoblacklight.download.export_formats') %>

-
- -
    - <%= render 'downloads_generated' %> -
-
- <% end %> - <% elsif document.restricted? && document.same_institution? %> -
- <%= link_to t('geoblacklight.tools.login_to_view'), login_path %> +
+
+ <%= link_to t('geoblacklight.tools.login_to_view'), user_shibboleth_omniauth_authorize_path, method: :post, class: ['btn', 'btn-default'] %> +
<% end %> diff --git a/app/views/catalog/_show_main_content.html.erb b/app/views/catalog/_show_main_content.html.erb new file mode 100644 index 00000000..253b6097 --- /dev/null +++ b/app/views/catalog/_show_main_content.html.erb @@ -0,0 +1,25 @@ +<%= render(Blacklight::SearchContextComponent.new(search_context: @search_context, search_session: search_session)) if search_session['document_id'] == @document.id %> + +<% @page_title = t('blacklight.search.show.title', document_title: Deprecation.silence(Blacklight::BlacklightHelperBehavior) { document_show_html_title }, application_name: application_name).html_safe %> +<% content_for(:head) { render_link_rel_alternates } %> +<%= render Blacklight::DocumentMetadataRestrictedComponent.new(document: @document) %> +<%= render (blacklight_config.view_config(:show).document_component || Blacklight::DocumentComponent).new(presenter: document_presenter(@document), component: :div, title_component: :h1, show: true) do |component| %> + <% component.footer do %> + <% if @document.respond_to?(:export_as_openurl_ctx_kev) %> + + + <% end %> + <% end %> + + <%# Use :body for complete backwards compatibility (overriding the component body markup), + but if the app explicitly opted-in to components, make the partials data available as :partials to ease migrations pain %> + <% component.public_send(blacklight_config.view_config(:show).document_component.blank? && blacklight_config.view_config(:show).partials.any? ? :body : :partial) do %> +
+ <%= render_document_partials @document, blacklight_config.view_config(:show).partials, component: component %> +
+ <% end %> +<% end %> diff --git a/app/views/catalog/_show_tools_old.html.erb b/app/views/catalog/_show_tools_old.html.erb deleted file mode 100644 index d5bb7425..00000000 --- a/app/views/catalog/_show_tools_old.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -<%- - # Compare with render_document_functions_partial helper, and - # _document_functions partial. BL actually has two groups - # of document-related tools. "document functions" by default - # contains Bookmark functionality shown on both results and - # item view. While "document tools" contains external export type - # functions by default only on detail. - --%> -<% if show_doc_actions? %> -
-
-

<%= t('blacklight.tools.title') %>

-
- -
- -
-
-<% end %> diff --git a/app/views/catalog/_upper_metadata.html.erb b/app/views/catalog/_upper_metadata.html.erb deleted file mode 100644 index 5a7fe06c..00000000 --- a/app/views/catalog/_upper_metadata.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -<% document ||= @document %> -<% doc_presenter = show_presenter(document) %> - -
- <% if @document.rights_text %> - - <% end %> - <% if (document["dct_isPartOf_sm"]) && (document["dct_isPartOf_sm"].include? ("2015 Dublin LiDAR")) %> - <%= render 'laefer_notice' %> - <% end %> - <% if (document["dct_isPartOf_sm"]) && (document["dct_isPartOf_sm"].include? ("2019 Sunset Park LiDAR")) %> - <%= render 'laefer_sunset' %> - <% end %> - - <%# From https://github.com/projectblacklight/blacklight/blob/master/app/views/catalog/_show_default.html.erb %> - <%# default partial to display solr document fields in catalog show view -%> -
- <% document_show_fields(document).each do |field_name, field| -%> - <% if should_render_show_field? document, field %> -
<%= render_document_show_field_label document, field: field_name %>
-
<%= doc_presenter.field_value field %>
- <% end -%> - <% end -%> - <% if !@document.references.nil? && !@document.references.url.nil? %> -
Preservation record:
- - <% end %> -
-
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index c3c5b641..13ade367 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,14 +1,17 @@ - - - NYU Spatial Data Repository - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> - <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> - <%= csrf_meta_tags %> - - + + + NYU Spatial Data Repository + + <%= csrf_meta_tags %> + <%= csp_meta_tag %> -<%= yield %> + <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> + <%= javascript_tag '$.fx.off = true;' if Rails.env.test? %> + <%= javascript_importmap_tags %> + - + + <%= yield %> + diff --git a/app/views/layouts/blacklight.html.erb b/app/views/layouts/blacklight.html.erb index eadc9f77..472412b9 100644 --- a/app/views/layouts/blacklight.html.erb +++ b/app/views/layouts/blacklight.html.erb @@ -1,51 +1,26 @@ - - - - - - - +<% content_for(:content) do %> + <% if content_for? :sidebar %> +
+ <%= yield %> +
- - - - - - - - - - - <%= render_page_title %> - <%= opensearch_description_tag application_name, opensearch_catalog_url(:format => 'xml') %> - <%= favicon_link_tag 'favicon.ico' %> - <%= stylesheet_link_tag "application", media: "all" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - <%= content_for(:head) %> - - - - - - -
-
- <%= render :partial => 'shared/header_navbar' %> - <%= render partial: 'shared/ajax_modal' %> -
- <%= content_tag :h1, application_name, class: 'sr-only application-heading' %> - <%= render :partial => '/flash_msg', layout: 'shared/flash_messages' %> -
- <%= yield %> + + <% else %> +
+ <%= yield %> +
+
+ <%= render CuratedCollections::CuratedCollectionsComponent.new(collections: ::NyuGeoblacklight::CuratedCollections.collections.sample(2), + header: 'Featured Collections') %> + <%= render CuratedCollections::CuratedCollectionsComponent.new(collections: ::NyuGeoblacklight::CuratedCollections.recent[0..1], + header: 'Recently Updated') %> +
+ <%= render CuratedMaps::CuratedMapsComponent.new(maps: ::NyuGeoblacklight::CuratedCollections.maps.sample(3)) %>
-
-
- <%= render :partial => 'shared/footer' %> -
- - + + <% end %> +<% end %> + +<%= render template: "layouts/blacklight/base" %> diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb new file mode 100644 index 00000000..cbd34d2e --- /dev/null +++ b/app/views/layouts/mailer.html.erb @@ -0,0 +1,13 @@ + + + + + + + + + <%= yield %> + + diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb new file mode 100644 index 00000000..37f0bddb --- /dev/null +++ b/app/views/layouts/mailer.text.erb @@ -0,0 +1 @@ +<%= yield %> diff --git a/app/views/record_mailer/email_record.text.erb b/app/views/record_mailer/email_record.text.erb deleted file mode 100644 index d17a6054..00000000 --- a/app/views/record_mailer/email_record.text.erb +++ /dev/null @@ -1,5 +0,0 @@ -<% @documents.each do |document| %> -<%= document.to_email_text %> -<%= t('blacklight.email.text.url', :url =>polymorphic_url(document, @url_gen_params)) %> -<% end %> -<%= t('blacklight.email.text.message', :message => @message) %> \ No newline at end of file diff --git a/app/views/shared/_footer.html.erb b/app/views/shared/_footer.html.erb index 798f07cb..bb8cf046 100644 --- a/app/views/shared/_footer.html.erb +++ b/app/views/shared/_footer.html.erb @@ -13,7 +13,7 @@ <%= image_tag 'dss_newlogo1-short-sz.png', alt: 'Link to Data Services Homepage', height: 30 %>
- Running SDR <%= NyuGeoblacklight::VERSION %> + Running SDR <%= Settings.VERSION %>
diff --git a/app/views/shared/_header_navbar.html.erb b/app/views/shared/_header_navbar.html.erb index f76dd65e..4208771a 100644 --- a/app/views/shared/_header_navbar.html.erb +++ b/app/views/shared/_header_navbar.html.erb @@ -1,25 +1,47 @@ -