-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into i265_banner_flipper
- Loading branch information
Showing
22 changed files
with
133 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails-html-sanitizer' | ||
require 'cgi' | ||
|
||
class Sanitizer < Rails::HTML5::SafeListSanitizer | ||
def sanitize(html, options = {}) | ||
# Add spaces before opening HTML tags, so that words don't run together | ||
# after the tags are removed | ||
with_spaces = html.gsub(/(\S)(<\w)/, '\1 \2') | ||
sanitized = super(with_spaces, options) | ||
sanitized.gsub(' ', ' ').strip | ||
with_spaces = html.to_s.gsub(/(\S)(<\w)/, '\1 \2') | ||
sanitized = super(with_spaces, options).gsub(' ', ' ').strip | ||
CGI.unescapeHTML sanitized | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class AddStaffRecordsFields < ActiveRecord::Migration[7.1] | ||
|
||
def up | ||
change_table :library_staff_records do |t| | ||
t.column :areas_of_study, :string | ||
t.column :other_entities, :string | ||
t.column :my_scheduler_link, :string | ||
t.rename :section, :team | ||
end | ||
end | ||
def down | ||
change_table :library_staff_records do |t| | ||
t.remove :areas_of_study | ||
t.remove :other_entities | ||
t.remove :my_scheduler_link | ||
t.rename :team, :section | ||
end | ||
end | ||
|
||
end |
44 changes: 44 additions & 0 deletions
44
db/migrate/20240716214838_update_searchable_library_staff_records.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
class UpdateSearchableLibraryStaffRecords < ActiveRecord::Migration[7.1] | ||
def up | ||
change_table :library_staff_records do |t| | ||
t.remove :searchable | ||
t.virtual :searchable, type: :tsvector, | ||
as: "to_tsvector('english', coalesce(title, '') || ' ' || " \ | ||
"coalesce(first_name, '') || ' ' || " \ | ||
"coalesce(middle_name, '') || ' ' || " \ | ||
"coalesce(last_name, '') || ' ' || " \ | ||
"coalesce(title, '') || ' ' || " \ | ||
"coalesce(email, '') || ' ' || " \ | ||
"coalesce(department, '') || ' ' || " \ | ||
"coalesce(office, '') || ' ' || " \ | ||
"coalesce(building, '') || ' ' || " \ | ||
"coalesce(team, '') || ' ' || " \ | ||
"coalesce(division, '') || ' ' || " \ | ||
"coalesce(unit, '') || ' ' ||" \ | ||
"coalesce(areas_of_study, '') || ' ' || " \ | ||
"coalesce(other_entities, ''))", | ||
stored: true | ||
t.index ["searchable"], name: "staff_search_idx", using: :gin | ||
end | ||
end | ||
|
||
def down | ||
change_table :library_staff_records do |t| | ||
t.remove :searchable | ||
t.virtual :searchable, type: :tsvector, | ||
as: "to_tsvector('english', coalesce(title, '') || ' ' || " \ | ||
"coalesce(first_name, '') || ' ' || " \ | ||
"coalesce(middle_name, '') || ' ' || " \ | ||
"coalesce(last_name, '') || ' ' || " \ | ||
"coalesce(title, '') || ' ' || " \ | ||
"coalesce(email, '') || ' ' || " \ | ||
"coalesce(department, '') || ' ' || " \ | ||
"coalesce(office, '') || ' ' || " \ | ||
"coalesce(building, '') || ' ' || " \ | ||
"coalesce(team, '') || ' ' || " \ | ||
"coalesce(division, '') || ' ' || " \ | ||
"coalesce(unit, ''))" , | ||
stored: true | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
spec/fixtures/files/library_staff/staff-directory-blank-lines.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
puid,netid,phone,name,lastName,firstName,email,address,building,department,division,unit,team,title,areasOfStudy,websiteUrl,bios,expertise,mySchedulerLink | ||
,,,,,,,,,,,,,,,,,, | ||
"000000001","lucyfs","(555) 123-1234","Stardust, Lucy","Stardust","Lucy Fae",lucyfs@princeton.edu,Forrestal,Recap Library,Office of the Deputy Dean of Libraries,Facilities,,,"Pest Removal Specialist",,,,, | ||
,,,,,,,,,,,,,,,,,, | ||
puid,netid,phone,name,lastName,firstName,email,address,building,department,division,unit,team,title,areasOfStudy,websiteUrl,bios,expertise,mySchedulerLink,otherEntities | ||
,,,,,,,,,,,,,,,,,,, | ||
"000000001","lucyfs","(555) 123-1234","Stardust, Lucy","Stardust","Lucy Fae",lucyfs@princeton.edu,Forrestal,Recap Library,Office of the Deputy Dean of Libraries,Facilities,,,"Pest Removal Specialist",,,,,, | ||
,,,,,,,,,,,,,,,,,,, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
"puid","netid","phone","name","lastName","firstName",email,address,building,department,division,unit,team,"title","areasOfStudy","websiteUrl","bios","expertise","mySchedulerLink" | ||
"000000001","lucyfs","(555) 123-1234","Stardust, Lucy","Stardust","Lucy Fae",lucyfs@princeton.edu,Forrestal,Recap Library,Office of the Deputy Dean of Libraries,Facilities,,,"Pest Removal Specialist",,,,, | ||
"000000002","nimbuskt","(555) 111-1111","Trout, Nimbus","Trout","Nimbus Kilgore",nibmus@princeton.edu,A-200,Firestone Library,Office of the Deputy Dean of Libraries,Information Technology,IT Operations and Digitization,,"Nap Coordinator","Naps//Coordination",,,, | ||
"000000003","tiberius","(555) 222-2222","Adams, Tiberius","Adams","Spot Tiberius",tiberius@princeton.edu,B-300,Firestone Library,My Department,Library - Collections and Access Services,Access & Fulfillment Services,,"Lead Hairball Engineer",,,,, | ||
"000000010","brutus","(555) 222-2222","Cat, Brutus","Cat","Brutus The",brutus@princeton.edu,B-300,Stokes Library,My Department,Library - Collections and Access Services,PCRP - Physical Collections Receipt & Processing Unit,,"Fluffiest cat",,,,, | ||
"puid","netid","phone","name","lastName","firstName",email,address,building,department,division,unit,team,"title","areasOfStudy","websiteUrl","bios","expertise","mySchedulerLink","otherEntities" | ||
"000000001","lucyfs","(555) 123-1234","Stardust, Lucy","Stardust","Lucy Fae",lucyfs@princeton.edu,Forrestal,Recap Library,Office of the Deputy Dean of Libraries,Facilities,,,"Pest Removal Specialist",,,,,,"MS Chadha Center for Global India" | ||
"000000002","nimbuskt","(555) 111-1111","Trout, Nimbus","Trout","Nimbus Kilgore",nibmus@princeton.edu,A-200,Firestone Library,Office of the Deputy Dean of Libraries,Information Technology,IT Operations and Digitization,,"Nap Coordinator","Naps//Coordination",,,,,"Center for Culture, Society and Religion//University Center for Human Values" | ||
"000000003","tiberius","(555) 222-2222","Adams, Tiberius","Adams","Spot Tiberius",tiberius@princeton.edu,B-300,Firestone Library,My Department,Library - Collections and Access Services,Access & Fulfillment Services,,"Lead Hairball Engineer",,,,,,"Center for International Security Studies (CISS)//Center for the Study of Democratic Politics (CSDP)//Empirical Studies of Conflict (ESOC)//Innovations for Successful Societies (ISS)//Liechtenstein Institute on Self-Determination (LISD)//Niehaus Center for lization and Governance (NCGG)//Princeton Survey Research Center (SRC)//Research Program in Political Economy (RPPE)" | ||
"000000010","brutus","(555) 222-2222","Cat, Brutus","Cat","Brutus The",brutus@princeton.edu,B-300,Stokes Library,My Department,Library - Collections and Access Services,PCRP - Physical Collections Receipt & Processing Unit,,"Fluffiest cat",,,,,, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters