Skip to content

Commit

Permalink
Merge pull request #2138 from samvera/merge-main-into-pals
Browse files Browse the repository at this point in the history
Merge main into pals
  • Loading branch information
jeremyf authored Jan 10, 2024
2 parents 703917b + 1a02896 commit b34f43b
Show file tree
Hide file tree
Showing 138 changed files with 3,401 additions and 526 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ gem 'puma', '~> 5.6' # Use Puma as the app server
gem 'rack-test', '0.7.0', group: %i[test] # rack-test >= 0.71 does not work with older Capybara versions (< 2.17). See #214 for more details
gem 'rails-controller-testing', group: %i[test]
gem 'rdf', '~> 3.2'
gem 'redcarpet' # for Markdown constant
gem 'redis-namespace', '~> 1.10' # Hyrax v5 relies on 1.5; but we'd like to have the #clear method so we need 1.10 or greater.
gem 'redlock', '>= 0.1.2', '< 2.0' # lock redlock per https://github.com/samvera/hyrax/pull/5961
gem 'riiif', '~> 2.0'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,7 @@ GEM
rdf-xsd (3.3.0)
rdf (~> 3.3)
rexml (~> 3.2)
redcarpet (3.6.0)
redic (1.5.3)
hiredis
redis (4.8.1)
Expand Down Expand Up @@ -1469,6 +1470,7 @@ DEPENDENCIES
rails (~> 6.0)!
rails-controller-testing
rdf (~> 3.2)
redcarpet
redis-namespace (~> 1.10)
redlock (>= 0.1.2, < 2.0)
riiif (~> 2.0)
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//= require jquery.fontselect
//= require jquery.dataTables
//= require dataTables.bootstrap4
//= require cropper.min
//= require stat_slider
//= require turbolinks
//= require cocoon
Expand Down
10 changes: 10 additions & 0 deletions app/assets/javascripts/cropper.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/assets/javascripts/fabric.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*= require single_signon
*= require blacklight_advanced_search
*= require blacklight_range_limit
*= require cropper.min
*= require_self
*= require hyku_knapsack/application
*/
9 changes: 9 additions & 0 deletions app/assets/stylesheets/cropper.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

127 changes: 126 additions & 1 deletion app/assets/stylesheets/hyku.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
// allows full width if tabs are turned off with feature flipper
.home-content {
display: flex;
justify-content: normal;
padding: 0 20px;
}
.home-tabs-left {
min-width: 50%;
Expand Down Expand Up @@ -414,12 +416,23 @@ a.btn.btn-default.restore-default-color.with-color-hint {
nav.navbar.navbar-default.navbar-static-top .container-fluid .row {
margin-left: 0;
margin-right: 0;

nav.navbar-nav.col-sm-5 {
padding-right: 0;
}
}

//these styles modify the theming for the citations section
div#collapse-citations {
text-align: left;
word-wrap: break-word;
}

@media (min-width: 576px) {
.citations-button .download-pdf-button {
max-width: 300px;
}
}

body.public-facing {
.btn {
&.btn-primary,
Expand Down Expand Up @@ -498,3 +511,115 @@ body.public-facing {
vertical-align: middle;
width: 1.5em;
}

// make sure constraints are on only one line, even with markdown
span.constraint-value p, .facet-values p {
display: inline-block;
margin-bottom: 0;
}

// make the facet counts appear at the end of the facet panel
.facet-content .panel-body .facet-values p {
display: flex;
justify-content: space-between;
}

// button to remove a filter should be red instead of white
.remove.dropdown-toggle .glyphicon.glyphicon-remove {
color: #c4302b;
}

// style the analytics button to match citations button
#stats {
margin-top: 10px;
@media (min-width: 576px) {
max-width: 300px;
}
}

#download-pdf-button {
margin: 10px 0 10px 0;
}

.catalog_startOverLink {
font-size: 1.15em;
font-weight: bold;
}

// collection show page styles

.space-between {
justify-content: space-between;
align-items: center;
}

.hyc-banner {
padding: 15px;
.hyc-bugs .hyc-created-by, .hyc-bugs .hyc-last-updated, .hyc-title {
padding: 0;
}

.hyc-item-count {
margin: 0;
background: rgba(255, 255, 255, 0.75);
padding: 10px;
border-radius: 0.5em;
color: #333;
}

.hyc-bugs div, div {
position: relative;
}
}

// these margin classes can be removed when Hyku is eventually updated to Bootstrap 4 upon upgrading to Hyrax 4.
// These correspond directly to bootstrap 4 classes.

.mb-0 {
margin-bottom: 0;
}

.mt-5 {
margin-top: 3em;
}

.mt-2 {
margin-top: 0.5em;
}

.mb-2 {
margin-bottom: .5em;
}

.mb-5 {
margin-bottom: 3em;
}

.mx-3 {
margin-right: 1em;
margin-left: 1em;
}

.ml-auto {
margin-left: auto;
}

.py-0 {
padding-top: 0;
padding-bottom: 0;
}

.py-4 {
padding-top: 2em;
padding-bottom: 2em;
}

.d-block {
display: block;
}

// hide iiif-print feature flipper

tr[data-feature="use-iiif-print"] {
display: none;
}
6 changes: 6 additions & 0 deletions app/assets/stylesheets/hyrax.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@
@import "viewer";

@import "themes/*";

// for catalog search result snippets
.highlight {
background: yellow;
font-weight: 700;
}
8 changes: 5 additions & 3 deletions app/assets/stylesheets/viewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
.viewer {
height: 100%;
padding: 10px;
iframe {
// position: absolute;
}
}

#viewer-modal {
Expand All @@ -21,3 +18,8 @@
margin-bottom: 10px;
}
}

.video-embed-viewer {
aspect-ratio: 16 / 9;
width: 100%;
}
27 changes: 27 additions & 0 deletions app/controllers/admin/roles_service_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

module Admin
class RolesServiceController < ApplicationController
layout 'hyrax/dashboard'

def index
authorize! :update, RolesService
add_breadcrumb t(:'hyrax.controls.home'), root_path
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
add_breadcrumb t(:'hyrax.admin.sidebar.roles_service_jobs'), main_app.admin_roles_service_jobs_path
end

# post "admin/roles_service/:job_name_key
def update_roles
authorize! :update, RolesService
job = RolesService.valid_jobs.fetch(params[:job_name_key])

job.perform_later

respond_to do |wants|
wants.html { redirect_to main_app.admin_roles_service_jobs_path, notice: "#{job} has been submitted." }
wants.json { render json: { notice: "#{job} has been submitted." }, status: :ok }
end
end
end
end
17 changes: 17 additions & 0 deletions app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Admin
class UsersController < AdminController
before_action :ensure_admin!, except: [:remove_role]
before_action :load_user, only: [:destroy]

# NOTE: User creation/invitations handled by devise_invitable
Expand All @@ -26,6 +27,22 @@ def activate
end
end

def remove_role
authorize! :edit, User

user = User.find(params[:id])
role = Role.find(params[:role_id])

if user && role && user.roles.include?(role)
user.remove_role(role.name)
flash[:notice] = "Role '#{role.name}' was successfully removed from user #{user.email}."
else
flash[:alert] = "Failed to remove role from user #{user.email}."
end

redirect_back(fallback_location: root_path)
end

private

def load_user
Expand Down
6 changes: 4 additions & 2 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ def self.uploaded_field
config.default_solr_params = {
qt: "search",
rows: 10,
qf: IiifPrint.config.metadata_fields.keys.map { |attribute| "#{attribute}_tesim" }
.join(' ') << " title_tesim description_tesim all_text_timv file_set_text_tsimv", # the first space character is necessary!
qf: (
IiifPrint.config.metadata_fields.keys.map { |attribute| "#{attribute}_tesim" } +
["title_tesim", "description_tesim", "all_text_timv", "file_set_text_tsimv"]
).uniq.join(' '),
"hl": true,
"hl.simple.pre": "<span class='highlight'>",
"hl.simple.post": "</span>",
Expand Down
16 changes: 16 additions & 0 deletions app/controllers/flipflop/strategies_controller_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

# OVERRIDE Flipflop v2.7.1 to allow for custom `Action` labels

module Flipflop
module StrategiesControllerDecorator
def enable?
values = StrategiesController::ENABLE_VALUES | ADDITIONAL_ENABLE_VALUES
values.include?(params[:commit])
end

ADDITIONAL_ENABLE_VALUES = FeaturesHelper::FEATURE_ACTION_LABELS.map { |_, v| v[:on] }.to_set.freeze
end
end

Flipflop::StrategiesController.prepend(Flipflop::StrategiesControllerDecorator)
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ def show
end

def update
form_class.new(update_params).update!
form = form_class.new(update_params)
form.banner_image = update_params[:banner_image] if update_params[:banner_image].present?
form.update!

if update_params['default_collection_image']
# Reindex all Collections and AdminSets to apply new default collection image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ module Dashboard
## Shows a list of all collections to the admins
# rubocop:disable Metrics/ModuleLength
module CollectionsControllerDecorator
def show
configure_show_sort_fields

super
end

private

def configure_show_sort_fields
# In the CollectionsControllerDecorator, we clear the sort fields and add our own to have
# the ability to sort the index with custom fields. However, this also affects the show page.
# Here we set the sort fields back to the defaults for the show page.
blacklight_config.sort_fields = CatalogController.blacklight_config.sort_fields
end

public

def edit
form
collection_type
Expand Down
Loading

0 comments on commit b34f43b

Please sign in to comment.