Skip to content

Commit

Permalink
Merge branch 'main' into blac-682-adjust-collection-level-heading
Browse files Browse the repository at this point in the history
  • Loading branch information
yetti authored May 13, 2024
2 parents 242d7df + d345a5f commit 01b9a39
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -673,4 +673,4 @@ RUBY VERSION
ruby 3.2.2p53

BUNDLED WITH
2.5.6
2.5.10
1 change: 1 addition & 0 deletions app/components/arclight/header_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<%= top_bar %>
<div class="<%= helpers.container_classes %>">
<%= render GlobalMessageComponent.new %>
<%= render "shared/email_2fa_alert" %>
</div>
<%= search_bar %>
</header>
3 changes: 2 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def storable_location?

# Some parts of the application are not suitable for storing the location
def is_a_storable_controller_action?
!is_a?(Users::SessionsController) && # ignore login requests
!is_a?(Email2faAlertController) && # ignore email 2fa alert requests
!is_a?(Users::SessionsController) && # ignore login requests
!is_a?(Users::OmniauthCallbacksController) # ignore login requests to Keycloak
end

Expand Down
42 changes: 42 additions & 0 deletions app/javascript/controllers/email_2fa_alert_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Controller } from "@hotwired/stimulus"

// Connects to data-controller="email-2fa-alert"
export default class extends Controller {
static values = {
url: String,
dismissUrl: String
}

connect() {
this.fetchContent()
}

fetchContent() {
fetch(this.urlValue)
.then(response => {
if (response.ok) {
response.text().then((text) => this.element.innerHTML = text)
} else {
this.element.innerHTML = "An error occurred."
}
})
.catch((_error) => {
this.element.innerHTML = "An error occurred."
})
}

dismiss() {
fetch(this.dismissUrlValue)
.then(response => {
if (response.ok) {
console.log("dismissed")
this.fetchContent()
} else {
this.element.innerHTML = "An error occurred."
}
})
.catch((_error) => {
this.element.innerHTML = "An error occurred."
})
}
}
3 changes: 3 additions & 0 deletions app/javascript/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@

import { application } from "./application"

import Email2faAlertController from "./email_2fa_alert_controller"
application.register("email-2fa-alert", Email2faAlertController)

import HelloController from "./hello_controller"
application.register("hello", HelloController)
2 changes: 1 addition & 1 deletion app/models/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SolrDocument
attribute :bibid, :string, "bibid_ssi"

def collection_identifier
[self["level_ssm"]&.join(" "), self["unitid_ssm"]&.join(" ")].compact.join(", ")
[self["level_ssm"]&.join(" "), self["unitid_ssm"]&.join(" ")].compact.join(" ")
end

# self.unique_key = 'id'
Expand Down
12 changes: 6 additions & 6 deletions config/locales/arclight.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ en:
collectionnumber: Collection number


collectionidentifier: Collection Identifier
collectionidentifier: Component identifier
scopecontent: Scope and content
bioghist: Biographical / historical
acqinfo: Acquisition information
acqinfo: Immediate source of acquisition
appraisal: Appraisal information
custodhist: Custodial history
processinfo: Processing information
Expand All @@ -30,8 +30,8 @@ en:
relatedmaterial: Related material
separatedmaterial: Separated material
otherfindaid: Other finding aids
altformavail: Alternative form available
originalsloc: Location of originals
altformavail: Existence and location of copies
originalsloc: Existence and location of originals

access_subjects: Subjects
names_coll: Names
Expand All @@ -40,8 +40,8 @@ en:
containers: Containers
names: Names

restrictions: Restrictions
terms: Terms of access
restrictions: Conditions governing access
terms: Conditions governing use
parent_restrictions: Parent restrictions
parent_terms: Parent terms of access
repository_location: Location of this collection
Expand Down
74 changes: 74 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,74 @@
# == Route Map
#
# Prefix Verb URI Pattern Controller#Action
# blacklight /finding-aids Blacklight::Engine
# arclight_engine /finding-aids Arclight::Engine
# yabeda_prometheus_exporter /finding-aids/metrics Yabeda::Prometheus::Exporter
# search_catalog GET|POST /finding-aids/catalog(.:format) catalog#index
# advanced_search_catalog GET /finding-aids/catalog/advanced(.:format) catalog#advanced_search
# page_links_catalog GET /finding-aids/catalog/page_links(.:format) catalog#page_links
# track_catalog POST /finding-aids/catalog/:id/track(.:format) catalog#track
# raw_catalog GET /finding-aids/catalog/:id/raw(.:format) catalog#raw {:format=>"json"}
# opensearch_catalog GET /finding-aids/catalog/opensearch(.:format) catalog#opensearch
# suggest_index_catalog GET /finding-aids/catalog/suggest(.:format) catalog#suggest
# facet_catalog GET /finding-aids/catalog/facet/:id(.:format) catalog#facet
# range_limit_catalog GET /finding-aids/catalog/range_limit(.:format) catalog#range_limit
# GET /finding-aids/catalog/range_limit_panel/:id(.:format) catalog#range_limit_panel
# hierarchy_solr_document GET /finding-aids/catalog/:id/hierarchy(.:format) catalog#hierarchy
# email_solr_document GET|POST /finding-aids/catalog/:id/email(.:format) catalog#email
# sms_solr_document GET|POST /finding-aids/catalog/:id/sms(.:format) catalog#sms
# citation_solr_document GET /finding-aids/catalog/:id/citation(.:format) catalog#citation
# email_solr_documents GET|POST /finding-aids/catalog/email(.:format) catalog#email
# sms_solr_documents GET|POST /finding-aids/catalog/sms(.:format) catalog#sms
# citation_solr_documents GET /finding-aids/catalog/citation(.:format) catalog#citation
# solr_document GET /finding-aids/catalog/:id(.:format) catalog#show
# email_bookmark GET|POST /finding-aids/bookmarks/:id/email(.:format) bookmarks#email
# sms_bookmark GET|POST /finding-aids/bookmarks/:id/sms(.:format) bookmarks#sms
# citation_bookmark GET /finding-aids/bookmarks/:id/citation(.:format) bookmarks#citation
# email_bookmarks GET|POST /finding-aids/bookmarks/email(.:format) bookmarks#email
# sms_bookmarks GET|POST /finding-aids/bookmarks/sms(.:format) bookmarks#sms
# citation_bookmarks GET /finding-aids/bookmarks/citation(.:format) bookmarks#citation
# clear_bookmarks DELETE /finding-aids/bookmarks/clear(.:format) bookmarks#clear
# bookmarks GET /finding-aids/bookmarks(.:format) bookmarks#index
# POST /finding-aids/bookmarks(.:format) bookmarks#create
# new_bookmark GET /finding-aids/bookmarks/new(.:format) bookmarks#new
# edit_bookmark GET /finding-aids/bookmarks/:id/edit(.:format) bookmarks#edit
# bookmark GET /finding-aids/bookmarks/:id(.:format) bookmarks#show
# PATCH /finding-aids/bookmarks/:id(.:format) bookmarks#update
# PUT /finding-aids/bookmarks/:id(.:format) bookmarks#update
# DELETE /finding-aids/bookmarks/:id(.:format) bookmarks#destroy
# email_2fa_enable GET /finding-aids/email_2fa/enable(.:format) email2fa#enable
# email_2fa_disable GET /finding-aids/email_2fa/disable(.:format) email2fa#disable
# email_2fa_alert GET /finding-aids/email_2fa/alert(.:format) email2fa_alert#show
# email_2fa_alert_dismiss GET /finding-aids/email_2fa/alert/dismiss(.:format) email2fa_alert#dismiss
# root GET /finding-aids(.:format) catalog#index {:f=>{:level=>["Collection"], :repository=>["National Library of Australia"]}}
# GET / redirect(301, /finding-aids)
# user_catalogue_patron_omniauth_authorize GET|POST /users/auth/catalogue_patron(.:format) users/omniauth_callbacks#passthru
# user_catalogue_patron_omniauth_callback GET|POST /users/auth/catalogue_patron/callback(.:format) users/omniauth_callbacks#catalogue_patron
# user_catalogue_sol_omniauth_authorize GET|POST /users/auth/catalogue_sol(.:format) users/omniauth_callbacks#passthru
# user_catalogue_sol_omniauth_callback GET|POST /users/auth/catalogue_sol/callback(.:format) users/omniauth_callbacks#catalogue_sol
# user_catalogue_spl_omniauth_authorize GET|POST /users/auth/catalogue_spl(.:format) users/omniauth_callbacks#passthru
# user_catalogue_spl_omniauth_callback GET|POST /users/auth/catalogue_spl/callback(.:format) users/omniauth_callbacks#catalogue_spl
# user_catalogue_shared_omniauth_authorize GET|POST /users/auth/catalogue_shared(.:format) users/omniauth_callbacks#passthru
# user_catalogue_shared_omniauth_callback GET|POST /users/auth/catalogue_shared/callback(.:format) users/omniauth_callbacks#catalogue_shared
# new_user_session GET /sign_in(.:format) users/sessions#new
# destroy_user_session DELETE /sign_out(.:format) users/sessions#destroy
# logout GET /logout(.:format) users/sessions#destroy
# expired_keycloak_logout GET /expired_keycloak_logout(.:format) users/sessions#expired_keycloak_logout
# backchannel_logout POST /backchannel_logout(.:format) users/sessions#backchannel_logout
# turbo_recede_historical_location GET /recede_historical_location(.:format) turbo/native/navigation#recede
# turbo_resume_historical_location GET /resume_historical_location(.:format) turbo/native/navigation#resume
# turbo_refresh_historical_location GET /refresh_historical_location(.:format) turbo/native/navigation#refresh
#
# Routes for Blacklight::Engine:
# search_history GET /search_history(.:format) search_history#index
# clear_search_history DELETE /search_history/clear(.:format) search_history#clear
#
# Routes for Arclight::Engine:
# collections GET /collections(.:format) catalog#index {:f=>{:level=>["Collection"]}}
# repositories GET /repositories(.:format) arclight/repositories#index
# repository GET /repositories/:id(.:format) arclight/repositories#show

Rails.application.routes.draw do
scope(path: "/finding-aids") do
mount Blacklight::Engine => "/"
Expand All @@ -8,6 +79,7 @@
concern :exportable, Blacklight::Routes::Exportable.new
concern :hierarchy, Arclight::Routes::Hierarchy.new
concern :range_searchable, BlacklightRangeLimit::Routes::RangeSearchable.new
concern :email2fa, Nla::BlacklightCommon::Routes::Email2fa.new

resource :catalog, only: [:index], as: "catalog", path: "/catalog", controller: "catalog" do
concerns :searchable
Expand All @@ -27,6 +99,8 @@
end
end

concerns :email2fa

# Show repostories with information about each
# root to: "arclight/repositories#index"

Expand Down
22 changes: 11 additions & 11 deletions db/patrons_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@

ActiveRecord::Schema[7.0].define(version: 2023_04_26_043927) do
create_table "accounts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "user_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "user_id", null: false
t.index ["user_id"], name: "index_accounts_on_user_id"
end

create_table "sessions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "session_id", null: false
t.text "data"
t.datetime "created_at", null: false
t.text "data"
t.string "session_id", null: false
t.datetime "updated_at", null: false
t.index ["session_id"], name: "index_sessions_on_session_id", unique: true
t.index ["updated_at"], name: "index_sessions_on_updated_at"
end

create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "folio_id"
t.bigint "patron_id"
t.bigint "voyager_id"
t.string "name_given"
t.string "name_family"
t.boolean "active", default: true, null: false
t.datetime "created_at", null: false
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "folio_id"
t.string "name_family"
t.string "name_given"
t.bigint "patron_id"
t.string "provider"
t.string "session_token"
t.string "uid"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "active", default: true, null: false
t.string "session_token"
t.bigint "voyager_id"
t.index ["folio_id"], name: "index_users_on_folio_id", unique: true
end

Expand Down
10 changes: 5 additions & 5 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/models/solr_document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

it "joins them with a comma" do
expect(collection_identifier_value).to eq "level1 level2, unit1 unit2"
expect(collection_identifier_value).to eq "level1 level2 unit1 unit2"
end
end

Expand Down

0 comments on commit 01b9a39

Please sign in to comment.