diff --git a/Gemfile b/Gemfile index 92f482f..260347a 100644 --- a/Gemfile +++ b/Gemfile @@ -5,13 +5,17 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end +ruby "~> 2.6.5" # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 5.0.1' +gem 'rails', '~> 5.1.4' +# gem 'rails', '~> 5.0.1' +gem "actionview", ">= 5.0.7.2" +# # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use Puma as the app server -gem 'puma', '~> 4.3' +gem 'puma', '~> 4.3.12' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets @@ -20,7 +24,8 @@ gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.2' # See https://github.com/rails/execjs#readme for more supported runtimes gem 'therubyracer', platforms: :ruby - +# +gem "nokogiri", ">= 1.13.6" # Use jquery as the JavaScript library gem 'jquery-rails' gem 'jquery-ui-rails' @@ -62,9 +67,13 @@ group :development, :test do end gem 'rsolr', '~> 1.0' -gem 'devise' +gem "devise", ">= 4.6.0" gem 'devise-guests', '~> 0.5' gem 'devise_cas_authenticatable' +gem "bootstrap-sass", ">= 3.4.1" +gem "rack", ">= 2.2.3" +gem "rails-html-sanitizer", ">= 1.4.3" +gem "loofah", ">= 2.2.3" #Makes it possible to find a file path using fx. page_path gem 'high_voltage', '~> 3.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index ca3e963..afa9635 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,67 +1,67 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.0.4) - actionpack (= 5.0.4) - nio4r (>= 1.2, < 3.0) - websocket-driver (~> 0.6.1) - actionmailer (5.0.4) - actionpack (= 5.0.4) - actionview (= 5.0.4) - activejob (= 5.0.4) + actioncable (5.1.7) + actionpack (= 5.1.7) + nio4r (~> 2.0) + actionmailer (5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.4) - actionview (= 5.0.4) - activesupport (= 5.0.4) + actionpack (5.1.7) + actionview (= 5.1.7) + activesupport (= 5.1.7) rack (~> 2.0) - rack-test (~> 0.6.3) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.4) - activesupport (= 5.0.4) + actionview (5.1.7) + activesupport (= 5.1.7) builder (~> 3.1) - erubis (~> 2.7.0) + erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.0.4) - activesupport (= 5.0.4) + activejob (5.1.7) + activesupport (= 5.1.7) globalid (>= 0.3.6) - activemodel (5.0.4) - activesupport (= 5.0.4) - activerecord (5.0.4) - activemodel (= 5.0.4) - activesupport (= 5.0.4) - arel (~> 7.0) - activesupport (5.0.4) + activemodel (5.1.7) + activesupport (= 5.1.7) + activerecord (5.1.7) + activemodel (= 5.1.7) + activesupport (= 5.1.7) + arel (~> 8.0) + activesupport (5.1.7) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (~> 0.7) + i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - arel (7.1.4) - autoprefixer-rails (7.1.1.2) + arel (8.0.0) + autoprefixer-rails (9.5.1) execjs - bcrypt (3.1.13) - bindex (0.5.0) - blacklight (6.10.1) + bcrypt (3.1.12) + bindex (0.7.0) + blacklight (6.20.0) bootstrap-sass (~> 3.2) deprecation globalid + 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) - blacklight-gallery (0.8.0) + blacklight-gallery (0.11.0) blacklight (~> 6.3) bootstrap-sass (~> 3.0) openseadragon (>= 0.2.0) rails - bootstrap-sass (3.3.7) + bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) - sass (>= 3.3.4) - builder (3.2.4) - byebug (9.0.6) + sassc (>= 2.0.0) + builder (3.2.3) + byebug (11.0.1) coffee-rails (4.2.2) coffee-script (>= 2.2.0) railties (>= 4.0.0) @@ -69,37 +69,37 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.6) + concurrent-ruby (1.1.5) crass (1.0.6) deprecation (1.0.0) activesupport - devise (4.7.1) + devise (4.6.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0) + railties (>= 4.1.0, < 6.0) responders warden (~> 1.2.3) - devise-guests (0.6.0) + devise-guests (0.7.0) devise - devise_cas_authenticatable (1.10.0) + devise_cas_authenticatable (1.10.3) devise (>= 1.2.0) rubycas-client (>= 2.2.1) - erubis (2.7.0) + erubi (1.8.0) execjs (2.7.0) - faraday (0.12.1) + faraday (0.15.4) multipart-post (>= 1.2, < 3) - ffi (1.11.3) - font-awesome-rails (4.7.0.2) - railties (>= 3.2, < 5.2) - globalid (0.4.0) + ffi (1.10.0) + font-awesome-rails (4.7.0.5) + railties (>= 3.2, < 6.1) + globalid (0.4.2) activesupport (>= 4.2.0) high_voltage (3.0.0) - i18n (0.9.5) + i18n (1.6.0) concurrent-ruby (~> 1.0) - jbuilder (2.7.0) + jbuilder (2.8.0) activesupport (>= 4.2.0) multi_json (>= 1.2) - jquery-rails (4.3.1) + jquery-rails (4.3.3) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -109,94 +109,101 @@ GEM jquery-ui-rails (6.0.1) railties (>= 3.2.16) jstree-rails-4 (3.3.4) - kaminari (1.2.1) + kaminari (1.1.1) 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.1.1) + kaminari-activerecord (= 1.1.1) + kaminari-core (= 1.1.1) + kaminari-actionview (1.1.1) actionview - kaminari-core (= 1.2.1) - kaminari-activerecord (1.2.1) + kaminari-core (= 1.1.1) + kaminari-activerecord (1.1.1) activerecord - kaminari-core (= 1.2.1) - kaminari-core (1.2.1) + kaminari-core (= 1.1.1) + kaminari-core (1.1.1) libv8 (3.16.14.19) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - loofah (2.5.0) + loofah (2.18.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.6) - mime-types (>= 1.16, < 4) + mail (2.7.1) + mini_mime (>= 0.1.1) method_source (0.9.2) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_portile2 (2.4.0) - minitest (5.14.1) - multi_json (1.12.1) + mini_mime (1.0.1) + mini_portile2 (2.8.0) + minitest (5.11.3) + multi_json (1.13.1) multipart-post (2.0.0) - nio4r (2.5.2) - nokogiri (1.10.9) - mini_portile2 (~> 2.4.0) - openseadragon (0.3.3) + nio4r (2.5.8) + nokogiri (1.13.7) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) + openseadragon (0.5.0) rails (> 3.2.0) orm_adapter (0.5.0) perfect-scrollbar-rails (0.6.15) railties (>= 3.2, < 6.0) - puma (4.3.5) + puma (4.3.12) nio4r (~> 2.0) - rack (2.0.8) - rack-test (0.6.3) - rack (>= 1.0) - rails (5.0.4) - actioncable (= 5.0.4) - actionmailer (= 5.0.4) - actionpack (= 5.0.4) - actionview (= 5.0.4) - activejob (= 5.0.4) - activemodel (= 5.0.4) - activerecord (= 5.0.4) - activesupport (= 5.0.4) - bundler (>= 1.3.0, < 2.0) - railties (= 5.0.4) + racc (1.6.0) + rack (2.2.4) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.1.7) + actioncable (= 5.1.7) + actionmailer (= 5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) + activemodel (= 5.1.7) + activerecord (= 5.1.7) + activesupport (= 5.1.7) + bundler (>= 1.3.0) + railties (= 5.1.7) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) + rails-html-sanitizer (1.4.3) loofah (~> 2.3) - railties (5.0.4) - actionpack (= 5.0.4) - activesupport (= 5.0.4) + railties (5.1.7) + actionpack (= 5.1.7) + activesupport (= 5.1.7) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (13.0.1) - rb-fsevent (0.9.8) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) + rake (12.3.2) + rb-fsevent (0.10.3) + rb-inotify (0.10.0) + ffi (~> 1.0) ref (2.0.0) - responders (3.0.0) - actionpack (>= 5.0) - railties (>= 5.0) - retriable (3.0.2) + responders (2.4.1) + actionpack (>= 4.2.0, < 6.0) + railties (>= 4.2.0, < 6.0) + retriable (3.1.2) rsolr (1.1.2) builder (>= 2.1.2) - ruby-progressbar (1.8.1) + ruby-progressbar (1.10.0) rubycas-client (2.3.9) activesupport - rubyzip (2.0.0) - sass (3.4.24) - sass-rails (5.0.6) + rubyzip (1.2.2) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (5.0.7) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - solr_wrapper (1.1.0) + sassc (2.0.1) + ffi (~> 1.9) + rake + solr_wrapper (2.1.0) faraday retriable ruby-progressbar @@ -209,50 +216,48 @@ GEM sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.0) + sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.3.13) + sqlite3 (1.4.0) therubyracer (0.12.3) libv8 (~> 3.16.14.15) ref thor (0.20.3) thread_safe (0.3.6) - tilt (2.0.7) - turbolinks (5.0.1) - turbolinks-source (~> 5) - turbolinks-source (5.0.3) + tilt (2.0.9) + turbolinks (5.2.0) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) twitter-typeahead-rails (0.11.1.pre.corejavascript) actionpack (>= 3.1) jquery-rails railties (>= 3.1) - tzinfo (1.2.7) + tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (3.2.0) + uglifier (4.1.20) execjs (>= 0.3.0, < 3) warden (1.2.8) rack (>= 2.0.6) - web-console (3.5.1) + web-console (3.7.0) actionview (>= 5.0) activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - websocket-driver (0.6.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - xray-rails (0.3.1) - rails (>= 3.1.0) + xray-rails (0.3.2) PLATFORMS ruby DEPENDENCIES + actionview (>= 5.0.7.2) blacklight (~> 6.0) blacklight-gallery + bootstrap-sass (>= 3.4.1) byebug coffee-rails (~> 4.2) - devise + devise (>= 4.6.0) devise-guests (~> 0.5) devise_cas_authenticatable font-awesome-rails @@ -263,9 +268,13 @@ DEPENDENCIES jquery-ui-rails jstree-rails-4 listen (~> 3.0.5) + loofah (>= 2.2.3) + nokogiri (>= 1.13.6) perfect-scrollbar-rails - puma (~> 4.3) - rails (~> 5.0.1) + puma (~> 4.3.12) + rack (>= 2.2.3) + rails (~> 5.1.4) + rails-html-sanitizer (>= 1.4.3) rsolr (~> 1.0) sass-rails (~> 5.0) solr_wrapper (>= 0.3) @@ -279,5 +288,8 @@ DEPENDENCIES web-console (>= 3.3.0) xray-rails +RUBY VERSION + ruby 2.6.5p114 + BUNDLED WITH - 1.16.0 + 1.17.2 diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index b6b27c0..94addd0 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -229,6 +229,7 @@ def get_edition_image_url(editionId) url = "" if docs.size > 0 url = docs.first['thumbnail_url_ssm'].first + url = url.gsub(/(https?:\/\/)(.*)$/,"https://\\2") end url end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 45ee6f9..53e6120 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -46,6 +46,7 @@ def get_lang params def show_scaled_image(doc, opts) uri = doc['thumbnail_url_ssm'].first + uri = uri.gsub(/(https?:\/\/)(.*)$/,"https://\\2") if uri[/ull\/[^\/]*?/] uri = uri.gsub(/full\/[^\/]*?\//,'full/!225,/') end diff --git a/app/models/finder.rb b/app/models/finder.rb index 90d1a4d..0d64de2 100644 --- a/app/models/finder.rb +++ b/app/models/finder.rb @@ -8,7 +8,7 @@ def self.get_solr # Function to return the solr document by id def self.get_doc_by_id(id) Rails.cache.fetch("document/#{id}", expires_in: 3.hours) do - query = "id:#{id}" + query = "id:\"#{id}\"" response = get_solr.get 'select', :params => {:q => query} # Return the first document response['response']['docs'].first @@ -18,8 +18,8 @@ def self.get_doc_by_id(id) # Function to return the solr documents that are subcategories, searching by id def self.get_subcats_by_id id Rails.cache.fetch("subcats/#{id}", expires_in: 3.hours) do - query = "parent_ssi:#{id}" # Set the query - response = get_solr.get 'select', :params => {:q => query, :rows => 1000} # Return all the subcategories (by default the rows: 10) + query = "parent_ssi:\"#{id}\"" # Set the query + response = get_solr.get 'select', :params => {:q => query , :rows => 1000} # Return all the subcategories (by default the rows: 10) response['response']['docs'].delete_if { |x| x["id"]=="/images/luftfo/2011/maj/luftfoto/subject203" } # Return all the documents except luftfoto end end diff --git a/app/views/catalog/_show_default.html.erb b/app/views/catalog/_show_default.html.erb index ddd569d..b091b51 100644 --- a/app/views/catalog/_show_default.html.erb +++ b/app/views/catalog/_show_default.html.erb @@ -44,7 +44,10 @@ - + diff --git a/app/views/tree/_tree.html.erb b/app/views/tree/_tree.html.erb index 3ebe3b0..ce29e89 100644 --- a/app/views/tree/_tree.html.erb +++ b/app/views/tree/_tree.html.erb @@ -6,28 +6,31 @@
+
+ <% if subject_id == "/editions/any/2009/jul/editions" %> - - - + + + + <% elsif !get_breadcrumb_path(subject_id).nil? %> - - <% array_of_ancestors = get_breadcrumb_path(subject_id) %> - <% i=0 %> - - + + + <% array_of_ancestors = get_breadcrumb_path(subject_id) %> + <% i=0 %> + + <% end %>
diff --git a/config/blacklight.yml b/config/blacklight.yml index c6d6738..34851d6 100644 --- a/config/blacklight.yml +++ b/config/blacklight.yml @@ -19,4 +19,4 @@ test: &test production: adapter: solr url: <%= ENV['SOLR_URL'] || "http://index-test.kb.dk/solr/cop-editions" %> - \ No newline at end of file + diff --git a/config/environments/development.rb b/config/environments/development.rb index 7af462d..d94c2e3 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -12,6 +12,8 @@ # Show full error reports. config.consider_all_requests_local = true + + config.i18n.fallbacks = [:en,:da] #cache settings config.action_controller.perform_caching = true config.cache_store = :file_store, 'cache' diff --git a/config/environments/production.rb b/config/environments/production.rb index 6a25093..d898d5b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -69,7 +69,8 @@ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). - config.i18n.fallbacks = true + # config.i18n.fallbacks = true + config.i18n.fallbacks = [:en,:da] # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify diff --git a/db/migrate/20170301125837_create_searches.blacklight.rb b/db/migrate/20170301125837_create_searches.blacklight.rb index 97bc5e2..caeb80c 100644 --- a/db/migrate/20170301125837_create_searches.blacklight.rb +++ b/db/migrate/20170301125837_create_searches.blacklight.rb @@ -1,6 +1,6 @@ # This migration comes from blacklight (originally 20140202020201) # frozen_string_literal: true -class CreateSearches < ActiveRecord::Migration +class CreateSearches < ActiveRecord::Migration[5.0] def self.up create_table :searches do |t| t.binary :query_params diff --git a/db/migrate/20170301125838_create_bookmarks.blacklight.rb b/db/migrate/20170301125838_create_bookmarks.blacklight.rb index 3050c72..1a021cd 100644 --- a/db/migrate/20170301125838_create_bookmarks.blacklight.rb +++ b/db/migrate/20170301125838_create_bookmarks.blacklight.rb @@ -1,6 +1,6 @@ # This migration comes from blacklight (originally 20140202020202) # frozen_string_literal: true -class CreateBookmarks < ActiveRecord::Migration +class CreateBookmarks < ActiveRecord::Migration[5.0] def self.up create_table :bookmarks do |t| t.integer :user_id, index: true, null: false diff --git a/db/migrate/20170301125839_add_polymorphic_type_to_bookmarks.blacklight.rb b/db/migrate/20170301125839_add_polymorphic_type_to_bookmarks.blacklight.rb index be9f730..0666f2f 100644 --- a/db/migrate/20170301125839_add_polymorphic_type_to_bookmarks.blacklight.rb +++ b/db/migrate/20170301125839_add_polymorphic_type_to_bookmarks.blacklight.rb @@ -1,6 +1,6 @@ # This migration comes from blacklight (originally 20140320000000) # frozen_string_literal: true -class AddPolymorphicTypeToBookmarks < ActiveRecord::Migration +class AddPolymorphicTypeToBookmarks < ActiveRecord::Migration[5.0] def change add_column(:bookmarks, :document_type, :string) unless Bookmark.connection.column_exists? :bookmarks, :document_type diff --git a/db/migrate/20170301125841_add_devise_guests_to_users.rb b/db/migrate/20170301125841_add_devise_guests_to_users.rb index 445a7d1..2380aaa 100644 --- a/db/migrate/20170301125841_add_devise_guests_to_users.rb +++ b/db/migrate/20170301125841_add_devise_guests_to_users.rb @@ -1,4 +1,4 @@ -class AddDeviseGuestsToUsers < ActiveRecord::Migration +class AddDeviseGuestsToUsers < ActiveRecord::Migration[5.0] def self.up change_table(:users) do |t| ## Database authenticatable @@ -12,4 +12,4 @@ def self.down # model already existed. Please edit below which fields you would like to remove in this migration. raise ActiveRecord::IrreversibleMigration end -end \ No newline at end of file +end diff --git a/db/migrate/20170314101550_cas_users.rb b/db/migrate/20170314101550_cas_users.rb index 6073f3c..8c8d5d0 100644 --- a/db/migrate/20170314101550_cas_users.rb +++ b/db/migrate/20170314101550_cas_users.rb @@ -1,4 +1,4 @@ -class CasUsers < ActiveRecord::Migration +class CasUsers < ActiveRecord::Migration[5.0] def self.up add_column :users, :username, :string add_index :users, :username, :unique => true diff --git a/db/migrate/20170314101640_cas_username.rb b/db/migrate/20170314101640_cas_username.rb index 5245b49..0cca662 100644 --- a/db/migrate/20170314101640_cas_username.rb +++ b/db/migrate/20170314101640_cas_username.rb @@ -1,4 +1,4 @@ -class CasUsername < ActiveRecord::Migration +class CasUsername < ActiveRecord::Migration[5.0] def change change_table :users do |t| t.string :fullname