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/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/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/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| %>
- <% require_image = @form.banner_image? ? false : true %> - <%# Upload Banner Image %> - <%= f.input :banner_image, as: :file, wrapper: :vertical_file_input, required: require_image, hint: t('hyrax.admin.appearances.show.forms.banner_image.hint') %> + <% require_image = @form.banner_images.any? ? false : true %> + <%# Upload Banner Images %> + <%= f.input :banner_images, + as: :file, + wrapper: :vertical_file_input, + required: require_image, + hint: t('hyrax.admin.appearances.show.forms.banner_image.hint'), + input_html: { multiple: true, accept: 'image/*' } %> <%= f.input :banner_image_text, required: true, as: :text, label: 'Banner image alt text' %> - <%= image_tag @form.banner_image.url, class: "img-responsive" if @form.banner_image? %> + <% if @form.banner_images.any? %> + <% @form.banner_images.each do |banner_image| %> + + <% end %> + <% end %>
<% end %> -<% if @form.banner_image? %> + +<% if @form.banner_images.any? %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/themes/dc_repository/layouts/homepage.html.erb b/app/views/themes/dc_repository/layouts/homepage.html.erb index cbd63fc2..d915e8c2 100644 --- a/app/views/themes/dc_repository/layouts/homepage.html.erb +++ b/app/views/themes/dc_repository/layouts/homepage.html.erb @@ -2,8 +2,9 @@ <% content_for(:navbar) do %>
- -
+ <% banner_images.shuffle.each_with_index do |image, index| %> +
+ <% end %> <% # OVERRIDE: Hyrax v3.4.1 - remove background-container-gradient %> <% # OVERRIDE: Hyrax v3.4.1 - remove site-title-container %> <% # OVERRIDE: Hyrax v3.4.1 - add divs and classes for custom styles %> @@ -45,3 +46,21 @@ <% end %> <%= render template: 'layouts/hyrax' %> + +<% if banner_images.size > 1 %> + +<% end %> diff --git a/spec/helpers/hyrax_helper_spec.rb b/spec/helpers/hyrax_helper_spec.rb index 8b9d6db9..fc0a934f 100644 --- a/spec/helpers/hyrax_helper_spec.rb +++ b/spec/helpers/hyrax_helper_spec.rb @@ -1,15 +1,15 @@ # frozen_string_literal: true RSpec.describe HyraxHelper, type: :helper do - describe "#banner_image" do + describe "#banner_images" do context "with uploaded banner image" do before do f = fixture_file_upload('/images/nypl-hydra-of-lerna.jpg', 'image/jpg') - Site.instance.update(banner_image: f) + Site.instance.update(banner_images: [f]) end it "returns the uploaded banner image" do - expect(helper.banner_image).to eq(Site.instance.banner_image.url) + expect(helper.banner_images.first).to eq(Site.instance.banner_images.first.url) end end diff --git a/spec/views/hyrax/admin/appearances/show.html.erb_spec.rb b/spec/views/hyrax/admin/appearances/show.html.erb_spec.rb index e569df8d..995acb83 100644 --- a/spec/views/hyrax/admin/appearances/show.html.erb_spec.rb +++ b/spec/views/hyrax/admin/appearances/show.html.erb_spec.rb @@ -43,8 +43,10 @@ # logo tab assert_select "input#admin_appearance_logo_image[name=?]", "admin_appearance[logo_image]" # banner image tab - assert_select "input#admin_appearance_banner_image[name=?]", "admin_appearance[banner_image]" - assert_select "input#admin_appearance_banner_image[type=?]", "file" + assert_select "input#admin_appearance_banner_images[name=?]", "admin_appearance[banner_images][]" + assert_select "input#admin_appearance_banner_images[type=?]", "file" + assert_select "input#admin_appearance_banner_images[multiple=?]", "multiple" + assert_select "input#admin_appearance_banner_images[accept=?]", "image/*" # directory image assert_select "input#admin_appearance_directory_image[name=?]", "admin_appearance[directory_image]" # default collection image