-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎁 Mobius gets mobius specific work type
This commit will add logic for mobius tenants to get the mobius specific work type and non-mobius tenants to get all work types minus the mobius work type.
- Loading branch information
Showing
5 changed files
with
78 additions
and
1 deletion.
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
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,29 @@ | ||
# frozen_string_literal: true | ||
|
||
module AccountDecorator | ||
MOBIUS_TENANTS = %w[ | ||
atsu | ||
ccis | ||
covenant | ||
crowder | ||
eastcentral | ||
jewell | ||
kenrick | ||
mbts | ||
mobap | ||
mobius-search | ||
moval | ||
mssu | ||
nwmsu | ||
sbuniv | ||
stlcc | ||
truman | ||
webster | ||
].freeze | ||
|
||
def mobius? | ||
name.in?(MOBIUS_TENANTS) | ||
end | ||
end | ||
|
||
Account.prepend(AccountDecorator) |
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 @@ | ||
# frozen_string_literal: true | ||
|
||
# OVERRIDE Hyku to set tenants with appropriate works | ||
|
||
module SiteDecorator | ||
def instance | ||
return NilSite.instance if Account.global_tenant? | ||
|
||
first_or_create do |site| | ||
account = Account.find_by(tenant: Apartment::Tenant.current) | ||
if account.mobius? | ||
site.available_works = MOBIUS_CONCERNS | ||
else | ||
site.available_works = Hyrax.config.registered_curation_concern_types - MOBIUS_CONCERNS | ||
end | ||
end | ||
end | ||
end | ||
|
||
Site.singleton_class.send(:prepend, SiteDecorator) |
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,19 @@ | ||
<% provide :page_header do %> | ||
<h1><span class="fa fa-address-book"></span> <%= t('hyku.admin.work_types') %></h1> | ||
<% end %> | ||
|
||
<div class="card"> | ||
<div class="card-body"> | ||
<%= simple_form_for @site, url: '/admin/work_types' do |f| %> | ||
<% tenant_registered_curation_concern_types.each do |type| %> | ||
<div class="form-check"> | ||
<input class="form-check-input" type="checkbox" value="<%= type %>" id="input-<%= type %>" name="available_works[]" <%= 'checked' if @site.available_works&.include?(type) %>> | ||
<label class="form-check-label" for="input-<%= type %>"> | ||
<%= type %> | ||
</label> | ||
</div> | ||
<% end %> | ||
<%= f.submit class: 'btn btn-primary' %> | ||
<% 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
MOBIUS_CONCERNS = ['MobiusWork'].freeze | ||
|
||
Hyrax.config do |config| | ||
config.register_curation_concern :mobius_work | ||
config.register_curation_concern MOBIUS_CONCERNS.map { |concern| concern.underscore.to_sym } | ||
end |