File tree Expand file tree Collapse file tree 4 files changed +56
-19
lines changed Expand file tree Collapse file tree 4 files changed +56
-19
lines changed Original file line number Diff line number Diff line change 1+ <% if show_contact_form? && (current_exhibit.nil? || !current_page?(spotlight.new_exhibit_contact_form_path(current_exhibit))) %>
2+ <div id ="report-problem-form ">
3+ <%= render 'spotlight/shared/report_a_problem' %>
4+ </ div >
5+ <% end %>
6+
7+ < header class ="masthead <%= 'image-masthead' if current_masthead %> <%= 'resource-masthead' if resource_masthead? %> ">
8+ <% if current_masthead %>
9+ < span class ='background-container ' style ="background-image: url('<%= current_masthead . iiif_url %> ') "> </ span >
10+ < span class ='background-container-gradient '> </ span >
11+ <% end %>
12+
13+ <%= masthead_navbar if resource_masthead? %>
14+ <%= render Spotlight ::Engine . config . spotlight . title_component . new ( title : content_for ( :masthead ) || masthead_heading_content , subtitle : masthead_subheading_content ) %>
15+ <%= masthead_navbar unless resource_masthead? %>
16+ </ header >
17+
18+ <%= render Spotlight ::BreadcrumbsComponent . new ( breadcrumbs :) %>
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ module Spotlight
4+ # Draws the masthead
5+ class MastheadComponent < ViewComponent ::Base
6+ def initialize ( current_exhibit :, current_masthead :, resource_masthead :)
7+ @current_exhibit = current_exhibit
8+ @current_masthead = current_masthead
9+ @resource_masthead = resource_masthead
10+ super
11+ end
12+
13+ attr_reader :current_exhibit , :current_masthead
14+
15+
16+ def resource_masthead?
17+ @resource_masthead
18+ end
19+
20+ def show_contact_form?
21+ helpers . show_contact_form? &&
22+ ( current_exhibit . nil? || !current_page? ( spotlight . new_exhibit_contact_form_path ( current_exhibit ) ) )
23+ end
24+
25+ def masthead_navbar
26+ @masthead_navbar ||= capture do
27+ if current_exhibit
28+ render 'shared/exhibit_navbar'
29+ else
30+ render 'shared/site_navbar'
31+ end
32+ end
33+ end
34+ end
35+ end
Original file line number Diff line number Diff line change 4646 <%= content_for ( :skip_links ) %>
4747 <% end %>
4848 <%= render partial : 'shared/header_navbar' %>
49- <%= render partial : 'shared/masthead' %>
49+ <%= render Spotlight :: MastheadComponent . new ( current_exhibit : , current_masthead : , resource_masthead : resource_masthead? ) %>
5050 <%= content_for? ( :header_content ) ? yield ( :header_content ) : "" %>
5151
5252 < main id ="main-container " class ="<%= container_classes %> " aria-label ="<%= t ( 'blacklight.main.aria.main_container' ) %> ">
Original file line number Diff line number Diff line change 1- <% if show_contact_form? && (current_exhibit.nil? || !current_page?(spotlight.new_exhibit_contact_form_path(current_exhibit))) %>
2- <div id ="report-problem-form ">
3- <%= render 'spotlight/shared/report_a_problem' %>
4- </ div >
5- <% end %>
6-
7- < header class ="masthead <%= 'image-masthead' if current_masthead %> <%= 'resource-masthead' if resource_masthead? %> ">
8- <% if current_masthead %>
9- < span class ='background-container ' style ="background-image: url('<%= current_masthead . iiif_url %> ') "> </ span >
10- < span class ='background-container-gradient '> </ span >
11- <% end %>
12-
13- <%= render current_exhibit ? 'shared/exhibit_navbar' : 'shared/site_navbar' if resource_masthead? %>
14- <%= render Spotlight ::Engine . config . spotlight . title_component . new ( title : content_for ( :masthead ) || masthead_heading_content , subtitle : masthead_subheading_content ) %>
15- <%= render current_exhibit ? 'shared/exhibit_navbar' : 'shared/site_navbar' unless resource_masthead? %>
16- </ header >
17-
18- <%= render Spotlight ::BreadcrumbsComponent . new ( breadcrumbs :) %>
1+ <% Spotlight.deprecator.warn "Rendering deprecated partial shared/masthead. Use MastheadComponent instead" %>
2+ <%= render Spotlight::MastheadComponent.new(current_exhibit:, current_masthead:, resource_masthead: resource_masthead?) %>
You can’t perform that action at this time.
0 commit comments