curation_concerns-models 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5660b6eec6ec27f6e8c00a1a9a001a0147a66fe6
4
- data.tar.gz: e45350c36fd8061b4ef31871620eeeea5f450447
3
+ metadata.gz: afd415c4152d3eb3fc25a1d5d63c0261c820ae07
4
+ data.tar.gz: 051471568f9ab3d2d27ff62a8d8faa5d469c3139
5
5
  SHA512:
6
- metadata.gz: 2c1ef86aa53fe09e26c1e800780c673b3499a50c01b528257683d3ee91baa2f8719e9dab83cd2e07a621b8f8b0ba90e7c407bf7188b434b4cbaf8144e2f0b950
7
- data.tar.gz: c82db879f98a32b61da80ead6d519b3259cc4ca1ad696b2c313adb70d10854d79f1db9d9efe9643417c1a16fbe821b99392b8b7e7f3e074259dc7d8ec0f55d25
6
+ metadata.gz: c2607d15592fe9f7e6acb243256cc33f6b29132b201660328cb427840b3efba3453f5f5c40ce44bab48a8cc5d55cc8b1d685b62143edd0492136ee2cca310483
7
+ data.tar.gz: 2db872e858e8705f6af5e1060c686b80e01d595125c01492066080916b6e3bd1695bdd72cca78e063fd50c8d81c80a65dcf32ee181653526a810df6ece97964b
@@ -9,7 +9,6 @@ module CurationConcerns
9
9
  # looks just at solr
10
10
  solr_doc[Solrizer.solr_name('member_ids', :symbol)] = object.member_ids
11
11
  Solrizer.set_field(solr_doc, 'generic_type', 'Work', :facetable)
12
- solr_doc['thumbnail_path_ss'] = thumbnail_path
13
12
  end
14
13
  end
15
14
  end
@@ -15,33 +15,33 @@ module CurationConcerns
15
15
  property :resource_type, predicate: ::RDF::Vocab::DC.type do |index|
16
16
  index.as :stored_searchable, :facetable
17
17
  end
18
- property :creator, predicate: ::RDF::Vocab::DC.creator do |index|
18
+ property :creator, predicate: ::RDF::Vocab::DC11.creator do |index|
19
19
  index.as :stored_searchable, :facetable
20
20
  end
21
- property :contributor, predicate: ::RDF::Vocab::DC.contributor do |index|
21
+ property :contributor, predicate: ::RDF::Vocab::DC11.contributor do |index|
22
22
  index.as :stored_searchable, :facetable
23
23
  end
24
- property :description, predicate: ::RDF::Vocab::DC.description do |index|
24
+ property :description, predicate: ::RDF::Vocab::DC11.description do |index|
25
25
  index.type :text
26
26
  index.as :stored_searchable
27
27
  end
28
- property :tag, predicate: ::RDF::Vocab::DC.relation do |index|
28
+ property :tag, predicate: ::RDF::Vocab::DC11.relation do |index|
29
29
  index.as :stored_searchable, :facetable
30
30
  end
31
31
  property :rights, predicate: ::RDF::Vocab::DC.rights do |index|
32
32
  index.as :stored_searchable
33
33
  end
34
- property :publisher, predicate: ::RDF::Vocab::DC.publisher do |index|
34
+ property :publisher, predicate: ::RDF::Vocab::DC11.publisher do |index|
35
35
  index.as :stored_searchable, :facetable
36
36
  end
37
37
  property :date_created, predicate: ::RDF::Vocab::DC.created do |index|
38
38
  index.as :stored_searchable
39
39
  end
40
40
 
41
- property :subject, predicate: ::RDF::Vocab::DC.subject do |index|
41
+ property :subject, predicate: ::RDF::Vocab::DC11.subject do |index|
42
42
  index.as :stored_searchable, :facetable
43
43
  end
44
- property :language, predicate: ::RDF::Vocab::DC.language do |index|
44
+ property :language, predicate: ::RDF::Vocab::DC11.language do |index|
45
45
  index.as :stored_searchable, :facetable
46
46
  end
47
47
  property :identifier, predicate: ::RDF::Vocab::DC.identifier do |index|
@@ -44,8 +44,9 @@ module CurationConcerns
44
44
  fetch(Solrizer.solr_name('hasRelatedMediaFragment', :symbol), []).first
45
45
  end
46
46
 
47
+ # Date created is indexed as a string. This allows users to enter values like: 'Circa 1840-1844'
47
48
  def date_created
48
- date_field('date_created')
49
+ fetch(Solrizer.solr_name("date_created"), []).first
49
50
  end
50
51
 
51
52
  def date_modified
@@ -23,6 +23,15 @@ module CurationConcerns::WorkBehavior
23
23
  def indexer
24
24
  CurationConcerns::WorkIndexer
25
25
  end
26
+
27
+ # This governs which partial to draw when you render this type of object
28
+ def _to_partial_path #:nodoc:
29
+ @_to_partial_path ||= begin
30
+ element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(name))
31
+ collection = ActiveSupport::Inflector.tableize(name)
32
+ "curation_concerns/#{collection}/#{element}".freeze
33
+ end
34
+ end
26
35
  end
27
36
 
28
37
  def to_s
@@ -5,8 +5,24 @@ module CurationConcerns
5
5
  included do
6
6
  class_attribute :thumbnail_path_service
7
7
  self.thumbnail_path_service = ThumbnailPathService
8
+ class_attribute :thumbnail_field
9
+ self.thumbnail_field = 'thumbnail_path_ss'.freeze
8
10
  end
9
11
 
12
+ # Adds thumbnail indexing to the solr document
13
+ def generate_solr_document
14
+ super.tap do |solr_doc|
15
+ index_thumbnails(solr_doc)
16
+ end
17
+ end
18
+
19
+ # Write the thumbnail paths into the solr_document
20
+ # @params [Hash] solr_document the solr document to add the field to
21
+ def index_thumbnails(solr_document)
22
+ solr_document[thumbnail_field] = thumbnail_path
23
+ end
24
+
25
+ # Returns the value for the thumbnail path to put into the solr document
10
26
  def thumbnail_path
11
27
  self.class.thumbnail_path_service.call(object)
12
28
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_dependency 'active_attr'
23
- spec.add_dependency 'hydra-collections', '~> 8.0'
23
+ spec.add_dependency 'hydra-collections', '~> 8.1'
24
24
  spec.add_dependency 'hydra-head', '~> 9.3'
25
25
  spec.add_dependency 'hydra-works', '~> 0.7'
26
26
  spec.add_dependency 'active_fedora-noid', '~> 1.0'
@@ -1,5 +1,5 @@
1
1
  module CurationConcerns
2
2
  module Models
3
- VERSION = "0.9.0".freeze
3
+ VERSION = "0.10.0".freeze
4
4
  end
5
5
  end
@@ -1,4 +1,6 @@
1
1
  # Generated by curation_concerns:models:install
2
2
  class Collection < ActiveFedora::Base
3
3
  include ::CurationConcerns::CollectionBehavior
4
+ # You can replace these metadata if they're not suitable
5
+ include Hydra::Collections::BasicMetadata
4
6
  end
@@ -7,21 +7,22 @@ if defined?(PhusionPassenger)
7
7
  config = YAML.load(ERB.new(IO.read(File.join(Rails.root, 'config', 'redis.yml'))).result)[Rails.env].with_indifferent_access
8
8
 
9
9
  # The important two lines
10
- $redis.client.disconnect if $redis
11
- $redis = begin
12
- Redis.new(host: config[:host], port: config[:port], thread_safe: true)
13
- rescue
14
- nil
15
- end
16
- Resque.redis = $redis
10
+ Redis.current.disconnect!
11
+ Redis.current = begin
12
+ Redis.new(config.merge(thread_safe: true))
13
+ rescue
14
+ nil
15
+ end
16
+ Resque.redis = Redis.current
17
17
  Resque.redis.namespace = "#{CurationConcerns.config.redis_namespace}:#{Rails.env}"
18
18
  Resque.redis.client.reconnect if Resque.redis
19
19
  end
20
20
  end
21
21
  else
22
22
  config = YAML.load(ERB.new(IO.read(File.join(Rails.root, 'config', 'redis.yml'))).result)[Rails.env].with_indifferent_access
23
- $redis = begin
24
- Redis.new(host: config[:host], port: config[:port], thread_safe: true)
23
+ require 'redis'
24
+ Redis.current = begin
25
+ Redis.new(config.merge(thread_safe: true))
25
26
  rescue
26
27
  nil
27
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curation_concerns-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_attr
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '8.0'
33
+ version: '8.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '8.0'
40
+ version: '8.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: hydra-head
43
43
  requirement: !ruby/object:Gem::Requirement