app/repository_models/curation_concern/model.rb in curate-0.5.4 vs app/repository_models/curation_concern/model.rb in curate-0.5.5

- old
+ new

@@ -1,40 +1,29 @@ module CurationConcern module Model extend ActiveSupport::Concern - module ClassMethods - def human_readable_type - name.demodulize.titleize - end - end + include Sufia::ModelMethods + include Curate::ActiveModelAdaptor + include Hydra::Collections::Collectible + include Solrizer::Common + include CurationConcern::HumanReadableType included do - include Sufia::ModelMethods - include Curate::ActiveModelAdaptor - include Hydra::Collections::Collectible - include Solrizer::Common - has_metadata 'properties', type: Curate::PropertiesDatastream has_attributes :relative_path, :depositor, :owner, :representative, datastream: :properties, multiple: false class_attribute :human_readable_short_description end - def human_readable_type - self.class.human_readable_type - end - def as_json(options) { pid: pid, title: title, model: self.class.to_s, curation_concern_type: human_readable_type } end def to_solr(solr_doc={}, opts={}) super(solr_doc, opts) index_collection_pids(solr_doc) solr_doc[Solrizer.solr_name('noid', Sufia::GenericFile.noid_indexer)] = noid - solr_doc[Solrizer.solr_name('human_readable_type',:facetable)] = human_readable_type - solr_doc[Solrizer.solr_name('human_readable_type', :stored_searchable)] = human_readable_type add_derived_date_created(solr_doc) return solr_doc end def to_s @@ -42,9 +31,13 @@ end # Returns a string identifying the path associated with the object. ActionPack uses this to find a suitable partial to represent the object. def to_partial_path "curation_concern/#{super}" + end + + def can_be_member_of_collection?(collection) + collection == self ? false : true end protected # A searchable date field that is derived from the (text) field date_created