-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement custom digital contents icon, tooltip, and alert
- Loading branch information
1 parent
451a714
commit 3b375e7
Showing
8 changed files
with
98 additions
and
6 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
16 changes: 16 additions & 0 deletions
16
app/components/arclight/online_content_filter_component.html.erb
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,16 @@ | ||
<%# Overrides AL Core to use custom icon/tooltip and layout %> | ||
<div class="card online-contents"> | ||
<div class="card-body d-flex align-items-center"> | ||
<div class="d-flex"> | ||
<%= render Arclight::OnlineStatusIndicatorComponent.new(document: @document) %> | ||
<h2 class="d-none d-lg-inline"> | ||
<span class="visually-hidden">Filter</span> | ||
Digital content - | ||
</h2> | ||
</div> | ||
<div class="ms-1"> | ||
<%= t('arclight.views.show.online_content.description') %> | ||
<%= link_to t('arclight.views.show.online_content.link_text'), helpers.search_action_path(f: { collection: [collection_name], access: ['online'] }) %> | ||
</div> | ||
</div> | ||
</div> |
1 change: 1 addition & 0 deletions
1
app/components/arclight/online_status_indicator_component.html.erb
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 @@ | ||
<%= icon_with_tooltip %> |
25 changes: 25 additions & 0 deletions
25
app/components/arclight/online_status_indicator_component.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,25 @@ | ||
# frozen_string_literal: true | ||
|
||
# Overrides Arclight's OnlineStatusIndicatorComponent to replace with a custom template that includes our tooltip | ||
module Arclight | ||
# Render an online status indicator for a document | ||
class OnlineStatusIndicatorComponent < Blacklight::Component | ||
def initialize(document:, **) | ||
@document = document | ||
super | ||
end | ||
|
||
def render? | ||
@document.online_content? | ||
end | ||
|
||
def icon_with_tooltip | ||
icon = <<~HTML | ||
<span class="al-online-content-icon" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-html="true" data-bs-title="Includes digital content"> | ||
#{helpers.blacklight_icon(:online)} | ||
</span> | ||
HTML | ||
icon.html_safe # rubocop:disable Rails/OutputSafety | ||
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
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