-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into blacklight_advanced_and_range
- Loading branch information
Showing
30 changed files
with
405 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
# OVERRIDE Hyrax 2.9 to add in import flag | ||
module Hyrax | ||
module Actors | ||
class Environment | ||
# @param [ActiveFedora::Base] curation_concern work to operate on | ||
# @param [Ability] current_ability the authorizations of the acting user | ||
# @param [ActionController::Parameters] attributes user provided form attributes | ||
def initialize(curation_concern, current_ability, attributes, importing = false) | ||
@curation_concern = curation_concern | ||
@current_ability = current_ability | ||
@attributes = attributes.to_h.with_indifferent_access | ||
@importing = importing | ||
end | ||
|
||
attr_reader :curation_concern, :current_ability, :attributes, :importing | ||
|
||
# @return [User] the user from the current_ability | ||
def user | ||
current_ability.current_user | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
# Add ability to mark environment as from bulk import | ||
module Bulkrax | ||
module ObjectFactoryDecorator | ||
# @param [Hash] attrs the attributes to put in the environment | ||
# @return [Hyrax::Actors::Environment] | ||
def environment(attrs) | ||
Hyrax::Actors::Environment.new(object, Ability.new(@user), attrs, true) | ||
end | ||
end | ||
end | ||
|
||
::Bulkrax::ObjectFactory.prepend(Bulkrax::ObjectFactoryDecorator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
class ApplicationJob < ActiveJob::Base | ||
# limit to 5 attempts | ||
retry_on StandardError, wait: :exponentially_longer, attempts: 5 do |_job, _exception| | ||
# Log error, do nothing, etc. | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
class ReindexFileSetsJob < ApplicationJob | ||
def perform | ||
FileSet.find_each do |file_set| | ||
ReindexItemJob.perform_later(file_set) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class ReindexItemJob < ApplicationJob | ||
def perform(item) | ||
item.update_index | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'apartment/elevators/generic' | ||
# Apartment middleware for switching tenants based on the | ||
# CNAME entry for an account. | ||
class AccountElevator < Apartment::Elevators::Generic | ||
include AccountSwitch | ||
# @return [String] The tenant to switch to | ||
def parse_tenant_name(request) | ||
account = Account.from_request(request) | ||
|
||
account || Account.new.reset! # reset everything if no account is present | ||
account&.tenant | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<h2 class="text-center">Forgot your password?</h2> | ||
<div class="row center-block"> | ||
<div class="col-md-6 col-md-offset-3"> | ||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> | ||
<%= render "devise/shared/error_messages", resource: resource %> | ||
|
||
<div class="form-group"> | ||
<%= f.label :email %><br /> | ||
<%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %> | ||
</div> | ||
|
||
<div class="form-group text-center"> | ||
<%= f.submit "Send me reset password instructions", class: 'btn btn-primary' %> | ||
</div> | ||
<% end %> | ||
<div class="text-center"> | ||
<%= render "devise/shared/links" %> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<h2 class="text-center pt-40 pb-40"><%= t(".sign_up_header") %></h2> | ||
<div class="row center-block"> | ||
<div class="col-md-8 col-md-offset-2"> | ||
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: 'form-horizontal' }) do |f| %> | ||
<small> | ||
<%= f.error_notification %> | ||
</small> | ||
|
||
<div class="form-inputs"> | ||
<%= f.input :display_name, required: true, wrapper: :inline %> | ||
<%= f.input :email, required: true, autofocus: true, wrapper: :inline %> | ||
<%= f.input :password, required: true, wrapper: :inline %> | ||
<%= f.input :password_confirmation, required: true, wrapper: :inline %> | ||
</div> | ||
|
||
<div class="form-group text-center"> | ||
<%= render 'devise/shared/links' %> | ||
</div> | ||
<div class="text-center pb-40"> | ||
<%= f.button :submit, t(".sign_up") %> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
<h2 class="text-center">Log in</h2> | ||
<div class="row center-block"> | ||
<div class="col-md-6 col-md-offset-3"> | ||
<%= form_for(resource, as: resource_name, url: session_path(resource_name), class: "form-horizontal") do |f| %> | ||
<div class="form-group"> | ||
<%= f.label :email %><br /> | ||
<%= f.email_field :email, autofocus: true, class: "form-control" %> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<%= f.label :password, class: "control-label" %><br /> | ||
<%= f.password_field :password, autocomplete: "off", class: "form-control" %> | ||
</div> | ||
|
||
<% if devise_mapping.rememberable? -%> | ||
<div class="form-group text-center"> | ||
<%= f.check_box :remember_me %> | ||
<%= f.label :remember_me, class: "control-label" %> | ||
</div> | ||
<% end -%> | ||
|
||
<div class="form-group text-center"> | ||
<%= f.submit "Log in", class: 'btn btn-primary' %> | ||
</div> | ||
<% end %> | ||
<div class="text-center"> | ||
<%= render "devise/shared/links" %> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Based on https://github.com/samvera/hyrax/issues/4581#issuecomment-843085122 | ||
|
||
# Monkey-patch to short circuit ActiveModel::Dirty which attempts to load the whole master files ordered list when calling nodes_will_change! | ||
# This leads to a stack level too deep exception when attempting to delete a master file from a media object on the manage files step. | ||
# See https://github.com/samvera/active_fedora/pull/1312/commits/7c8bbbefdacefd655a2ca653f5950c991e1dc999#diff-28356c4daa0d55cbaf97e4269869f510R100-R103 | ||
ActiveFedora::Aggregation::ListSource.class_eval do | ||
def attribute_will_change!(attr) | ||
return super unless attr == 'nodes' | ||
attributes_changed_by_setter[:nodes] = true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.