-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add contexts to the flexible metadata model. (#6915)
* add contexts to the flexible metadata model. they can be assigned on admin sets and then apply the contexts to the works made with that admin set selected * Update app/models/hyrax/flexible_schema.rb Co-authored-by: LaRita Robinson <[email protected]> * Update app/services/hyrax/m3_schema_loader.rb Co-authored-by: LaRita Robinson <[email protected]> * remove no longer needed conditionals * migration fixes --------- Co-authored-by: LaRita Robinson <[email protected]>
- Loading branch information
1 parent
a94f39e
commit 98a7d59
Showing
22 changed files
with
148 additions
and
63 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
.dassie/db/migrate/20240606205216_add_contexts_to_hyrax_flexible_schemas.rb
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,5 @@ | ||
class AddContextsToHyraxFlexibleSchemas < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :hyrax_flexible_schemas, :contexts, :text unless column_exists?(:hyrax_flexible_schemas, :contexts) | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
.koppie/db/migrate/20240606205216_add_contexts_to_hyrax_flexible_schemas.rb
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,5 @@ | ||
class AddContextsToHyraxFlexibleSchemas < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :hyrax_flexible_schemas, :contexts, :text unless column_exists?(:hyrax_flexible_schemas, :contexts) | ||
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,27 @@ | ||
# frozen_string_literal: true | ||
module Hyrax | ||
module FlexibleFormBehavior | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
include Hyrax::BasedNearFieldBehavior | ||
property :contexts | ||
end | ||
|
||
# OVERRIDE disposable 0.6.3 to make schema dynamic | ||
def schema | ||
Hyrax::Forms::ResourceForm::Definition::Each.new(singleton_class.schema_definitions) | ||
end | ||
|
||
private | ||
|
||
# OVERRIDE valkyrie 3.0.1 to make schema dynamic | ||
def field(field_name) | ||
singleton_class.schema_definitions.fetch(field_name.to_s) | ||
end | ||
|
||
def _form_field_definitions | ||
singleton_class.schema_definitions | ||
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
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
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,2 +1,5 @@ | ||
<%= f.input :title %> | ||
<%= f.input :description, as: :text %> | ||
<% if Hyrax.config.flexible? && Hyrax.config.admin_set_class.new.respond_to?(:contexts) %> | ||
<%= f.input :contexts, collection: Hyrax::FlexibleSchema.last.context_select, input_html: { multiple: true } %> | ||
<% 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 @@ | ||
<%= f.input key, as: :hidden %> |
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.