Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the application link in the header to be configured #2865

Merged
merged 2 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/shared/_header_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<nav class="navbar navbar-expand-md navbar-dark bg-dark topbar" role="navigation">
<div class="<%= container_classes %>">
<%= link_to application_name, root_path, class: 'mb-0 navbar-brand navbar-logo' %>
<%= link_to application_name, blacklight_config.logo_link, class: 'mb-0 navbar-brand navbar-logo' %>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-bs-toggle="collapse" data-target="#user-util-collapse" data-bs-target="#user-util-collapse" aria-controls="user-util-collapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
Expand Down
6 changes: 6 additions & 0 deletions lib/blacklight/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def initialized_default_configuration?

# rubocop:disable Metrics/BlockLength
default_configuration do
property :logo_link
# === Search request configuration

# @!attribute http_method
Expand Down Expand Up @@ -346,6 +347,11 @@ def repository
repository_class.new(self)
end

# @return [String] The destination for the link around the logo in the header
def logo_link
super || Rails.application.routes.url_helpers.root_path
end

# @return [Integer]
def default_per_page
super || per_page.first
Expand Down
3 changes: 3 additions & 0 deletions lib/generators/blacklight/templates/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class <%= controller_name.classify %>Controller < ApplicationController
## Model that maps search index responses to the blacklight response model
# config.response_model = Blacklight::Solr::Response
#
## The destination for the link around the logo in the header
# config.logo_link = root_path
#
## Should the raw solr document endpoint (e.g. /catalog/:id/raw) be enabled
# config.raw_endpoint.enabled = false

Expand Down