Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5575 item actions edit #6090

Merged
merged 7 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/hyrax/file_sets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def after_update_failure_response
respond_to do |wants|
wants.html do
initialize_edit_form
# TODO: return a valuable error message
flash[:error] = "There was a problem processing your request."
render 'edit', status: :unprocessable_entity
end
Expand Down
2 changes: 1 addition & 1 deletion app/forms/hyrax/forms/file_set_edit_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class FileSetEditForm

delegate :depositor, :permissions, :human_readable_type, to: :model

self.required_fields = [:title, :creator, :license]
self.required_fields = [:title, :creator]
Copy link
Contributor Author

@alishaevn alishaevn Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the license attribute is not required in Hyrax::Forms::WorkForm and isn't even available as an editable field on the Hyrax::Forms::FileSetForm, so @sephirothkod and I decided it was unnecessary to require for file sets. removing that requirement allowed change_set.validate(attributes) in Hyrax::FileSetsController#update_metadata to work.

ref: (two different comments)


self.model_class = ::FileSet

Expand Down
8 changes: 8 additions & 0 deletions app/models/hyrax/file_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ def representative_id
id
end

##
# @return [Valkyrie::ID]
def representative_id=(_input)
# saving a file set using valkyrie would err because this method didn't exist.
Rails.logger.warn('This is not a valid method for file sets')
id
end

##
# @return [Boolean] true
def pcdm_object?
Expand Down
2 changes: 1 addition & 1 deletion config/metadata/file_set_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ attributes:
type: string
multiple: true
form:
required: true
required: false
Copy link
Contributor Author

@alishaevn alishaevn Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the license attribute is not required in Hyrax::Forms::WorkForm and isn't even available as an editable field on the Hyrax::Forms::FileSetForm, so @sephirothkod and I decided it was unnecessary to require for file sets. removing that requirement allowed change_set.validate(attributes) in Hyrax::FileSetsController#update_metadata to work.

ref: (two different comments)

primary: true

# Other attributes:
Expand Down
2 changes: 1 addition & 1 deletion spec/forms/hyrax/forms/file_set_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
describe '.required_fields' do
it 'lists the fields tagged required' do
expect(described_class.required_fields)
.to contain_exactly(:title, :creator, :license)
.to contain_exactly(:title, :creator)
end
end

Expand Down