curation_concerns 1.7.8 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -6
  3. data/CONTRIBUTING.md +20 -68
  4. data/app/actors/curation_concerns/actors/add_as_member_of_collections_actor.rb +23 -0
  5. data/app/actors/curation_concerns/actors/add_to_work_actor.rb +4 -16
  6. data/app/actors/curation_concerns/actors/apply_order_actor.rb +5 -16
  7. data/app/assets/javascripts/curation_concerns/file_manager/sorting.es6 +7 -17
  8. data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +6 -2
  9. data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +2 -11
  10. data/app/controllers/concerns/curation_concerns/download_behavior.rb +0 -6
  11. data/app/forms/curation_concerns/forms/work_form.rb +10 -10
  12. data/app/indexers/curation_concerns/collection_indexer.rb +5 -0
  13. data/app/indexers/curation_concerns/work_indexer.rb +2 -0
  14. data/app/jobs/characterize_job.rb +5 -12
  15. data/app/jobs/create_derivatives_job.rb +5 -10
  16. data/app/jobs/ingest_file_job.rb +9 -13
  17. data/app/models/concerns/curation_concerns/ability.rb +0 -1
  18. data/app/models/concerns/curation_concerns/collection.rb +14 -0
  19. data/app/models/concerns/curation_concerns/required_metadata.rb +4 -0
  20. data/app/models/concerns/curation_concerns/solr_document_behavior.rb +4 -0
  21. data/app/models/concerns/curation_concerns/work_behavior.rb +0 -6
  22. data/app/presenters/curation_concerns/admin/workflow_role_presenter.rb +0 -4
  23. data/app/presenters/curation_concerns/collection_presenter.rb +4 -0
  24. data/app/presenters/curation_concerns/work_show_presenter.rb +52 -19
  25. data/app/search_builders/curation_concerns/collection_member_search_builder.rb +15 -1
  26. data/app/services/curation_concerns/actors/actor_factory.rb +1 -2
  27. data/app/services/curation_concerns/workflow/grant_edit_to_depositor.rb +1 -1
  28. data/app/services/curation_concerns/workflow/permission_query.rb +1 -4
  29. data/app/services/curation_concerns/workflow/workflow_factory.rb +1 -1
  30. data/app/services/curation_concerns/workflow/workflow_importer.rb +0 -1
  31. data/app/services/curation_concerns/workflow/workflow_schema.rb +0 -1
  32. data/app/views/catalog/_action_menu_partials/_default.html.erb +1 -7
  33. data/app/views/collections/_document_header.html.erb +0 -4
  34. data/app/views/collections/_edit_actions.html.erb +0 -1
  35. data/app/views/collections/_form.html.erb +1 -0
  36. data/app/views/collections/_show_actions.html.erb +1 -1
  37. data/app/views/collections/edit.html.erb +2 -2
  38. data/app/views/curation_concerns/admin/workflow_roles/index.html.erb +2 -1
  39. data/app/views/curation_concerns/base/_attributes.html.erb +3 -0
  40. data/app/views/curation_concerns/base/_file_manager_member_resource_options.html.erb +2 -2
  41. data/app/views/curation_concerns/base/_file_manager_members.html.erb +5 -13
  42. data/app/views/curation_concerns/base/_file_manager_resource_form.html.erb +1 -1
  43. data/app/views/curation_concerns/base/_form.html.erb +0 -5
  44. data/app/views/curation_concerns/base/_form_member_of_collections.html.erb +4 -0
  45. data/app/views/curation_concerns/base/_form_supplementary_fields.html.erb +1 -0
  46. data/app/views/curation_concerns/base/_member_of_collections.html.erb +10 -0
  47. data/app/views/curation_concerns/base/_show_actions.html.erb +0 -4
  48. data/app/views/curation_concerns/base/file_manager.html.erb +2 -2
  49. data/app/views/curation_concerns/base/show.json.jbuilder +1 -2
  50. data/config/locales/curation_concerns.en.yml +0 -4
  51. data/curation_concerns.gemspec +3 -2
  52. data/lib/curation_concerns/version.rb +1 -1
  53. data/lib/generators/curation_concerns/templates/catalog_controller.rb +1 -0
  54. data/spec/actors/curation_concerns/apply_order_actor_spec.rb +0 -20
  55. data/spec/actors/curation_concerns/work_actor_spec.rb +10 -14
  56. data/spec/controllers/curation_concerns/collections_controller_spec.rb +19 -14
  57. data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +1 -2
  58. data/spec/controllers/downloads_controller_spec.rb +6 -5
  59. data/spec/features/collection_spec.rb +21 -6
  60. data/spec/features/create_child_work_spec.rb +2 -16
  61. data/spec/features/create_work_spec.rb +6 -13
  62. data/spec/features/work_generator_spec.rb +0 -9
  63. data/spec/forms/work_form_spec.rb +0 -8
  64. data/spec/indexers/collection_indexer_spec.rb +14 -0
  65. data/spec/models/collection_spec.rb +11 -48
  66. data/spec/models/curation_concerns/work_behavior_spec.rb +3 -3
  67. data/spec/models/file_set_spec.rb +3 -2
  68. data/spec/presenters/curation_concerns/work_show_presenter_spec.rb +21 -27
  69. data/spec/services/curation_concerns/workflow/grant_edit_to_depositor_spec.rb +4 -15
  70. data/spec/services/curation_concerns/workflow/permission_query_spec.rb +1 -7
  71. data/spec/services/curation_concerns/workflow/workflow_importer_spec.rb +2 -5
  72. data/spec/services/curation_concerns/workflow/workflow_schema_spec.rb +0 -1
  73. data/spec/services/graph_exporter_spec.rb +3 -3
  74. data/spec/views/curation_concerns/base/_show_actions.html.erb_spec.rb +1 -1
  75. data/spec/views/curation_concerns/base/file_manager.html.erb_spec.rb +8 -10
  76. data/spec/views/curation_concerns/base/show.json.jbuilder_spec.rb +1 -3
  77. metadata +28 -32
  78. data/app/actors/curation_concerns/actors/add_to_collection_actor.rb +0 -42
  79. data/app/actors/curation_concerns/optimistic_lock_validator.rb +0 -28
  80. data/app/forms/curation_concerns/forms/file_manager_form.rb +0 -27
  81. data/app/presenters/curation_concerns/member_presenter_factory.rb +0 -70
  82. data/app/search_builders/curation_concerns/member_search_builder.rb +0 -21
  83. data/app/views/catalog/_action_menu_partials/_collection.html.erb +0 -27
  84. data/app/views/curation_concerns/base/_form_in_works_error.html.erb +0 -3
  85. data/app/views/curation_concerns/base/_form_ordered_members_error.html.erb +0 -3
  86. data/db/migrate/20170308175556_add_allows_access_grant_to_workflow.rb +0 -5
  87. data/spec/actors/curation_concerns/add_to_collections_actor_spec.rb +0 -66
  88. data/spec/actors/curation_concerns/optimistic_lock_validator_spec.rb +0 -50
  89. data/spec/forms/curation_concerns/forms/file_manager_form_spec.rb +0 -19
  90. data/spec/presenters/curation_concerns/member_presenter_factory_spec.rb +0 -25
  91. data/spec/views/curation_concerns/admin/workflow_roles/index.html.erb_spec.rb +0 -33
  92. data/spec/views/curation_concerns/base/_form.html.erb_spec.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a681705ed653f7605fe78f44af4ade8382734e0c
4
- data.tar.gz: 0c2e6dad3418467ee07c40fe957eb8f56a33437d
3
+ metadata.gz: e81b2b7327614964ca1080ca909509a8507c50da
4
+ data.tar.gz: fabb27df90a8acf516119dce697de849f7c9844c
5
5
  SHA512:
6
- metadata.gz: 2fca920f434f86d6ba0146607990eb67cabe995bb92ebf3c84d75655ed765603fc3b47f633cb10da288805a068c88d52c24d3770a5082daadecec56d62d9da0b
7
- data.tar.gz: d33856151b74580627f68ca147a2071b3bb20c88db74c6a6b8abd02e7fae044060168ccfe098b17596bcd7ba9b34576d26d0b7bb2b2076e4a040370fe229a1b6
6
+ metadata.gz: 9ef801991780a893dc44f81f87ca732b2760822db90fef34329b51ea1970e591debb298f59ec8b9af811e9b9ba851656e4bd8313b77f15e2ae93057c8a3c5bd2
7
+ data.tar.gz: db8aa95e273ca9bff4ddce19a82f36c36142359f426d0876c6c96e9aa098d25b571b3f3f12d42e1c5a3d959b18da66488342ace5c9ab84822b0c21f8f7f82535
data/.travis.yml CHANGED
@@ -1,12 +1,8 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  sudo: false
4
-
5
4
  rvm:
6
5
  - 2.3.1
7
-
8
- services: redis
9
-
10
6
  env:
11
7
  global:
12
8
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
@@ -14,7 +10,6 @@ env:
14
10
  - RAILS_VERSION=4.2.7.1
15
11
  RDF_VERSION=1.99.1
16
12
  - RAILS_VERSION=5.0.0.1
17
- RDF_VERSION=2.1.1
18
-
13
+ RDF_VERSION=2.1.0
19
14
  before_script:
20
15
  - jdk_switcher use oraclejdk8
data/CONTRIBUTING.md CHANGED
@@ -3,13 +3,6 @@
3
3
  We want your help to make Project Hydra great.
4
4
  There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
5
5
 
6
- ## Code of Conduct
7
-
8
- The Hydra community is dedicated to providing a welcoming and positive experience for all its
9
- members, whether they are at a formal gathering, in a social setting, or taking part in activities
10
- online. Please see our [Code of Conduct](https://wiki.duraspace.org/display/hydra/Code+of+Conduct)
11
- for more information.
12
-
13
6
  ## Hydra Project Intellectual Property Licensing and Ownership
14
7
 
15
8
  All code contributors must have an Individual Contributor License Agreement (iCLA) on file with the Hydra Project Steering Group.
@@ -17,16 +10,12 @@ If the contributor works for an institution, the institution must have a Corpora
17
10
 
18
11
  https://wiki.duraspace.org/display/hydra/Hydra+Project+Intellectual+Property+Licensing+and+Ownership
19
12
 
20
- You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
21
-
22
13
  ## Contribution Tasks
23
14
 
24
15
  * Reporting Issues
25
16
  * Making Changes
26
- * Documenting Code
27
- * Committing Changes
28
17
  * Submitting Changes
29
- * Reviewing and Merging Changes
18
+ * Merging Changes
30
19
 
31
20
  ### Reporting Issues
32
21
 
@@ -47,28 +36,8 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
47
36
  * Then checkout the new branch with `git checkout fix/master/my_contribution`.
48
37
  * Please avoid working directly on the `master` branch.
49
38
  * You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
50
- * Make sure you have added sufficient tests and documentation for your changes.
51
- * Test functionality with RSpec; est features / UI with Capybara.
52
- * Run _all_ the tests to assure nothing else was accidentally broken.
53
-
54
- ### Documenting Code
55
-
56
- * All new public methods, modules, and classes should include inline documentation in [YARD](http://yardoc.org/).
57
- * Documentation should seek to answer the question "why does this code exist?"
58
- * Document private / protected methods as desired.
59
- * If you are working in a file with no prior documentation, do try to document as you gain understanding of the code.
60
- * If you don't know exactly what a bit of code does, it is extra likely that it needs to be documented. Take a stab at it and ask for feedback in your pull request. You can use the 'blame' button on GitHub to identify the original developer of the code and @mention them in your comment.
61
- * This work greatly increases the usability of the code base and supports the on-ramping of new committers.
62
- * We will all be understanding of one another's time constraints in this area.
63
- * YARD examples:
64
- * [Hydra::Works::RemoveGenericFile](https://github.com/projecthydra-labs/hydra-works/blob/master/lib/hydra/works/services/generic_work/remove_generic_file.rb)
65
- * [ActiveTriples::LocalName::Minter](https://github.com/ActiveTriples/active_triples-local_name/blob/master/lib/active_triples/local_name/minter.rb)
66
- * [Getting started with YARD](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
67
-
68
- ### Committing changes
69
-
70
39
  * Make commits of logical units.
71
- * Your commit should include a high level description of your work in HISTORY.textile
40
+ * Your commit should include a high level description of your work in HISTORY.textile
72
41
  * Check for unnecessary whitespace with `git diff --check` before committing.
73
42
  * Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
74
43
  * If you created an issue, you can close it by including "Closes #issue" in your commit message. See [Github's blog post for more details](https://github.com/blog/1386-closing-issues-via-commit-messages)
@@ -89,9 +58,7 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
89
58
 
90
59
  class PostsController
91
60
  def index
92
- respond_to do |wants|
93
- wants.html { render 'index' }
94
- end
61
+ respond_with Post.limit(10)
95
62
  end
96
63
  end
97
64
 
@@ -103,53 +70,38 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
103
70
  long to fit in 72 characters
104
71
  ```
105
72
 
73
+ * Make sure you have added the necessary tests for your changes.
74
+ * Run _all_ the tests to assure nothing else was accidentally broken.
75
+ * When you are ready to submit a pull request
76
+
106
77
  ### Submitting Changes
107
78
 
79
+ [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
80
+
108
81
  * Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
109
82
  * Make sure your branch is up to date with its parent branch (i.e. master)
110
83
  * `git checkout master`
111
84
  * `git pull --rebase`
112
85
  * `git checkout <your-branch>`
113
86
  * `git rebase master`
114
- * It is a good idea to run your tests again.
115
- * If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
116
- * [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
117
- * `git rebase --interactive master` ([See Github help](https://help.github.com/articles/interactive-rebase))
87
+ * It is likely a good idea to run your tests again.
88
+ * Squash the commits for your branch into one commit
89
+ * `git rebase --interactive HEAD~<number-of-commits>` ([See Github help](https://help.github.com/articles/interactive-rebase))
90
+ * To determine the number of commits on your branch: `git log master..<your-branch> --oneline | wc -l`
118
91
  * Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
119
92
  * Push your changes to a topic branch in your fork of the repository.
120
93
  * Submit a pull request from your fork to the project.
121
94
 
122
- ### Reviewing and Merging Changes
123
-
124
- We adopted [Github's Pull Request Review](https://help.github.com/articles/about-pull-request-reviews/) for our repositories.
125
- Common checks that may occur in our repositories:
126
-
127
- 1. Travis CI - where our automated tests are running
128
- 2. Hound CI - where we check for style violations
129
- 3. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
130
- 4. CodeClimate - is our code remaining healthy (at least according to static code analysis)
131
-
132
- If one or more of the required checks failed (or are incomplete), the code should not be merged (and the UI will not allow it). If all of the checks have passed, then anyone on the project (including the pull request submitter) may merge the code.
133
-
134
- *Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (Travis CI is usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request.*
135
-
136
- #### Things to Consider When Reviewing
137
-
138
- First, the person contributing the code is putting themselves out there. Be mindful of what you say in a review.
139
-
140
- * Ask clarifying questions
141
- * State your understanding and expectations
142
- * Provide example code or alternate solutions, and explain why
143
-
144
- This is your chance for a mentoring moment of another developer. Take time to give an honest and thorough review of what has changed. Things to consider:
95
+ ### Merging Changes
145
96
 
97
+ * It is considered "poor from" to merge your own request.
98
+ * Please take the time to review the changes and get a sense of what is being changed. Things to consider:
146
99
  * Does the commit message explain what is going on?
147
- * Does the code changes have tests? _Not all changes need new tests, some changes are refactors_
148
- * Do new or changed methods, modules, and classes have documentation?
100
+ * Does the code changes have tests? _Not all changes need new tests, some changes are refactorings_
149
101
  * Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
150
- * Does the description of the new/changed specs match your understanding of what the spec is doing?
151
-
152
- If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
102
+ * Did the Travis tests complete successfully?
103
+ * If you are uncertain, bring other contributors into the conversation by creating a comment that includes their @username.
104
+ * If you like the pull request, but want others to chime in, create a +1 comment and tag a user.
153
105
 
154
106
  # Additional Resources
155
107
 
@@ -0,0 +1,23 @@
1
+ module CurationConcerns
2
+ module Actors
3
+ class AddAsMemberOfCollectionsActor < AbstractActor
4
+ def create(attributes)
5
+ collection_ids = attributes.delete(:member_of_collection_ids)
6
+ add_to_collections(collection_ids) && next_actor.create(attributes)
7
+ end
8
+
9
+ def update(attributes)
10
+ collection_ids = attributes.delete(:member_of_collection_ids)
11
+ add_to_collections(collection_ids) && next_actor.update(attributes)
12
+ end
13
+
14
+ private
15
+
16
+ # Maps from collection ids to collection objects
17
+ def add_to_collections(collection_ids)
18
+ return true unless collection_ids
19
+ curation_concern.member_of_collections = collection_ids.map { |id| ::Collection.find(id) }
20
+ end
21
+ end
22
+ end
23
+ end
@@ -13,14 +13,6 @@ module CurationConcerns
13
13
 
14
14
  private
15
15
 
16
- def ability
17
- ::Ability.new(user)
18
- end
19
-
20
- def can_edit_both_works?(work)
21
- ability.can?(:edit, work) && ability.can?(:edit, curation_concern)
22
- end
23
-
24
16
  def add_to_works(new_work_ids)
25
17
  return true if new_work_ids.nil?
26
18
  (curation_concern.in_works_ids - new_work_ids).each do |old_id|
@@ -30,17 +22,13 @@ module CurationConcerns
30
22
  work.save
31
23
  end
32
24
 
33
- # add to new so long as the depositor for the parent and child matches, otherwise inject an error
25
+ # add to new
34
26
  (new_work_ids - curation_concern.in_works_ids).each do |work_id|
35
27
  work = ::ActiveFedora::Base.find(work_id)
36
- if can_edit_both_works?(work)
37
- work.ordered_members << curation_concern
38
- work.save
39
- else
40
- curation_concern.errors[:in_works_ids] << "Works can only be related to each other if user has ability to edit both."
41
- end
28
+ work.ordered_members << curation_concern
29
+ work.save
42
30
  end
43
- curation_concern.errors[:in_works_ids].empty?
31
+ true
44
32
  end
45
33
  end
46
34
  end
@@ -3,19 +3,12 @@ module CurationConcerns
3
3
  class ApplyOrderActor < AbstractActor
4
4
  def update(attributes)
5
5
  ordered_member_ids = attributes.delete(:ordered_member_ids)
6
- sync_members(ordered_member_ids) && apply_order(ordered_member_ids) && next_actor.update(attributes)
6
+ sync_members(ordered_member_ids)
7
+ apply_order(ordered_member_ids) && next_actor.update(attributes)
7
8
  end
8
9
 
9
10
  private
10
11
 
11
- def ability
12
- ::Ability.new(user)
13
- end
14
-
15
- def can_edit_both_works?(work)
16
- ability.can?(:edit, work) && ability.can?(:edit, curation_concern)
17
- end
18
-
19
12
  def sync_members(ordered_member_ids)
20
13
  return true if ordered_member_ids.nil?
21
14
  existing_members_ids = curation_concern.ordered_member_ids
@@ -27,14 +20,10 @@ module CurationConcerns
27
20
 
28
21
  (ordered_member_ids - existing_members_ids).each do |work_id|
29
22
  work = ::ActiveFedora::Base.find(work_id)
30
- if can_edit_both_works?(work)
31
- curation_concern.ordered_members << work
32
- curation_concern.save
33
- else
34
- curation_concern.errors[:ordered_member_ids] << "Works can only be related to each other if user has ability to edit both."
35
- end
23
+ curation_concern.ordered_members << work
36
24
  end
37
- curation_concern.errors[:ordered_member_ids].empty?
25
+ curation_concern.save
26
+ true
38
27
  end
39
28
 
40
29
  def apply_order(new_order)
@@ -15,14 +15,18 @@ export default class SortManager {
15
15
  }
16
16
 
17
17
  persist() {
18
+ let params = {}
19
+ params[this.singular_class_name] = {
20
+ "ordered_member_ids": this.order
21
+ }
22
+ params["_method"] = "PATCH"
18
23
  this.element.addClass("pending")
19
24
  this.element.removeClass("success")
20
25
  this.element.removeClass("failure")
21
26
  let persisting = $.post(
22
27
  `/concern/${this.class_name}/${this.id}.json`,
23
- this.params()
24
- ).done((response) => {
25
- this.element.data('version', response.version)
28
+ params
29
+ ).done(() => {
26
30
  this.element.data("current-order", this.order)
27
31
  this.element.addClass("success")
28
32
  this.element.removeClass("failure")
@@ -35,16 +39,6 @@ export default class SortManager {
35
39
  return persisting
36
40
  }
37
41
 
38
- params() {
39
- let params = {}
40
- params[this.singular_class_name] = {
41
- "version": this.version,
42
- "ordered_member_ids": this.order
43
- }
44
- params["_method"] = "PATCH"
45
- return params
46
- }
47
-
48
42
  get_sort_position(item) {
49
43
  return this.element.children().index(item)
50
44
  }
@@ -94,10 +88,6 @@ export default class SortManager {
94
88
  ).toArray()
95
89
  }
96
90
 
97
- get version() {
98
- return this.element.data('version')
99
- }
100
-
101
91
  get alpha_sort_button() {
102
92
  return $("*[data-action='alpha-sort-action']")
103
93
  }
@@ -250,11 +250,15 @@ module CurationConcerns
250
250
 
251
251
  def add_members_to_collection(collection = nil)
252
252
  collection ||= @collection
253
- collection.add_members batch
253
+ collection.add_member_objects batch
254
254
  end
255
255
 
256
256
  def remove_members_from_collection
257
- @collection.members.delete(batch.map { |pid| ActiveFedora::Base.find(pid) })
257
+ batch.each do |pid|
258
+ work = ActiveFedora::Base.find(pid)
259
+ work.member_of_collections.delete @collection
260
+ work.save!
261
+ end
258
262
  end
259
263
 
260
264
  def assign_batch_to_collection
@@ -22,11 +22,6 @@ module CurationConcerns
22
22
  module ClassMethods
23
23
  def curation_concern_type=(curation_concern_type)
24
24
  load_and_authorize_resource class: curation_concern_type, instance_name: :curation_concern, except: [:show, :file_manager, :inspect_work]
25
-
26
- # Load the fedora resource to get the etag.
27
- # No need to authorize for the file manager, because it does authorization via the presenter.
28
- load_resource class: curation_concern_type, instance_name: :curation_concern, only: :file_manager
29
-
30
25
  self._curation_concern_type = curation_concern_type
31
26
  end
32
27
 
@@ -109,7 +104,7 @@ module CurationConcerns
109
104
  end
110
105
 
111
106
  def file_manager
112
- @form = Forms::FileManagerForm.new(curation_concern, current_ability)
107
+ presenter
113
108
  end
114
109
 
115
110
  def inspect_work
@@ -123,6 +118,7 @@ module CurationConcerns
123
118
 
124
119
  def build_form
125
120
  @form = work_form_service.build(curation_concern, current_ability)
121
+ @collections = ::Collection.all
126
122
  end
127
123
 
128
124
  def actor
@@ -222,7 +218,6 @@ module CurationConcerns
222
218
  message = I18n.t("curation_concerns.workflow.unauthorized")
223
219
  respond_to do |wants|
224
220
  wants.html do
225
- unavailable_presenter
226
221
  flash[:notice] = message
227
222
  render 'unavailable', status: :unauthorized
228
223
  end
@@ -241,9 +236,5 @@ module CurationConcerns
241
236
  end
242
237
  end
243
238
  end
244
-
245
- def unavailable_presenter
246
- @presenter ||= show_presenter.new(::SolrDocument.find(params[:id]), current_ability, request)
247
- end
248
239
  end
249
240
  end
@@ -40,12 +40,6 @@ module CurationConcerns
40
40
  # that files are in a LDP basic container, and thus, included in the asset's uri.
41
41
  def authorize_download!
42
42
  authorize! :read, params[asset_param_key]
43
- rescue CanCan::AccessDenied
44
- redirect_to default_image
45
- end
46
-
47
- def default_image
48
- ActionController::Base.helpers.image_path 'default.png'
49
43
  end
50
44
 
51
45
  # Overrides Hydra::Controller::DownloadBehavior#load_file, which is hard-coded to assume files are in BasicContainer.
@@ -7,7 +7,7 @@ module CurationConcerns
7
7
  delegate :human_readable_type, :open_access?, :authenticated_only_access?,
8
8
  :open_access_with_embargo_release_date?, :private_access?,
9
9
  :embargo_release_date, :lease_expiration_date, :member_ids,
10
- :visibility, :in_works_ids, to: :model
10
+ :visibility, :in_works_ids, :member_of_collection_ids, to: :model
11
11
 
12
12
  self.terms = [:title, :creator, :contributor, :description,
13
13
  :keyword, :rights, :publisher, :date_created, :subject, :language,
@@ -15,7 +15,8 @@ module CurationConcerns
15
15
  :representative_id, :thumbnail_id, :files,
16
16
  :visibility_during_embargo, :embargo_release_date, :visibility_after_embargo,
17
17
  :visibility_during_lease, :lease_expiration_date, :visibility_after_lease,
18
- :visibility, :ordered_member_ids, :source, :in_works_ids]
18
+ :visibility, :ordered_member_ids, :source, :in_works_ids,
19
+ :member_of_collection_ids]
19
20
 
20
21
  self.required_fields = [:title]
21
22
 
@@ -26,10 +27,6 @@ module CurationConcerns
26
27
  super(model)
27
28
  end
28
29
 
29
- def version
30
- model.etag
31
- end
32
-
33
30
  # The value for embargo_relase_date and lease_expiration_date should not
34
31
  # be initialized to empty string
35
32
  def initialize_field(key)
@@ -42,6 +39,11 @@ module CurationConcerns
42
39
  Hash[file_presenters.map { |file| [file.to_s, file.id] }]
43
40
  end
44
41
 
42
+ # Get a list of collection id/title pairs for the select form
43
+ def collections_for_select
44
+ ::Collection.all.map { |col| [col.first_title, col.id] }
45
+ end
46
+
45
47
  class << self
46
48
  # This determines whether the allowed parameters are single or multiple.
47
49
  # By default it delegates to the model.
@@ -51,14 +53,12 @@ module CurationConcerns
51
53
  true
52
54
  when 'in_works_ids'
53
55
  true
56
+ when 'member_of_collection_ids'
57
+ true
54
58
  else
55
59
  super
56
60
  end
57
61
  end
58
-
59
- def build_permitted_params
60
- super + [:version]
61
- end
62
62
  end
63
63
 
64
64
  private