-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
53 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<% if show_contact_form? && (current_exhibit.nil? || !current_page?(spotlight.new_exhibit_contact_form_path(current_exhibit))) %> | ||
<div id="report-problem-form"> | ||
<%= render 'spotlight/shared/report_a_problem' %> | ||
</div> | ||
<% end %> | ||
|
||
<header class="masthead <%= 'image-masthead' if current_masthead %> <%= 'resource-masthead' if resource_masthead? %>"> | ||
<% if current_masthead %> | ||
<span class='background-container' style="background-image: url('<%= current_masthead.iiif_url %>')"></span> | ||
<span class='background-container-gradient'></span> | ||
<% end %> | ||
|
||
<%= masthead_navbar if resource_masthead? %> | ||
<%= render Spotlight::Engine.config.spotlight.title_component.new(title: content_for(:masthead) || masthead_heading_content, subtitle: masthead_subheading_content) %> | ||
<%= masthead_navbar unless resource_masthead? %> | ||
</header> | ||
|
||
<%= render Spotlight::BreadcrumbsComponent.new(breadcrumbs:) %> |
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,32 @@ | ||
# frozen_string_literal: true | ||
|
||
module Spotlight | ||
# Draws the masthead | ||
class MastheadComponent < ViewComponent::Base | ||
def initialize(current_exhibit:, current_masthead:, resource_masthead:) | ||
@current_exhibit = current_exhibit | ||
@current_masthead = current_masthead | ||
@resource_masthead = resource_masthead | ||
super | ||
end | ||
|
||
attr_reader :current_exhibit, :current_masthead | ||
|
||
def resource_masthead? | ||
@resource_masthead | ||
end | ||
|
||
def show_contact_form? | ||
helpers.show_contact_form? && | ||
(current_exhibit.nil? || !current_page?(spotlight.new_exhibit_contact_form_path(current_exhibit))) | ||
end | ||
|
||
def masthead_navbar | ||
if current_exhibit | ||
render 'shared/exhibit_navbar' | ||
else | ||
render 'shared/site_navbar' | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,2 @@ | ||
<% if show_contact_form? && (current_exhibit.nil? || !current_page?(spotlight.new_exhibit_contact_form_path(current_exhibit))) %> | ||
<div id="report-problem-form"> | ||
<%= render 'spotlight/shared/report_a_problem' %> | ||
</div> | ||
<% end %> | ||
|
||
<header class="masthead <%= 'image-masthead' if current_masthead %> <%= 'resource-masthead' if resource_masthead? %>"> | ||
<% if current_masthead %> | ||
<span class='background-container' style="background-image: url('<%= current_masthead.iiif_url %>')"></span> | ||
<span class='background-container-gradient'></span> | ||
<% end %> | ||
|
||
<%= render current_exhibit ? 'shared/exhibit_navbar' : 'shared/site_navbar' if resource_masthead? %> | ||
<%= render Spotlight::Engine.config.spotlight.title_component.new(title: content_for(:masthead) || masthead_heading_content, subtitle: masthead_subheading_content) %> | ||
<%= render current_exhibit ? 'shared/exhibit_navbar' : 'shared/site_navbar' unless resource_masthead? %> | ||
</header> | ||
|
||
<%= render Spotlight::BreadcrumbsComponent.new(breadcrumbs:) %> | ||
<% Spotlight.deprecator.warn "Rendering deprecated partial shared/masthead. Use MastheadComponent instead" %> | ||
<%= render Spotlight::MastheadComponent.new(current_exhibit:, current_masthead:, resource_masthead: resource_masthead?) %> |