curation_concerns-models 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b866be7465155c67d0157b20159c75f53cc6d2c
4
- data.tar.gz: def664a51f3bff81f3ca2396787883ae6b3142cc
3
+ metadata.gz: bf5fe8cfb43b91b4bf4b0603bfdbf427c872e442
4
+ data.tar.gz: da3f9e9f7e522fcce530eb0aa5f0d26289ff6b28
5
5
  SHA512:
6
- metadata.gz: 399bdc3d1ea0bb4722605fa486662e1e33b4c01872f0fe3fe47d7edd36583c0a744a4bfa0198f39e288f4943c69ac00ec712e5ca985cfde379770c510c052516
7
- data.tar.gz: 1bc3ca8a712bb6d141d4c8411c959db37c66931b86b0c1e3a7a969d42d41402ffb59397ab7d5da1e1c4eec84228a09c50fd9dce5932d37344368193f5a03ea86
6
+ metadata.gz: b190960f8aee8224d04d027a23347dc487efeb83bf86f752c8f5eae55c79488b3a1a8d85ba1109b9fa08a1fceed7ab87dbbef6da63666fdcbd88772e8e1e48dc
7
+ data.tar.gz: e1f4a3d671a906437afec2d3d8c331b60d1bfce1d9407d6742c98bacb6c4ff736ec2facd7afe002a81fff49f66b77941103d6470e66d97e513bca33aeb8dbd78
@@ -167,6 +167,9 @@ module CurationConcerns
167
167
  copy_visibility(work, file_set)
168
168
  end
169
169
  work.ordered_members << file_set
170
+ set_representative(work, file_set)
171
+ set_thumbnail(work, file_set)
172
+
170
173
  # Save the work so the association between the work and the file_set is persisted (head_id)
171
174
  work.save
172
175
  end
@@ -196,5 +199,15 @@ module CurationConcerns
196
199
  def copy_visibility(source_concern, destination_concern)
197
200
  destination_concern.visibility = source_concern.visibility
198
201
  end
202
+
203
+ def set_representative(work, file_set)
204
+ return unless work.representative_id.blank?
205
+ work.representative = file_set
206
+ end
207
+
208
+ def set_thumbnail(work, file_set)
209
+ return unless work.thumbnail_id.blank?
210
+ work.thumbnail = file_set
211
+ end
199
212
  end
200
213
  end
@@ -7,7 +7,7 @@ module CurationConcerns
7
7
  # member_ids which requires fewer Fedora API calls than file_set_ids.
8
8
  # file_set_ids requires loading all the members from Fedora but member_ids
9
9
  # looks just at solr
10
- solr_doc[Solrizer.solr_name('file_set_ids', :symbol)] = object.member_ids
10
+ solr_doc[Solrizer.solr_name('member_ids', :symbol)] = object.member_ids
11
11
  Solrizer.set_field(solr_doc, 'generic_type', 'Work', :facetable)
12
12
  solr_doc['thumbnail_path_ss'] = thumbnail_path
13
13
  end
@@ -8,5 +8,13 @@ class CreateDerivativesJob < ActiveFedoraIdBasedJob
8
8
  file_set.create_derivatives(file_name)
9
9
  # The thumbnail is indexed in the solr document, so reindex
10
10
  file_set.update_index
11
+ file_set.parent.update_index if parent_needs_reindex?
12
+ end
13
+
14
+ # If this file_set is the thumbnail for the parent work,
15
+ # then the parent also needs to be reindexed.
16
+ def parent_needs_reindex?
17
+ return false unless file_set.parent
18
+ file_set.parent.thumbnail_id == file_set.id
11
19
  end
12
20
  end
@@ -2,7 +2,7 @@ module CurationConcerns
2
2
  module Ability
3
3
  extend ActiveSupport::Concern
4
4
  included do
5
- self.ability_logic += [:curation_concerns_permissions]
5
+ self.ability_logic += [:curation_concerns_permissions, :add_to_collection]
6
6
  end
7
7
 
8
8
  def curation_concerns_permissions
@@ -19,8 +19,6 @@ module CurationConcerns
19
19
  cannot :index, Hydra::AccessControls::Embargo
20
20
  cannot :index, Hydra::AccessControls::Lease
21
21
  end
22
-
23
- can :collect, :all
24
22
  end
25
23
 
26
24
  def admin_permissions
@@ -31,6 +29,11 @@ module CurationConcerns
31
29
  user_groups.include? 'admin'
32
30
  end
33
31
 
32
+ def add_to_collection
33
+ return if current_user.new_record?
34
+ can :collect, :all
35
+ end
36
+
34
37
  # Add this to your ability_logic if you want all logged in users to be able
35
38
  # to submit content
36
39
  def everyone_can_create_curation_concerns
@@ -15,33 +15,33 @@ module CurationConcerns
15
15
  index.as :symbol
16
16
  end
17
17
 
18
- property :part_of, predicate: ::RDF::DC.isPartOf
19
- property :resource_type, predicate: ::RDF::DC.type do |index|
18
+ property :part_of, predicate: ::RDF::Vocab::DC.isPartOf
19
+ property :resource_type, predicate: ::RDF::Vocab::DC.type do |index|
20
20
  index.as :stored_searchable, :facetable
21
21
  end
22
- property :title, predicate: ::RDF::DC.title do |index|
22
+ property :title, predicate: ::RDF::Vocab::DC.title do |index|
23
23
  index.as :stored_searchable, :facetable
24
24
  end
25
- property :creator, predicate: ::RDF::DC.creator do |index|
25
+ property :creator, predicate: ::RDF::Vocab::DC.creator do |index|
26
26
  index.as :stored_searchable, :facetable
27
27
  end
28
- property :contributor, predicate: ::RDF::DC.contributor do |index|
28
+ property :contributor, predicate: ::RDF::Vocab::DC.contributor do |index|
29
29
  index.as :stored_searchable, :facetable
30
30
  end
31
- property :description, predicate: ::RDF::DC.description do |index|
31
+ property :description, predicate: ::RDF::Vocab::DC.description do |index|
32
32
  index.type :text
33
33
  index.as :stored_searchable
34
34
  end
35
- property :tag, predicate: ::RDF::DC.relation do |index|
35
+ property :tag, predicate: ::RDF::Vocab::DC.relation do |index|
36
36
  index.as :stored_searchable, :facetable
37
37
  end
38
- property :rights, predicate: ::RDF::DC.rights do |index|
38
+ property :rights, predicate: ::RDF::Vocab::DC.rights do |index|
39
39
  index.as :stored_searchable
40
40
  end
41
- property :publisher, predicate: ::RDF::DC.publisher do |index|
41
+ property :publisher, predicate: ::RDF::Vocab::DC.publisher do |index|
42
42
  index.as :stored_searchable, :facetable
43
43
  end
44
- property :date_created, predicate: ::RDF::DC.created do |index|
44
+ property :date_created, predicate: ::RDF::Vocab::DC.created do |index|
45
45
  index.as :stored_searchable
46
46
  end
47
47
 
@@ -50,34 +50,34 @@ module CurationConcerns
50
50
  # fedora's system created date will reflect the date when the record
51
51
  # was created in fedora4, but the date_uploaded will preserve the
52
52
  # original creation date from the old repository.
53
- property :date_uploaded, predicate: ::RDF::DC.dateSubmitted, multiple: false do |index|
53
+ property :date_uploaded, predicate: ::RDF::Vocab::DC.dateSubmitted, multiple: false do |index|
54
54
  index.type :date
55
55
  index.as :stored_sortable
56
56
  end
57
57
 
58
- property :date_modified, predicate: ::RDF::DC.modified, multiple: false do |index|
58
+ property :date_modified, predicate: ::RDF::Vocab::DC.modified, multiple: false do |index|
59
59
  index.type :date
60
60
  index.as :stored_sortable
61
61
  end
62
- property :subject, predicate: ::RDF::DC.subject do |index|
62
+ property :subject, predicate: ::RDF::Vocab::DC.subject do |index|
63
63
  index.as :stored_searchable, :facetable
64
64
  end
65
- property :language, predicate: ::RDF::DC.language do |index|
65
+ property :language, predicate: ::RDF::Vocab::DC.language do |index|
66
66
  index.as :stored_searchable, :facetable
67
67
  end
68
- property :identifier, predicate: ::RDF::DC.identifier do |index|
68
+ property :identifier, predicate: ::RDF::Vocab::DC.identifier do |index|
69
69
  index.as :stored_searchable
70
70
  end
71
- property :based_near, predicate: ::RDF::FOAF.based_near do |index|
71
+ property :based_near, predicate: ::RDF::Vocab::FOAF.based_near do |index|
72
72
  index.as :stored_searchable, :facetable
73
73
  end
74
74
  property :related_url, predicate: ::RDF::RDFS.seeAlso do |index|
75
75
  index.as :stored_searchable
76
76
  end
77
- property :bibliographic_citation, predicate: ::RDF::DC.bibliographicCitation do |index|
77
+ property :bibliographic_citation, predicate: ::RDF::Vocab::DC.bibliographicCitation do |index|
78
78
  index.as :stored_searchable
79
79
  end
80
- property :source, predicate: ::RDF::DC.source do |index|
80
+ property :source, predicate: ::RDF::Vocab::DC.source do |index|
81
81
  index.as :stored_searchable
82
82
  end
83
83
  end
@@ -1,5 +1,5 @@
1
1
  module CurationConcerns
2
2
  module Models
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -7,7 +7,7 @@ class CurationConcerns::Models::InstallGenerator < CurationConcerns::Models::Abs
7
7
  This generator makes the following changes to your application:
8
8
  1. Creates several database migrations if they do not exist in /db/migrate
9
9
  2. Creates the curation_concerns.rb configuration file and several others
10
- 3. Creates the file_set.rb, generic_work.rb and collection.rb models
10
+ 3. Creates the file_set.rb and collection.rb models
11
11
  4. Runs full-text generator
12
12
  "''
13
13
  def banner
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.2.0
4
+ version: 0.3.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: 2015-10-21 00:00:00.000000000 Z
11
+ date: 2015-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_attr