@@ -5,12 +5,16 @@ class PhysicalHoldingsMarkupBuilder < HoldingRequestsBuilder
55
66 # Generate <span> markup used in links for browsing by call numbers
77 # @return [String] the markup
8- def self . call_number_span
8+ def call_number_span
99 %(<span class="link-text">#{ I18n . t ( 'blacklight.holdings.browse' ) } </span>\
1010 <span class="icon-bookslibrary"></span>)
1111 end
1212
13- def self . call_number_link ( holding , cn_value )
13+ ##
14+ # Add call number link
15+ # @param [Hash] holding
16+ # @param [String] cn_value - a call number
17+ def call_number_link ( holding , cn_value )
1418 cn = ''
1519 unless cn_value . nil?
1620 children = call_number_span
@@ -25,7 +29,7 @@ def self.call_number_link(holding, cn_value)
2529 content_tag ( :td , cn . html_safe , class : 'holding-call-number' )
2630 end
2731
28- def self . holding_location_repository
32+ def holding_location_repository
2933 children = content_tag ( :span ,
3034 'On-site access' ,
3135 class : 'availability-icon badge badge-success' ,
@@ -34,15 +38,15 @@ def self.holding_location_repository
3438 content_tag ( :td , children . html_safe )
3539 end
3640
37- def self . holding_location_scsb_span
41+ def holding_location_scsb_span
3842 markup = content_tag ( :span , '' ,
3943 title : '' ,
4044 class : 'availability-icon badge' ,
4145 data : { toggle : 'tooltip' } )
4246 markup
4347 end
4448
45- def self . holding_location_scsb ( holding , bib_id , holding_id )
49+ def holding_location_scsb ( holding , bib_id , holding_id )
4650 content_tag ( :td , holding_location_scsb_span . html_safe ,
4751 class : 'holding-status' ,
4852 data : {
@@ -54,7 +58,7 @@ def self.holding_location_scsb(holding, bib_id, holding_id)
5458 } )
5559 end
5660
57- def self . holding_location_default ( bib_id , holding_id , location_rules )
61+ def holding_location_default ( bib_id , holding_id , location_rules )
5862 children = content_tag ( :span , '' , class : 'availability-icon' )
5963 content_tag ( :td ,
6064 children . html_safe ,
@@ -63,12 +67,12 @@ def self.holding_location_default(bib_id, holding_id, location_rules)
6367 'availability_record' => true ,
6468 'record_id' => bib_id ,
6569 'holding_id' => holding_id ,
66- aeon : aeon_location? ( location_rules )
70+ aeon : self . class . aeon_location? ( location_rules )
6771 } )
6872 end
6973
7074 # For when a holding record has a value for the "dspace" key, but it is set to false
71- def self . holding_location_unavailable
75+ def holding_location_unavailable
7276 children = content_tag ( :span ,
7377 'Unavailable' ,
7478 class : 'availability-icon badge badge-danger' ,
@@ -169,6 +173,10 @@ def self.aeon_location?(location)
169173 location . nil? ? false : location [ :aeon_location ]
170174 end
171175
176+ def aeon_location? ( location )
177+ self . class . aeon_location? ( location )
178+ end
179+
172180 def self . scsb_location? ( location )
173181 location . nil? ? false : /^scsb.+/ =~ location [ 'code' ]
174182 end
@@ -218,7 +226,7 @@ def self.location_services_block(adapter, holding_id, location_rules, link, hold
218226 # Generate a request label based upon the holding location
219227 # @param location_rules [Hash] the location for the holding
220228 # @return [String] the label
221- def self . request_label ( location_rules )
229+ def request_label ( location_rules )
222230 if aeon_location? ( location_rules )
223231 'Reading Room Request'
224232 else
@@ -256,6 +264,10 @@ def self.scsb_supervised_items?(holding)
256264 end
257265 end
258266
267+ def scsb_supervised_items? ( holding )
268+ self . class . scsb_supervised_items? ( holding )
269+ end
270+
259271 ##
260272 def self . listify_array ( arr )
261273 arr = arr . map do |e |
@@ -265,7 +277,8 @@ def self.listify_array(arr)
265277 end
266278
267279 # Generate the links for a given holding
268- def self . request_placeholder ( adapter , holding_id , location_rules , holding )
280+ # TODO: Come back and remove class method calls
281+ def request_placeholder ( adapter , holding_id , location_rules , holding )
269282 doc_id = adapter . doc_id
270283 link = if !location_rules . nil? && /^scsb.+/ =~ location_rules [ 'code' ]
271284 if scsb_supervised_items? ( holding )
@@ -277,7 +290,7 @@ def self.request_placeholder(adapter, holding_id, location_rules, holding)
277290 else
278291 link_to ( request_label ( location_rules ) ,
279292 "/requests/#{ doc_id } " ,
280- title : request_tooltip ( location_rules ) ,
293+ title : self . class . request_tooltip ( location_rules ) ,
281294 class : 'request btn btn-xs btn-primary' ,
282295 data : { toggle : 'tooltip' } )
283296 end
@@ -290,11 +303,11 @@ def self.request_placeholder(adapter, holding_id, location_rules, holding)
290303 else
291304 link_to ( request_label ( location_rules ) ,
292305 "/requests/#{ doc_id } ?mfhd=#{ holding_id } " ,
293- title : request_tooltip ( location_rules ) ,
306+ title : self . class . request_tooltip ( location_rules ) ,
294307 class : 'request btn btn-xs btn-primary' ,
295308 data : { toggle : 'tooltip' } )
296309 end
297- markup = location_services_block ( adapter , holding_id , location_rules , link , holding )
310+ markup = self . class . location_services_block ( adapter , holding_id , location_rules , link , holding )
298311 markup
299312 end
300313
@@ -403,22 +416,21 @@ def process_physical_holding(holding, holding_id)
403416 cn_value
404417 )
405418 end
406- markup << self . class . call_number_link ( holding , cn_value )
419+ markup << call_number_link ( holding , cn_value )
407420 markup << if @adapter . repository_holding? ( holding )
408- self . class . holding_location_repository
421+ holding_location_repository
409422 elsif @adapter . scsb_holding? ( holding ) && !@adapter . empty_holding? ( holding )
410- self . class . holding_location_scsb ( holding , bib_id , holding_id )
423+ holding_location_scsb ( holding , bib_id , holding_id )
411424 # dspace: false
412425 elsif @adapter . unavailable_holding? ( holding )
413- self . class . holding_location_unavailable
426+ holding_location_unavailable
414427 else
415- self . class . holding_location_default ( bib_id ,
416- holding_id ,
417- location_rules )
428+ holding_location_default ( bib_id ,
429+ holding_id ,
430+ location_rules )
418431 end
419432
420- request_placeholder_markup = \
421- self . class . request_placeholder ( @adapter , holding_id , location_rules , holding )
433+ request_placeholder_markup = request_placeholder ( @adapter , holding_id , location_rules , holding )
422434 markup << request_placeholder_markup . html_safe
423435
424436 holding_notes = ''
0 commit comments