Skip to content

Commit

Permalink
Merge branch 'release/1.15'
Browse files Browse the repository at this point in the history
  • Loading branch information
peichman-umd committed Jun 3, 2024
2 parents 6ce4eac + 792773c commit 0e1dc28
Show file tree
Hide file tree
Showing 139 changed files with 1,740 additions and 1,859 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ coverage
/*.key

# Ignore published vocabularies
# While the "published_vocabularies" directory has been removed, leaving this
# ignore specification in place to eliminate any possibility of the directory
# contents being accidentally added to a Docker image.
/public/published_vocabularies/*.json
/public/published_vocabularies/*.ttl
/public/published_vocabularies/*.nt
Expand Down
24 changes: 22 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
# Entries in this file OVERRIDE entries in the ".env" file.
#
# This file is provides default values for non-workstation-specific,
# non-secret environment variables for use in a development environment
# consisting of Archelon running in a Docker container
# and Plastron on a local workstation.
#
# Workstation-specific or private/secret environment variable settings should
# be made in the ".env" file (which is generated from the "env_example" template
# file).

# --- config/blacklight.yml
SOLR_URL=http://solr-fedora4:8983/solr/fedora4

# --- config/environments/*.rb
FCREPO_BASE_URL=http://repository:8080/fcrepo/rest/
FCREPO_BASE_URL=http://fcrepo-local:8080/fcrepo/rest

# --- config/environments/*.rb
# base URL of the IIIF server (which serves the manifests, images, and viewer)
Expand All @@ -16,6 +27,11 @@ MIRADOR_STATIC_VERSION=1.3.0
# This should include the entire URL except for the token
RETRIEVE_BASE_URL=http://archelon-local:3000/retrieve/

# The base URL (including a trailing slash) for the handle proxy server
# associated with this application.
# For example: "https://hdl-test.lib.umd.edu/"
HANDLE_HTTP_PROXY_BASE=http://hdl-local/

# --- config/ldap.yml
LDAP_HOST=directory.umd.edu
LDAP_PORT=636
Expand Down Expand Up @@ -47,4 +63,8 @@ ARCHELON_DATABASE_ADAPTER=sqlite3
ARCHELON_DATABASE_NAME=db/development.sqlite3
ARCHELON_DATABASE_POOL=5

PLASTRON_REST_BASE_URL=http://plastrond-http:5000/
# --- config/imports.yml
IMPORT_BINARIES_BASE_LOCATION=zip:../../archelon/imports

# --- config/initializers/plastron.rb
PLASTRON_REST_BASE_URL=http://docker.for.mac.localhost:5000/
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ coverage
/*.pem
/*.key

# Ignore published vocabularies
/public/published_vocabularies/*.json
/public/published_vocabularies/*.ttl
/public/published_vocabularies/*.nt

# Ignore the imports and exports
/imports/*.zip
/exports/*.zip
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ group :test do
gem 'rspec'
gem 'rspec-mocks', '~> 3.8.1'

gem 'webmock', '~> 3.23.0'

# Note: The "action-cable-testing" gem can be removed when migrating to
# Rails 6, as the gem is already included as part of Rails 6.
gem 'action-cable-testing'
Expand Down
11 changes: 11 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ GEM
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
base64 (0.2.0)
bigdecimal (3.1.7)
bindex (0.8.1)
blacklight (6.23.0)
bootstrap-sass (~> 3.2)
Expand Down Expand Up @@ -102,6 +103,9 @@ GEM
coffee-script-source (1.12.2)
concurrent-ruby (1.1.10)
connection_pool (2.2.3)
crack (1.0.0)
bigdecimal
rexml
crass (1.0.6)
delayed_cron_job (0.8.0)
delayed_job (>= 4.1)
Expand Down Expand Up @@ -143,6 +147,7 @@ GEM
activesupport (>= 5.0)
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashdiff (1.1.0)
hashie (5.0.0)
htmlentities (4.3.4)
http (5.2.0)
Expand Down Expand Up @@ -314,6 +319,7 @@ GEM
tilt
ref (2.0.0)
regexp_parser (1.7.0)
rexml (3.2.6)
rsolr (2.3.0)
builder (>= 2.1.2)
faraday (>= 0.9.0)
Expand Down Expand Up @@ -416,6 +422,10 @@ GEM
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
webmock (3.23.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webpacker (5.4.0)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
Expand Down Expand Up @@ -489,6 +499,7 @@ DEPENDENCIES
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
webdrivers
webmock (~> 3.23.0)
webpacker
will_paginate (~> 3.1.0)
will_paginate-bootstrap (~> 1.0.0)
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ functionality.
2. Create a `.env` file from the `env_example` file, and adding these environment variables:
- LDAP_BIND_PASSWORD (Obtained from LastPass)
- FCREPO_AUTH_TOKEN (Obtained from generating a JWT token from the local fcrepo stack)
- PLASTRON_REST_BASE_URL=docker.for.mac.localhost:5000/
3. Run yarn install
```bash
Expand Down Expand Up @@ -262,6 +261,15 @@ The batch export functionality relies on a running [Plastron] instance.
See [BatchImport](docs/BatchImport.md).
## Content Model Definitions
See [ContentModelDefinitions](docs/ContentModelDefinitions.md).
## Vocabulary
For information about the controlled vocabularies used when editing metadata,
see [Vocabulary](docs/Vocabulary.md).
## LDAP Override
By default, Archelon determines the user type for a user ("admin", "user" or
Expand Down
3 changes: 0 additions & 3 deletions app/assets/javascripts/datatypes.coffee

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/javascripts/individuals.coffee

This file was deleted.

23 changes: 23 additions & 0 deletions app/assets/javascripts/select_button_item_view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2011-2018, The Trustees of Indiana University and Northwestern
// University. Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
//
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
// --- END LICENSE_HEADER BLOCK ---

$(document).ready(() => {
sel_div = $("#item-select-view")
max_sel = sel_div.data('max-selection-count')
sel_count = sel_div.data('current-selection-count')
if (max_sel <= sel_count) {
$("input.toggle_bookmark:not(:checked)").attr("disabled", "disabled")
}
return
})
3 changes: 0 additions & 3 deletions app/assets/javascripts/types.coffee

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/javascripts/vocabularies.coffee

This file was deleted.

25 changes: 25 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,28 @@ footer {
.tab-content {
margin-bottom: 15px;
}

// Styling for select box on the item detail page
.item-select-view .checkbox {
min-height: 0 !important;
}

.item-select-view input {
margin-top: 4px !important;
margin-left: -15px !important;
transform: scale(1.5);
}

.item-select-view .btn-primary:hover {
border-color: #c91010 !important;
cursor: inherit !important;
}

.item-select-view .btn-primary:active {
background-image: linear-gradient(#ec1515, #c91010 60%, #b60e0e);
border-color: #c91010 !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
cursor: inherit !important;
text-decoration: none;
}
8 changes: 0 additions & 8 deletions app/assets/stylesheets/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,6 @@ input {
color: #4C4C4C;
}

.panel-vocabulary {
margin-top: 10px;
}

.panel-vocabulary .h2 {
margin: 5px;
}

/* Tooltip from https://www.w3schools.com/howto/howto_css_tooltip.asp */
/* Renamed to "umd_tooltip" to avoid conflict with "tooltip" definitions in other CSS includes */
/* Tooltip container */
Expand Down
3 changes: 0 additions & 3 deletions app/assets/stylesheets/datatypes.scss

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/stylesheets/individuals.scss

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/stylesheets/types.scss

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/stylesheets/vocabularies.scss

This file was deleted.

5 changes: 5 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ class ApplicationController < ActionController::Base
layout 'blacklight'
skip_after_action :discard_flash_if_xhr

def solr_connection_error(err)
Rails.logger.error(err.message)
flash[:error] = I18n.t(:solr_is_down)
end

# Causes a "404 - Not Found" error page to be displayed.
def not_found
render file: Rails.root.join('public', '404.html'), status: :not_found, layout: false
Expand Down
23 changes: 20 additions & 3 deletions app/controllers/bookmarks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,23 @@ class BookmarksController < CatalogController
add_show_tools_partial(:publish_job, path: :new_publish_job_url, modal: false, label: 'Publish')
add_show_tools_partial(:unpublish_job, path: :new_unpublish_job_url, modal: false, label: 'Unpublish')

def create
if current_user.bookmarks.count >= max_limit
if request.xhr?
render(json: "Max selection limit reached: #{max_limit}", status: :forbidden)
else
flash[:error] = "Max selection limit reached: #{max_limit}"
redirect_back fallback_location: bookmarks_path
end
return
end
super
end

def toggle_multiple_selections # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
item_ids = params.fetch(:document_ids, []).uniq
if params[:mode] == 'select'
limit_exceeded = (item_ids.length + current_user.bookmarks.count) > 1000
limit_exceeded = (item_ids.length + current_user.bookmarks.count) > max_limit
render json: {}, status: :unprocessable_entity && return if limit_exceeded
selected_ids = current_user.bookmarks.map(&:document_id)
missing_ids = item_ids.reject { |doc_id| selected_ids.include?(doc_id) }
Expand All @@ -40,15 +53,15 @@ def toggle_multiple_selections # rubocop:disable Metrics/MethodLength, Metrics/A

def select_all_results # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
search_params = current_search_session.query_params
return redirect_back_to_catalog(params, search_params) unless current_user.bookmarks.count < 1000
return redirect_back_to_catalog(params, search_params) unless current_user.bookmarks.count < max_limit

search_params[:rows] = params[:result_count]
search_params[:exportable_only] = true
(@response, @document_list) = search_results(search_params)
document_ids = @document_list.map(&:id)
selected_ids = current_user.bookmarks.map(&:document_id)
missing_ids = document_ids.reject { |doc_id| selected_ids.include?(doc_id) }
select_ids = missing_ids.take(1000 - current_user.bookmarks.count)
select_ids = missing_ids.take(max_limit - current_user.bookmarks.count)
if select_ids.length.zero?
flash[:notice] = I18n.t(:already_selected)
else
Expand All @@ -70,4 +83,8 @@ def redirect_back_to_catalog(params, search_params)
search_params.delete(:rows)
redirect_to search_catalog_path(search_params)
end

def max_limit
helpers.max_bookmarks_selection_limit
end
end
Loading

0 comments on commit 0e1dc28

Please sign in to comment.