diff --git a/app/assets/stylesheets/themes/dc_repository.scss b/app/assets/stylesheets/themes/dc_repository.scss index 98cc23f0..22f7fe7a 100644 --- a/app/assets/stylesheets/themes/dc_repository.scss +++ b/app/assets/stylesheets/themes/dc_repository.scss @@ -234,9 +234,17 @@ body.dc_repository { } .background-container { - height: 90%; + height: 100%; z-index: 0; align-self: flex-end; + background-size: cover; + background-position: center; + opacity: 0; + transition: opacity 2s ease-in-out; + } + + .background-container.active { + opacity: 1; } .circle-container { diff --git a/app/controllers/hyrax/admin/appearances_controller.rb b/app/controllers/hyrax/admin/appearances_controller.rb index f5ce8f71..86154a61 100644 --- a/app/controllers/hyrax/admin/appearances_controller.rb +++ b/app/controllers/hyrax/admin/appearances_controller.rb @@ -39,6 +39,12 @@ def update ReindexWorksJob.perform_later end + if update_params['banner_images'] + site = Site.instance + site.banner_images = update_params['banner_images'] + site.save + end + redirect_to({ action: :show }, notice: t('.flash.success')) end diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index dd90273f..5393a8b9 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -24,7 +24,7 @@ def set_site end def update_params - params.permit(:remove_banner_image, + params.permit(:remove_banner_images, :remove_logo_image, :remove_directory_image, :remove_default_collection_image, @@ -37,7 +37,7 @@ def site_theme_params REMOVE_TEXT_MAPS = { "remove_logo_image" => "logo_image_text", - "remove_banner_image" => "banner_image_text", + "remove_banner_images" => "banner_image_text", "remove_directory_image" => "directory_image_text", "remove_default_collection_image" => "default_collection_image_text", "remove_default_work_image" => "default_work_image_text" diff --git a/app/forms/hyrax/forms/admin/appearance.rb b/app/forms/hyrax/forms/admin/appearance.rb index 05a9eb15..53c8a97a 100644 --- a/app/forms/hyrax/forms/admin/appearance.rb +++ b/app/forms/hyrax/forms/admin/appearance.rb @@ -10,7 +10,7 @@ module Admin # customization menu class Appearance extend ActiveModel::Naming - delegate :banner_image, :banner_image?, to: :site + delegate :banner_images, to: :site delegate :logo_image, :logo_image?, to: :site delegate :directory_image, :directory_image?, to: :site delegate :default_collection_image, :default_collection_image?, to: :site @@ -62,7 +62,7 @@ def self.permitted_params end def self.image_params - %i[banner_image logo_image directory_image default_collection_image default_work_image] + [{ banner_images: [] }, :logo_image, :directory_image, :default_collection_image, :default_work_image] end def site diff --git a/app/helpers/hyrax_helper.rb b/app/helpers/hyrax_helper.rb index 1fa738b9..7131a5bf 100644 --- a/app/helpers/hyrax_helper.rb +++ b/app/helpers/hyrax_helper.rb @@ -23,8 +23,8 @@ def institution_name_full Site.institution_name_full || super end - def banner_image - Site.instance.banner_image? ? Site.instance.banner_image.url : super + def banner_images + Site.instance.banner_images.any? ? Site.instance.banner_images.map(&:url) : [banner_image] end def logo_image diff --git a/app/models/site.rb b/app/models/site.rb index 4aad6913..ce707b5d 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -6,7 +6,7 @@ class Site < ApplicationRecord validates :application_name, presence: true, allow_nil: true # Allow for uploading of site's banner image - mount_uploader :banner_image, Hyrax::UploadedFileUploader + mount_uploaders :banner_images, Hyku::UploadedFileUploader # Allow for uploading of site's logo image mount_uploader :logo_image, Hyrax::AvatarUploader # Allow for uploading of site's directory image diff --git a/app/uploaders/hyku/uploaded_file_uploader.rb b/app/uploaders/hyku/uploaded_file_uploader.rb new file mode 100644 index 00000000..ff7e136b --- /dev/null +++ b/app/uploaders/hyku/uploaded_file_uploader.rb @@ -0,0 +1,4 @@ +module Hyku + class UploadedFileUploader < Hyrax::UploadedFileUploader + end +end diff --git a/app/views/hyrax/admin/appearances/_banner_image_form.html.erb b/app/views/hyrax/admin/appearances/_banner_image_form.html.erb index c92d3b4c..07a953d7 100644 --- a/app/views/hyrax/admin/appearances/_banner_image_form.html.erb +++ b/app/views/hyrax/admin/appearances/_banner_image_form.html.erb @@ -1,19 +1,31 @@ <%= simple_form_for @form, url: admin_appearance_path do |f| %>