Skip to content

Commit

Permalink
Merge branch 'main' into merge-main-into-i35
Browse files Browse the repository at this point in the history
* main: (29 commits)
  🧹 Specify knapsack required branch
  Revert "knapsack gemfile additions or replacement"
  Add missing logo translation
  ♻️ Updating Gemfile to reflect pointing to main
  🧹 Fix badge status for feature
  🧹 Revisiting translations
  🐛 Restore translation
  working on fixing redis deploy
  Removing file that came along for the ride
  Fixing roles service
  🐛 Use non-deprecated and non-removed method
  Fixing locale_for tests to reflect I18n behavior
  update version to 6.0.0rc1 (#2137)
  Applying changes in main to this work
  Resolving menu structure for site configuration
  Removing unneeded file
  🎁 fixes to unblock deploys
  🐛 Add placement_class for masthead rendering
  🐛 Add tests for all defined color methods
  knapsack gemfile additions or replacement
  ...
  • Loading branch information
jeremyf committed Jan 10, 2024
2 parents 7f940fe + 391a7a3 commit 8fc5dc1
Show file tree
Hide file tree
Showing 155 changed files with 3,497 additions and 560 deletions.
20 changes: 19 additions & 1 deletion 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 Expand Up @@ -105,6 +106,23 @@ gem 'webmock', group: %i[test]

# This gem does nothing by default, but is instead a tool to ease developer flow
# and place overrides, themes and deployment code.
gem 'hyku_knapsack', github: 'samvera-labs/hyku_knapsack', branch: 'upstream_main'
#
# When you use a knapsack for Hyku development, which we recommend, you'll want to ensure that your
# local knapsack repository has a `'required_for_knapsack_instances'` branch (which it should by
# default). Due to some tomfoolery, of knapsack, the branch name
# (e.g. `required_for_knapsack_instances`) must be checked out locally in the knapsack environment
# that you use to build Docker.
#
# Why not use `main`? We need a stable SHA for building HykuKnapsack prime
# (e.g. samvera-labs/hyku_knapsack). Why the stable SHA? Because when we bundle a knapsack, the
# Hyku submodule uses the SHA of the locally checked out branch specified in the gem spec. Which
# can create a chicken and egg issue; namely I need to update Hyku with a new SHA for Knapsack, but
# to update Knapsack's submodule reference to Hyku, I need a new SHA for knapsack. Thus, I can never
# use a "regular branch". Instead we need to use a separate more stable for Knapsack.
#
# Thus the hopefully descriptive `required_for_knapsack_instances`.
#
# tl;dr - Have a local `required_for_knapsack_instances` branch on your knapsack repository
gem 'hyku_knapsack', github: 'samvera-labs/hyku_knapsack', branch: 'required_for_knapsack_instances'

# rubocop:enable Layout/LineLength
8 changes: 5 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ GIT

GIT
remote: https://github.com/samvera-labs/hyku_knapsack.git
revision: 14f688b61afab9ee886f5f7fa26a76a37bced597
branch: upstream_main
revision: 5a7c54cace96881a3963ab2fd881ca6ea3f57372
branch: required_for_knapsack_instances
specs:
hyku_knapsack (0.0.1)
rails (>= 5.2.0)
Expand Down Expand Up @@ -125,7 +125,7 @@ GIT

GIT
remote: https://github.com/samvera/hyrax.git
revision: f25c6f8960ec85fc460ba48f9a0ec4802d5751f7
revision: b7891b758411c59f71ff54212e0d250fcc47e35f
branch: double_combo
specs:
hyrax (5.0.0.rc2)
Expand Down 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.

128 changes: 126 additions & 2 deletions app/assets/stylesheets/hyku.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
.dashboard .form-tab-content label {
font-weight: 700;
}

@media (min-width: 768px) {
.logo-set {
display: flex;
Expand All @@ -31,6 +30,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 @@ -418,12 +419,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 @@ -502,3 +514,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
20 changes: 5 additions & 15 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,25 @@ class ApplicationController < ActionController::Base

protected

# rubocop:disable Naming/PredicateName
def is_hidden
# rubocop:enable Naming/PredicateName
def hidden?
current_account.persisted? && !current_account.is_public?
end

# rubocop:disable Naming/PredicateName
def is_api_or_pdf
# rubocop:enable Naming/PredicateName
def api_or_pdf?
request.format.to_s.match('json') ||
params[:print] ||
request.path.include?('api') ||
request.path.include?('pdf')
end

# rubocop:disable Naming/PredicateName
def is_staging
# rubocop:enable Naming/PredicateName
['staging'].include?(Rails.env)
def staging?
Rails.env.staging?
end

##
# Extra authentication for palni-palci during development phase
def authenticate_if_needed
# Disable this extra authentication in test mode
return true if Rails.env.test?
# rubocop:disable Naming/PredicateName
return unless (is_hidden || is_staging) && !is_api_or_pdf
# rubocop:enable Naming/PredicateName
return unless (hidden? || staging?) && !api_or_pdf?
authenticate_or_request_with_http_basic do |username, password|
username == "samvera" && password == "hyku"
end
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
Loading

0 comments on commit 8fc5dc1

Please sign in to comment.