Sha256: fd29732dfa003b52eea2d1e101224f27fc0c28e185e4bb17d0b98c0ac44d76b9
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
module Hydra module Collection extend ActiveSupport::Concern extend ActiveSupport::Autoload include Hydra::ModelMethods # for access to apply_depositor_metadata include Hydra::AccessControls::Permissions include Hydra::Collections::Collectible included do has_metadata "descMetadata", type: Hydra::CollectionRdfDatastream has_metadata "properties", type: Hydra::Datastream::Properties has_and_belongs_to_many :members, :property => :has_collection_member, :class_name => "ActiveFedora::Base" , :after_remove => :update_member has_attributes :depositor, datastream: :properties, multiple: false has_attributes :title, :date_uploaded, :date_modified, :description, datastream: :descMetadata, multiple: false has_attributes :creator, :contributor, :based_near, :part_of, :publisher, :date_created, :subject,:resource_type, :rights, :identifier, :language, :tag, :related_url, datastream: :descMetadata, multiple: true before_create :set_date_uploaded before_save :set_date_modified after_save :update_all_members before_destroy :update_all_members end def terms_for_editing terms_for_display - [:date_modified, :date_uploaded] end def terms_for_display self.descMetadata.class.config.keys.map{|v| v.to_sym} end def update_all_members self.members.collect { |m| update_member(m) } end # TODO: Use solr atomic updates to accelerate this process def update_member member member.update_index end private def set_date_uploaded self.date_uploaded = Date.today end def set_date_modified self.date_modified = Date.today end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hydra-collections-2.0.4 | app/models/concerns/hydra/collection.rb |