Skip to content

Commit

Permalink
Limit marking strings as html_safe
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkadel committed Mar 9, 2023
1 parent ff5f202 commit af00e47
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions app/helpers/holdings_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def holding_block_search(document)
holdings_hash.first(2).each do |id, holding|
location = holding_location(holding)
check_availability = render_availability?
data = ''
data = ''.html_safe
if holding['library'] == 'Online'
check_availability = false
if links.empty?
Expand Down Expand Up @@ -57,13 +57,13 @@ def holding_block_search(document)
# All other options came up empty but since we have electronic access let's show the
# Online badge with the electronic access link (rather than a misleading "No holdings")
data = electronic_access_no_holdings(links)
block << content_tag(:li, data.html_safe)
block << content_tag(:li, data)
end

if block.empty?
content_tag(:div, t('blacklight.holdings.search_missing'))
else
content_tag(:ul, block.html_safe)
content_tag(:ul, block)
end
end

Expand Down Expand Up @@ -97,7 +97,7 @@ def online_holding_block(links)
title: 'Electronic access',
'data-toggle' => 'tooltip'
)
data << links.shift.html_safe
data << links.shift
data
end

Expand All @@ -117,7 +117,7 @@ def dspace_or_numismatics_holding_block(location)
title: 'Items at this location must be requested',
'data-toggle' => 'tooltip',
'aria-hidden' => 'true'
).html_safe
)
end
data
end
Expand Down Expand Up @@ -145,7 +145,7 @@ def scsb_supervised_item_block
title: 'Items at this location must be requested',
'data-toggle' => 'tooltip',
'aria-hidden' => 'true'
).html_safe
)
data
end

Expand All @@ -158,15 +158,15 @@ def scsb_unsupervised_item_block(holding)
'data-scsb-availability' => 'true',
'data-toggle' => 'tooltip',
'data-scsb-barcode' => holding['items'].first['barcode'].to_s
).html_safe
)
end

def dspace_not_defined_block(location)
data = content_tag(
:span,
'Loading...',
class: 'availability-icon badge badge-secondary'
).html_safe
)
if aeon_location?(location)
data << content_tag(
:span,
Expand All @@ -175,7 +175,7 @@ def dspace_not_defined_block(location)
title: 'Items at this location must be requested',
'data-toggle' => 'tooltip',
'aria-hidden' => 'true'
).html_safe
)
end
data
end
Expand Down Expand Up @@ -203,7 +203,7 @@ def holding_status_li(data, document, check_availability, id, holding)
location = holding_location(holding)
content_tag(
:li,
data.html_safe,
data,
class: 'holding-status',
data: {
availability_record: check_availability,
Expand All @@ -222,7 +222,7 @@ def cdl_placeholder
'',
class: 'badge badge-primary',
'data-availability-cdl' => true
).html_safe
)
end

def view_record_for_full_avail_li(document)
Expand All @@ -234,7 +234,7 @@ def view_record_for_full_avail_li(document)
class: 'availability-icon badge badge-secondary more-info',
title: 'Click on the record for full availability info',
'data-toggle' => 'tooltip'
).html_safe
)
)
end

Expand All @@ -247,7 +247,7 @@ def view_record_for_full_avail_li_two(document)
class: 'availability-icon more-info',
title: 'Click on the record for full availability info',
'data-toggle' => 'tooltip'
).html_safe,
),
class: 'empty',
data: { record_id: document['id'] }
)
Expand All @@ -269,7 +269,7 @@ def electronic_access_no_holdings(links)
title: 'Electronic access',
'data-toggle' => 'tooltip'
)
data << links.shift.html_safe
data << links.shift
end
end
# rubocop:enable Metrics/ModuleLength

0 comments on commit af00e47

Please sign in to comment.