Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Commit

Permalink
fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Cory Lown committed Oct 28, 2019
2 parents e82fcc0 + 7900778 commit a522b16
Show file tree
Hide file tree
Showing 15 changed files with 227 additions and 93 deletions.
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ GEM
ast (2.4.0)
autoprefixer-rails (9.5.1.1)
execjs
bcrypt (3.1.12)
bcrypt (3.1.13)
better_errors (2.1.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
Expand Down Expand Up @@ -119,10 +119,10 @@ GEM
crass (1.0.4)
deprecation (1.0.0)
activesupport
devise (4.6.1)
devise (4.7.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-guests (0.7.0)
Expand Down Expand Up @@ -231,9 +231,9 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
responders (2.4.1)
actionpack (>= 4.2.0, < 6.0)
railties (>= 4.2.0, < 6.0)
responders (3.0.0)
actionpack (>= 5.0)
railties (>= 5.0)
retriable (3.1.2)
rsolr (2.2.1)
builder (>= 2.1.2)
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/advanced_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class AdvancedController < CatalogController
# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
def index
return if request.method == :post

Expand All @@ -21,6 +22,7 @@ def index
end
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength

private

Expand Down
31 changes: 29 additions & 2 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,30 @@ class CatalogController < ApplicationController
# so we can add it again in the last position.
isbn_issn = config.search_fields.delete('isbn_issn')

config.add_search_field('origin_place') do |field|
field.include_in_simple_select = false
field.label = I18n.t('trln_argon.search_fields.origin_place')
field.def_type = 'edismax'
field.solr_local_parameters = {
qf: %w[origin_place_search_t^20
origin_place_search_ara_v
origin_place_search_cjk_v
origin_place_search_rus_v].join(' '),
pf: %w[origin_place_search_t^80
origin_place_search_ara_v^20
origin_place_search_cjk_v^20
origin_place_search_rus_v^20].join(' '),
pf3: %w[origin_place_search_t^60
origin_place_search_ara_v^10
origin_place_search_cjk_v^10
origin_place_search_rus_v^10].join(' '),
pf2: %w[origin_place_search_t^40
origin_place_search_ara_v^5
origin_place_search_cjk_v^5
origin_place_search_rus_v^5].join(' ')
}
end

config.add_search_field('series_statement') do |field|
field.include_in_simple_select = false
field.label = I18n.t('trln_argon.search_fields.series')
Expand Down Expand Up @@ -229,8 +253,11 @@ class CatalogController < ApplicationController
config.add_search_field(isbn_issn)

config.add_show_field TrlnArgon::Fields::LOCAL_ID.to_s,
label: 'System ID',
helper_method: 'strip_duke_id_prefix'
label: TrlnArgon::Fields::LOCAL_ID.label,
helper_method: :strip_duke_id_prefix
config.add_show_field TrlnArgon::Fields::DONOR.to_s,
label: TrlnArgon::Fields::DONOR.label,
helper_method: :add_donor_span

config.show_fields[TrlnArgon::Fields::NOTE_LOCAL]
.helper_method = :add_bookplate_span
Expand Down
6 changes: 6 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ def add_bookplate_span(options = {})
end.join('<br/>').html_safe
end

def add_donor_span(options = {})
options.fetch(:value, []).map do |v|
content_tag(:span, v, class: 'dul-bookplate')
end.join('<br/>').html_safe
end

private

def bookplate_regex
Expand Down
15 changes: 12 additions & 3 deletions app/helpers/request_digitization_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

module RequestDigitizationHelper
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/PerceivedComplexity
def show_request_digitization_link?(document)
DulArgonSkin.request_digitization_url.present? &&
document.present? &&
document.record_owner == 'duke' &&
display_items?(document: document) &&
meets_publication_year_requirement?(document) &&
meets_resource_type_requirement?(document) &&
meets_location_requirement?(document)
meets_location_requirement?(document) &&
meets_physical_media_requirement?(document)
end
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/PerceivedComplexity

def request_digitization_url(document)
request_digitization_url_template.expand(
Expand All @@ -38,15 +41,21 @@ def meets_location_requirement?(document)
loc_b_codes = document.holdings.keys
loc_n_codes = document.holdings.map { |_, v| v.keys }.flatten

(DulArgonSkin.req_digi_loc_b_codes.split(', ') & loc_b_codes).any? ||
(DulArgonSkin.req_digi_loc_n_codes.split(', ') & loc_n_codes).any?
(DulArgonSkin.req_digi_loc_b_codes & loc_b_codes).any? ||
(DulArgonSkin.req_digi_loc_n_codes & loc_n_codes).any?
end

def meets_publication_year_requirement?(document)
pub_year = document.fetch(TrlnArgon::Fields::PUBLICATION_YEAR, '0')
pub_year.to_i < Time.now.year - 75
end

def meets_physical_media_requirement?(document)
physical_media_types = document.fetch(TrlnArgon::Fields::PHYSICAL_MEDIA, [])
physical_media_types.include?('Print') &&
physical_media_types.select { |m| m.match?(/Microform/) }.none?
end

def meets_resource_type_requirement?(document)
resource_types = document.fetch(TrlnArgon::Fields::RESOURCE_TYPE, [])
(resource_types &
Expand Down
22 changes: 0 additions & 22 deletions config/initializers/dul_argon_skin.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,2 @@
# frozen_string_literal: true
require 'dul_argon_skin'

DulArgonSkin.configure do |config|
# Configs unique to local skin, separate from TrlnArgon
config.about_url = ENV['ABOUT_URL']
config.dul_home_url = ENV['DUL_HOME_URL']
config.environment_alert = ENV['ENVIRONMENT_ALERT']
config.google_analytics_debug = ENV['GOOGLE_ANALYTICS_DEBUG']
config.google_analytics_tracking_id = ENV['GOOGLE_ANALYTICS_TRACKING_ID']
config.illiad_dul_base_url = ENV['ILLIAD_DUL_BASE_URL']
config.illiad_law_base_url = ENV['ILLIAD_LAW_BASE_URL']
config.illiad_ford_base_url = ENV['ILLIAD_FORD_BASE_URL']
config.illiad_med_base_url = ENV['ILLIAD_MED_BASE_URL']
config.map_location_service_url = ENV['MAP_LOCATION_SERVICE_URL']
config.online_loc_b_codes = ENV['ONLINE_LOC_B_CODES'].split(', ')
config.online_loc_n_codes = ENV['ONLINE_LOC_N_CODES'].split(', ')
config.report_missing_item_url = ENV['REPORT_MISSING_ITEM_URL']
config.request_base_url = ENV['REQUEST_BASE_URL']
config.request_digitization_url = ENV['REQUEST_DIGITIZATION_URL']
config.req_digi_loc_b_codes = ENV['REQ_DIGI_LOC_B_CODES']
config.req_digi_loc_n_codes = ENV['REQ_DIGI_LOC_N_CODES']
config.search_tips_url = ENV['SEARCH_TIPS_URL']
end
3 changes: 2 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ en:
latest_received:
link_text: "Latest received"
search_fields:
call_number: 'Call Number (LC)'
call_number: 'Call Number'
series: 'Series'
origin_place: 'Place of Publication'
advanced_search:
help:
title: 'Search tips'
Expand Down
16 changes: 13 additions & 3 deletions config/solr_field_overrides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@
# label:
# en: Director

DONOR:
solr_field: :donor_a
label:
en: Bookplate
LC_CALL_NOS_NORMED:
solr_field: :lc_call_nos_normed_a
label:
en: LCC Normed
LOCAL_ID:
solr_field: :local_id
label:
en: System ID
TITLE_MAIN_INDEXED:
solr_field: :title_main_indexed_t
label:
Expand All @@ -20,6 +28,8 @@ SHELFKEY:
label:
en: Shelfkey
SHELF_NUMBERS:
solr_field: shelf_numbers_tp
label:
en: Shelf Number
solr_field: shelf_numbers_tp
label:
en: Shelf Number


38 changes: 20 additions & 18 deletions lib/dul_argon_skin/configurable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,94 +6,96 @@ module Configurable
# rubocop:disable Metrics/BlockLength
included do
mattr_accessor :dul_home_url do
ENV['DUL_HOME_URL'] ||= 'https://library.duke.edu'
ENV['DUL_HOME_URL'] || 'https://library.duke.edu'
end

# If present this string will display in a banner alert
# at the top of each page to indicate which environment
# the application is running in. Banner alert NOT shown if blank.
mattr_accessor :environment_alert do
ENV['ENVIRONMENT_ALERT'] ||= ''
ENV['ENVIRONMENT_ALERT'] || ''
end

# If 'true', output the data being sent to Google Analytics in
# the browser console.
mattr_accessor :google_analytics_debug do
ENV['GOOGLE_ANALYTICS_DEBUG'] ||= 'false'
ENV['GOOGLE_ANALYTICS_DEBUG'] || 'false'
end

# If tracking ID is present, activate Google Analytics tracking
# and use that ID.
mattr_accessor :google_analytics_tracking_id do
ENV['GOOGLE_ANALYTICS_TRACKING_ID'] ||= ''
ENV['GOOGLE_ANALYTICS_TRACKING_ID'] || ''
end

# ILLiad base URLs for DUL & professional school libraries.
# =========================================================
mattr_accessor :illiad_dul_base_url do
ENV['ILLIAD_DUL_BASE_URL'] ||= 'https://duke-illiad-oclc-org.proxy.lib.duke.edu/illiad/NDD/illiad.dll'
ENV['ILLIAD_DUL_BASE_URL'] || 'https://duke-illiad-oclc-org.proxy.lib.duke.edu/illiad/NDD/illiad.dll'
end

mattr_accessor :illiad_law_base_url do
ENV['ILLIAD_LAW_BASE_URL'] ||= 'https://duke-illiad-oclc-org.proxy.lib.duke.edu/illiad/NDL/illiad.dll'
ENV['ILLIAD_LAW_BASE_URL'] || 'https://duke-illiad-oclc-org.proxy.lib.duke.edu/illiad/NDL/illiad.dll'
end

mattr_accessor :illiad_ford_base_url do
ENV['ILLIAD_FORD_BASE_URL'] ||= 'https://duke-illiad-oclc-org.proxy.lib.duke.edu/illiad/NDB/illiad.dll'
ENV['ILLIAD_FORD_BASE_URL'] || 'https://duke-illiad-oclc-org.proxy.lib.duke.edu/illiad/NDB/illiad.dll'
end

mattr_accessor :illiad_med_base_url do
ENV['ILLIAD_MED_BASE_URL'] ||= 'https://illiad.mclibrary.duke.edu/illiad.dll'
ENV['ILLIAD_MED_BASE_URL'] || 'https://illiad.mclibrary.duke.edu/illiad.dll'
end

mattr_accessor :map_location_service_url do
ENV['MAP_LOCATION_SERVICE_URL'] ||= 'https://library.duke.edu/locguide/mapinfo'
ENV['MAP_LOCATION_SERVICE_URL'] || 'https://library.duke.edu/locguide/mapinfo'
end

# Broad and narrow location codes that indicate online items.
# =========================================================
mattr_accessor :online_loc_b_codes do
ENV['ONLINE_LOC_B_CODES'] ||= 'ONLINE, DUKIR'
(ENV['ONLINE_LOC_B_CODES'] || 'ONLINE, DUKIR').split(', ')
end

mattr_accessor :online_loc_n_codes do
ENV['ONLINE_LOC_N_CODES'] ||= 'FRDE, database, LINRE, PEI, PENTL, MELEC'
(ENV['ONLINE_LOC_N_CODES'] ||
'FRDE, database, LINRE, PEI, PENTL, MELEC').split(', ')
end

# Report missing item URL template
mattr_accessor :report_missing_item_url do
ENV['REPORT_MISSING_ITEM_URL'] ||=
ENV['REPORT_MISSING_ITEM_URL'] ||
'https://duke.qualtrics.com/jfe/form/SV_71J91hwAk1B5YkR/{?query*}'
end

# Request System base URL.
mattr_accessor :request_base_url do
ENV['REQUEST_BASE_URL'] ||= 'https://requests.library.duke.edu'
ENV['REQUEST_BASE_URL'] || 'https://requests.library.duke.edu'
end

# Digitization request configurations
# =========================================================
mattr_accessor :request_digitization_url do
ENV['REQUEST_DIGITIZATION_URL'] ||=
ENV['REQUEST_DIGITIZATION_URL'] ||
'https://duke.qualtrics.com/jfe/form/SV_9MOS64T5GlJ5bY9{?query*}'
end

mattr_accessor :req_digi_loc_b_codes do
ENV['REQ_DIGI_LOC_B_CODES'] ||= 'PERKN, LILLY, MARIN, MUSIC, DOCS'
(ENV['REQ_DIGI_LOC_B_CODES'] ||
'PERKN, LILLY, MARIN, MUSIC, DOCS').split(', ')
end

mattr_accessor :req_digi_loc_n_codes do
ENV['REQ_DIGI_LOC_N_CODES'] ||= 'PSB, PSL, PSK, PSM'
(ENV['REQ_DIGI_LOC_N_CODES'] || 'PSB, PSL, PSK, PSM').split(', ')
end

# Search tips URL.
mattr_accessor :search_tips_url do
ENV['SEARCH_TIPS_URL'] ||= 'https://library.duke.edu/using/catalog-search-tips'
ENV['SEARCH_TIPS_URL'] || 'https://library.duke.edu/using/catalog-search-tips'
end

# About URL.
mattr_accessor :about_url do
ENV['ABOUT_URL'] ||= 'https://blogs.library.duke.edu/bitstreams/2019/01/07/new-duke-libraries-catalog-to-go-live-january-16/'
ENV['ABOUT_URL'] || 'https://blogs.library.duke.edu/bitstreams/2019/01/07/new-duke-libraries-catalog-to-go-live-january-16/'
end
end
# rubocop:enable Metrics/BlockLength
Expand Down
2 changes: 1 addition & 1 deletion lib/dul_argon_skin/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module DulArgonSkin
VERSION = '1.5.8'
VERSION = '1.6.0'
end
Loading

0 comments on commit a522b16

Please sign in to comment.