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

Merge pals features in to main #2138

Merged
merged 24 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6a1e0c5
🎁 Contributions from PALNI/PALCI
ShanaLMoore Sep 11, 2023
6f9b88b
🎁 Contributions from PALNI/PALCI
jeremyf Dec 19, 2023
0166692
Updating translations
jeremyf Dec 19, 2023
d2649f9
🎁 Contribute back work from PALNI/PALCI
jeremyf Dec 19, 2023
045aa3a
Merge branch 'pals-contribute-back-to-prime' into merge-main-into-pals
jeremyf Jan 8, 2024
27cb0a9
♻️ Account for observed customizations
jeremyf Jan 8, 2024
99a9733
🧹 Appeasing Rubocop
jeremyf Jan 8, 2024
c7bbda6
Remove conflict in controller
jeremyf Jan 8, 2024
747601f
🐛 Add tests for all defined color methods
jeremyf Jan 8, 2024
821cbf2
🐛 Add placement_class for masthead rendering
jeremyf Jan 8, 2024
a559908
Removing unneeded file
jeremyf Jan 8, 2024
f2c6b89
Resolving menu structure for site configuration
jeremyf Jan 8, 2024
b2334fa
Applying changes in main to this work
jeremyf Jan 8, 2024
0fbde50
Fixing locale_for tests to reflect I18n behavior
jeremyf Jan 8, 2024
5894b93
🐛 Use non-deprecated and non-removed method
jeremyf Jan 8, 2024
6b17b5c
Fixing roles service
jeremyf Jan 8, 2024
ad0d56b
Removing file that came along for the ride
jeremyf Jan 8, 2024
577a49d
Merge branch 'main' into merge-main-into-pals
jeremyf Jan 8, 2024
b8d7a2e
🐛 Restore translation
jeremyf Jan 9, 2024
b6f85d2
Merge branch 'main' into merge-main-into-pals
jeremyf Jan 9, 2024
a880b50
🧹 Revisiting translations
jeremyf Jan 9, 2024
2879a36
🧹 Fix badge status for feature
jeremyf Jan 9, 2024
6b7ba4b
Add missing logo translation
jeremyf Jan 10, 2024
1a02896
Merge branch 'main' into merge-main-into-pals
jeremyf Jan 10, 2024
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
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 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid qualifying id selectors with an element.
Avoid using id selectors

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 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid qualifying class selectors with an element.
Each selector in a comma sequence should be on its own single line

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 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using id selectors

margin-top: 10px;
@media (min-width: 576px) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@media declaration should be preceded by an empty line

max-width: 300px;
}
}

#download-pdf-button {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using id selectors

margin: 10px 0 10px 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shorthand form for property margin should be written more concisely as 10px 0 instead of 10px 0 10px 0
Shorthands of length 4 are not allowed. Value was 10px 0 10px 0

}

.catalog_startOverLink {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Selector catalog_startOverLink should be written in BEM (Block Element Modifier) format

font-size: 1.15em;
font-weight: bold;
}

// collection show page styles

.space-between {
justify-content: space-between;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered align-items, justify-content

align-items: center;
}

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each selector in a comma sequence should be on its own single line
Rule declaration should be preceded by an empty line

padding: 0;
}

.hyc-item-count {
margin: 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered background, border-radius, color, margin, padding

background: rgba(255, 255, 255, 0.75);
padding: 10px;
border-radius: 0.5em;
color: #333;
}

.hyc-bugs div, div {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each selector in a comma sequence should be on its own single line

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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.5 should be written with a leading zero as 0.5

}

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered margin-left, margin-right

margin-left: 1em;
}

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

.py-0 {
padding-top: 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered padding-bottom, padding-top

padding-bottom: 0;
}

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered padding-bottom, padding-top

padding-bottom: 2em;
}

.d-block {
display: block;
}

// hide iiif-print feature flipper

tr[data-feature="use-iiif-print"] {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid qualifying attribute selectors with an element.

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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color yellow should be written in hexadecimal form as #ffff00

font-weight: 700;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files should end with a trailing newline

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%;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files should end with a trailing newline

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
Loading