hydra-collections 8.0.0 → 8.1.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: 5f0a6d73f747ff5aaa1026b064e55730c1605f36
4
- data.tar.gz: 8e5a8f2069f9fc74e661eb2389a4ea6e0b164421
3
+ metadata.gz: 33c94d0cf369a533ff8bb7d039edbafbacb9a163
4
+ data.tar.gz: c4f56e2253e1e648dd131d3cd334f37eeacac791
5
5
  SHA512:
6
- metadata.gz: fd07c424bb502667e7cb2cb48aba65de9e14785df444d16a816a7d4169c81a886aa0aaff8e2fcc7ce754fbec0651e7fcf2de3b0e8ee03355d625c21b4db08a19
7
- data.tar.gz: 045f31a8e3b174596bcc985be730f642dc3b7beea5b1fb134758fc67050ecde128b9158ffb5706c1f5a3dce138148600c963527bd496fbbe87daccd596929bf7
6
+ metadata.gz: e982f879d4dff4125fc229ede046443c167459e81185a8944701eb8cd5cfc80d44506b52ec6869c4dd24e1adf341096dc4056cb16d82ac6b460737192be65aa4
7
+ data.tar.gz: 280d86d67f35cd18f1a693f3799cf17864819d047275ae91bcded8c34aa1d45b688e716e9d22097971d59638f7fa89372b2870062fae88db607dced13365ff90
data/README.md CHANGED
@@ -12,6 +12,9 @@ And then execute:
12
12
 
13
13
  $ bundle
14
14
 
15
+ Finally run:
16
+ $ rails generate hydra:collections:install
17
+
15
18
  Or install it yourself as:
16
19
 
17
20
  $ gem install hydra-collections
@@ -1,54 +1,4 @@
1
1
  # View Helpers for Hydra Collections functionality
2
2
  module CollectionsHelper
3
- def has_collection_search_parameters?
4
- !params[:cq].blank?
5
- end
6
-
7
- # Displays the Collections create collection button. Put this in your search result page template. We recommend putting it in catalog/_sort_and_per_page.html.erb
8
- def button_for_create_collection(label = 'Create Collection')
9
- render '/collections/button_create_collection', label: label
10
- end
11
-
12
- # Displays the Collections update collection button. Put this in your search result page template. We recommend putting it in catalog/_sort_and_per_page.html.erb
13
- def button_for_update_collection(label = 'Update Collection', collection_id = 'collection_replace_id')
14
- render '/collections/button_for_update_collection', label: label, collection_id: collection_id
15
- end
16
-
17
- # Displays the Collections delete collection button. Put this in your search result page for each collection found.
18
- def button_for_delete_collection(collection, label = 'Delete Collection', confirm = 'Are you sure?')
19
- render '/collections/button_for_delete_collection', collection: collection, label: label, confirm: confirm
20
- end
21
-
22
- def button_for_remove_from_collection(collection, document, label = 'Remove From Collection')
23
- render '/collections/button_remove_from_collection', collection: collection, label: label, document: document
24
- end
25
-
26
- def button_for_remove_selected_from_collection(collection, label = 'Remove From Collection')
27
- render '/collections/button_for_remove_selected_from_collection', collection: collection, label: label
28
- end
29
-
30
- # add hidden fields to a form for removing a single document from a collection
31
- def single_item_action_remove_form_fields(form, document)
32
- single_item_action_form_fields(form, document, 'remove')
33
- end
34
-
35
- # add hidden fields to a form for adding a single document to a collection
36
- def single_item_action_add_form_fields(form, document)
37
- single_item_action_form_fields(form, document, 'add')
38
- end
39
-
40
- # add hidden fields to a form for performing an action on a single document on a collection
41
- def single_item_action_form_fields(form, document, action)
42
- render '/collections/single_item_action_fields', form: form, document: document, action: action
43
- end
44
-
45
- def hidden_collection_members
46
- _erbout = ''
47
- if params[:batch_document_ids].present?
48
- params[:batch_document_ids].each do |batch_item|
49
- _erbout.concat hidden_field_tag('batch_document_ids[]', batch_item)
50
- end
51
- end
52
- _erbout.html_safe
53
- end
3
+ include Hydra::Collections::CollectionsHelperBehavior
54
4
  end
@@ -0,0 +1,56 @@
1
+ # View Helpers for Hydra Collections functionality
2
+ module Hydra::Collections
3
+ module CollectionsHelperBehavior
4
+ def has_collection_search_parameters?
5
+ !params[:cq].blank?
6
+ end
7
+
8
+ # Displays the Collections create collection button. Put this in your search result page template. We recommend putting it in catalog/_sort_and_per_page.html.erb
9
+ def button_for_create_collection(label = 'Create Collection')
10
+ render '/collections/button_create_collection', label: label
11
+ end
12
+
13
+ # Displays the Collections update collection button. Put this in your search result page template. We recommend putting it in catalog/_sort_and_per_page.html.erb
14
+ def button_for_update_collection(label = 'Update Collection', collection_id = 'collection_replace_id')
15
+ render '/collections/button_for_update_collection', label: label, collection_id: collection_id
16
+ end
17
+
18
+ # Displays the Collections delete collection button. Put this in your search result page for each collection found.
19
+ def button_for_delete_collection(collection, label = 'Delete Collection', confirm = 'Are you sure?')
20
+ render '/collections/button_for_delete_collection', collection: collection, label: label, confirm: confirm
21
+ end
22
+
23
+ def button_for_remove_from_collection(collection, document, label = 'Remove From Collection')
24
+ render '/collections/button_remove_from_collection', collection: collection, label: label, document: document
25
+ end
26
+
27
+ def button_for_remove_selected_from_collection(collection, label = 'Remove From Collection')
28
+ render '/collections/button_for_remove_selected_from_collection', collection: collection, label: label
29
+ end
30
+
31
+ # add hidden fields to a form for removing a single document from a collection
32
+ def single_item_action_remove_form_fields(form, document)
33
+ single_item_action_form_fields(form, document, 'remove')
34
+ end
35
+
36
+ # add hidden fields to a form for adding a single document to a collection
37
+ def single_item_action_add_form_fields(form, document)
38
+ single_item_action_form_fields(form, document, 'add')
39
+ end
40
+
41
+ # add hidden fields to a form for performing an action on a single document on a collection
42
+ def single_item_action_form_fields(form, document, action)
43
+ render '/collections/single_item_action_fields', form: form, document: document, action: action
44
+ end
45
+
46
+ def hidden_collection_members
47
+ _erbout = ''
48
+ if params[:batch_document_ids].present?
49
+ params[:batch_document_ids].each do |batch_item|
50
+ _erbout.concat hidden_field_tag('batch_document_ids[]', batch_item)
51
+ end
52
+ end
53
+ _erbout.html_safe
54
+ end
55
+ end
56
+ end
@@ -1,3 +1,4 @@
1
1
  class Collection < ActiveFedora::Base
2
2
  include Hydra::Collection
3
+ include Hydra::Collections::BasicMetadata
3
4
  end
@@ -5,7 +5,7 @@ module Hydra
5
5
  include Hydra::Works::CollectionBehavior
6
6
  include Hydra::WithDepositor # for access to apply_depositor_metadata
7
7
  include Hydra::AccessControls::Permissions
8
- include Hydra::Collections::Metadata
8
+ include Hydra::Collections::RequiredMetadata
9
9
  include Hydra::Works::CollectionBehavior
10
10
 
11
11
 
@@ -1,11 +1,7 @@
1
1
  module Hydra::Collections
2
- module Metadata
2
+ module BasicMetadata
3
3
  extend ActiveSupport::Concern
4
4
  included do
5
- property :depositor, predicate: RDF::Vocab::MARCRelators.dpt, multiple: false do |index|
6
- index.as :symbol, :stored_searchable
7
- end
8
-
9
5
  property :part_of, predicate: RDF::Vocab::DC.isPartOf
10
6
 
11
7
  property :contributor, predicate: RDF::Vocab::DC.contributor do |index|
@@ -0,0 +1,10 @@
1
+ module Hydra::Collections
2
+ module RequiredMetadata
3
+ extend ActiveSupport::Concern
4
+ included do
5
+ property :depositor, predicate: RDF::Vocab::MARCRelators.dpt, multiple: false do |index|
6
+ index.as :symbol, :stored_searchable
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ require 'rails/generators'
2
+
3
+ module Hydra::Collections
4
+ class Install < Rails::Generators::Base
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ desc 'This generator makes the following changes to your application:
8
+ 1. Creates a collection model.
9
+ '
10
+
11
+ def collection
12
+ copy_file "collection.rb", "app/models/collection.rb"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ class Collection < ActiveFedora::Base
2
+ include Hydra::Collection
3
+
4
+ # You can replace these metadata if they're not suitable
5
+ include Hydra::Collections::BasicMetadata
6
+ end
7
+
@@ -1,5 +1,5 @@
1
1
  module Hydra
2
2
  module Collections
3
- VERSION = "8.0.0"
3
+ VERSION = "8.1.0"
4
4
  end
5
5
  end
@@ -5,6 +5,7 @@ describe OtherCollectionsController, :type => :controller do
5
5
  before(:all) do
6
6
  class OtherCollection < ActiveFedora::Base
7
7
  include Hydra::Collection
8
+ property :title, predicate: ::RDF::Vocab::DC.title
8
9
  end
9
10
 
10
11
  class Member < ActiveFedora::Base
@@ -21,6 +21,12 @@ class TestAppGenerator < Rails::Generators::Base
21
21
  generate 'hydra:head', '-f'
22
22
  end
23
23
 
24
+ def run_collections_generator
25
+ say_status("warning", "GENERATING Collection", :yellow)
26
+
27
+ generate 'hydra:collections:install'
28
+ end
29
+
24
30
  def run_migrations
25
31
  rake("db:migrate")
26
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-collections
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0
4
+ version: 8.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carolyn Cole
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-24 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: hydra-head
@@ -161,9 +161,11 @@ files:
161
161
  - app/controllers/concerns/hydra/collections_controller_behavior.rb
162
162
  - app/helpers/batch_select_helper.rb
163
163
  - app/helpers/collections_helper.rb
164
+ - app/helpers/hydra/collections/collections_helper_behavior.rb
164
165
  - app/models/collection.rb
165
166
  - app/models/concerns/hydra/collection.rb
166
- - app/models/concerns/hydra/collections/metadata.rb
167
+ - app/models/concerns/hydra/collections/basic_metadata.rb
168
+ - app/models/concerns/hydra/collections/required_metadata.rb
167
169
  - app/models/concerns/hydra/collections/solr_document_behavior.rb
168
170
  - app/models/solr_document.rb
169
171
  - app/search_builders/hydra/collections/member_search_builder.rb
@@ -199,6 +201,8 @@ files:
199
201
  - gemfiles/rails3.gemfile
200
202
  - gemfiles/rails4.gemfile
201
203
  - hydra-collections.gemspec
204
+ - lib/generators/hydra/collections/install_generator.rb
205
+ - lib/generators/hydra/collections/templates/collection.rb
202
206
  - lib/hydra-collections.rb
203
207
  - lib/hydra/collections/accepts_batches.rb
204
208
  - lib/hydra/collections/search_service.rb