app/forms/hyrax/forms/resource_form.rb in hyrax-3.0.0.pre.rc2 vs app/forms/hyrax/forms/resource_form.rb in hyrax-3.0.0.pre.rc3
- old
+ new
@@ -34,11 +34,11 @@
##
# Nested form for permissions.
#
# @note due to historical oddities with Hydra::AccessControls and Hydra
# Editor, Hyrax's views rely on `agent_name` and `access` as field
- # names. we provide these as virtual fields andprepopulate these from
+ # names. we provide these as virtual fields and prepopulate these from
# `Hyrax::Permission`.
class Permission < Hyrax::ChangeSet
property :agent_name, virtual: true, prepopulator: ->(_opts) { self.agent_name = model.agent }
property :access, virtual: true, prepopulator: ->(_opts) { self.access = model.mode }
end
@@ -63,14 +63,18 @@
end
end
class_attribute :model_class
- delegate :depositor, :human_readable_type, to: :model
+ property :human_readable_type, writable: false
- property :visibility # visibility has an accessor on the model
+ property :depositor
+ property :on_behalf_of
+ property :proxy_depositor
+ property :visibility, default: VisibilityIntention::PRIVATE
+
property :date_modified, readable: false
property :date_uploaded, readable: false
property :agreement_accepted, virtual: true, default: false, prepopulator: ->(_opts) { self.agreement_accepted = !model.new_record }
collection :permissions, virtual: true, default: [], form: Permission, prepopulator: ->(_opts) { self.permissions = Hyrax::AccessControl.for(resource: model).permissions }
@@ -83,10 +87,10 @@
property :lease_expiration_date, virtual: true, prepopulator: ->(_opts) { self.lease_expiration_date = model.lease&.lease_expiration_date }
property :visibility_after_lease, virtual: true, prepopulator: ->(_opts) { self.visibility_after_lease = model.lease&.visibility_after_lease }
property :visibility_during_lease, virtual: true, prepopulator: ->(_opts) { self.visibility_during_lease = model.lease&.visibility_during_lease }
# pcdm relationships
- property :admin_set_id
+ property :admin_set_id, prepopulator: ->(_opts) { self.admin_set_id = AdminSet::DEFAULT_ID }
property :member_ids, default: [], type: Valkyrie::Types::Array
property :member_of_collection_ids, default: [], type: Valkyrie::Types::Array
# provide a lock token for optimistic locking; we name this `version` for
# backwards compatibility