Skip to content

Commit

Permalink
enable deleting, make sure location is bold (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
summer-cook authored Jun 30, 2023
1 parent 6827213 commit bc5cd0b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/models/etd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,11 @@ class Etd < ActiveFedora::Base
# including `include ::Hyrax::BasicMetadata`. All properties must
# be declared before their values can be ordered.
include OrderMetadataValues

# These needed to be added again in order to enable destroy for based_near, even though they are in Hyrax::BasicMetadata.
# the OrderAlready OrderMetadataValues above somehow prevents them from running
id_blank = proc { |attributes| attributes[:id].blank? }
class_attribute :controlled_properties
self.controlled_properties = [:based_near]
accepts_nested_attributes_for :based_near, reject_if: id_blank, allow_destroy: true
end
7 changes: 7 additions & 0 deletions app/models/generic_work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,12 @@ class GenericWork < ActiveFedora::Base
# be declared before their values can be ordered.
include OrderMetadataValues

# These needed to be added again in order to enable destroy for based_near, even though they are in Hyrax::BasicMetadata.
# the OrderAlready OrderMetadataValues above somehow prevents them from running
id_blank = proc { |attributes| attributes[:id].blank? }
class_attribute :controlled_properties
self.controlled_properties = [:based_near]
accepts_nested_attributes_for :based_near, reject_if: id_blank, allow_destroy: true

self.indexer = GenericWorkIndexer
end
7 changes: 7 additions & 0 deletions app/models/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ class Image < ActiveFedora::Base
# be declared before their values can be ordered.
include OrderMetadataValues

# These needed to be added again in order to enable destroy for based_near, even though they are in Hyrax::BasicMetadata.
# the OrderAlready OrderMetadataValues above somehow prevents them from running
id_blank = proc { |attributes| attributes[:id].blank? }
class_attribute :controlled_properties
self.controlled_properties = [:based_near]
accepts_nested_attributes_for :based_near, reject_if: id_blank, allow_destroy: true

self.indexer = ImageIndexer
# Change this to restrict which works can be added as a child.
# self.valid_child_concerns = []
Expand Down
7 changes: 7 additions & 0 deletions app/models/oer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ class Oer < ActiveFedora::Base
# be declared before their values can be ordered.
include OrderMetadataValues

# These needed to be added again in order to enable destroy for based_near, even though they are in Hyrax::BasicMetadata.
# the OrderAlready OrderMetadataValues above somehow prevents them from running
id_blank = proc { |attributes| attributes[:id].blank? }
class_attribute :controlled_properties
self.controlled_properties = [:based_near]
accepts_nested_attributes_for :based_near, reject_if: id_blank, allow_destroy: true

def previous_version
@previous_version ||= Oer.where(id: previous_version_id) if previous_version_id
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/hyrax/base/_attribute_rows.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<%= presenter.attribute_to_html(:publisher, render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:language, render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:identifier, render_as: :linked, search_field: 'identifier_tesim', html_dl: true) %>
<%= presenter.attribute_to_html(:based_near_label) %>
<%= presenter.attribute_to_html(:based_near_label, html_dl: true) %>
<%= presenter.attribute_to_html(:keyword, render_as: :faceted, html_dl: true) %>
<%= presenter.attribute_to_html(:date_created, render_as: :linked, search_field: 'date_created_tesim', html_dl: true) %>
<%= presenter.attribute_to_html(:related_url, render_as: :external_link, html_dl: true, label: 'Related URL') %>
Expand Down
2 changes: 1 addition & 1 deletion config/locales/hyrax.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ en:
title: Type name
defaults:
admin_set_id: Administrative Set
based_near: Based Near
based_near: Location
contributor: Contributor
creator: Creator
date_created: Date Created
Expand Down

0 comments on commit bc5cd0b

Please sign in to comment.