curation_concerns 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +8 -0
  4. data/Gemfile +1 -2
  5. data/README.md +1 -1
  6. data/Rakefile +1 -1
  7. data/VERSION +1 -1
  8. data/app/assets/javascripts/curation_concerns/curation_concerns.js +2 -0
  9. data/app/assets/javascripts/curation_concerns/uploader.js +4 -4
  10. data/app/assets/stylesheets/curation_concerns/_modules.scss +1 -0
  11. data/app/assets/stylesheets/curation_concerns/_positioning.scss +3 -0
  12. data/app/assets/stylesheets/curation_concerns/modules/icons.scss +11 -0
  13. data/app/controllers/concerns/curation_concerns/api.rb +1 -12
  14. data/app/controllers/concerns/curation_concerns/application_controller_behavior.rb +20 -6
  15. data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +44 -25
  16. data/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb +32 -23
  17. data/app/controllers/concerns/curation_concerns/parent_container.rb +0 -11
  18. data/app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb +1 -1
  19. data/app/controllers/concerns/curation_concerns/single_use_links_viewer_controller_behavior.rb +7 -1
  20. data/app/controllers/concerns/curation_concerns/upload_sets_controller_behavior.rb +19 -7
  21. data/app/controllers/curation_concerns/permissions_controller.rb +1 -1
  22. data/app/forms/curation_concerns/forms/collection_edit_form.rb +6 -2
  23. data/app/forms/curation_concerns/forms/work_form.rb +14 -3
  24. data/app/forms/curation_concerns/upload_set_form.rb +43 -0
  25. data/app/helpers/curation_concerns/ability_helper.rb +12 -18
  26. data/app/helpers/curation_concerns/file_set_helper.rb +1 -1
  27. data/app/helpers/curation_concerns/main_app_helpers.rb +1 -0
  28. data/app/helpers/curation_concerns/permissions_helper.rb +20 -0
  29. data/app/helpers/curation_concerns/url_helper.rb +3 -11
  30. data/app/inputs/multi_value_with_help_input.rb +8 -0
  31. data/app/inputs/select_with_help_input.rb +3 -0
  32. data/app/inputs/select_with_modal_help_input.rb +36 -0
  33. data/app/inputs/with_help_icon.rb +34 -0
  34. data/app/presenters/curation_concerns/collection_presenter.rb +9 -0
  35. data/app/presenters/curation_concerns/file_set_presenter.rb +2 -1
  36. data/app/presenters/curation_concerns/presents_attributes.rb +16 -0
  37. data/app/presenters/curation_concerns/work_show_presenter.rb +3 -2
  38. data/app/renderers/curation_concerns/attribute_renderer.rb +22 -4
  39. data/app/renderers/curation_concerns/configured_microdata.rb +40 -0
  40. data/app/services/curation_concerns/parent_service.rb +1 -1
  41. data/app/views/catalog/_action_menu_partials/_default.html.erb +2 -2
  42. data/app/views/collections/_form.html.erb +8 -9
  43. data/app/views/collections/_sort_and_per_page.html.erb +25 -23
  44. data/app/views/collections/show.html.erb +1 -1
  45. data/app/views/curation_concerns/base/_attributes.html.erb +1 -1
  46. data/app/views/curation_concerns/base/_form.html.erb +6 -7
  47. data/app/views/curation_concerns/base/_form_permission.html.erb +3 -0
  48. data/app/views/curation_concerns/base/_multiple_upload.html.erb +3 -0
  49. data/app/views/curation_concerns/base/_show_actions.html.erb +2 -2
  50. data/app/views/curation_concerns/base/_versioning.html.erb +1 -1
  51. data/app/views/curation_concerns/base/_visibility.html.erb +17 -0
  52. data/app/views/curation_concerns/base/show.html.erb +1 -1
  53. data/app/views/curation_concerns/classify_concerns/new.html.erb +1 -1
  54. data/app/views/curation_concerns/file_sets/_actions.html.erb +2 -2
  55. data/app/views/curation_concerns/file_sets/_form.html.erb +1 -1
  56. data/app/views/curation_concerns/file_sets/_rights_modal.html.erb +41 -0
  57. data/app/views/curation_concerns/file_sets/media_display/_default.html.erb +4 -1
  58. data/app/views/curation_concerns/file_sets/media_display/_image.html.erb +9 -8
  59. data/app/views/curation_concerns/file_sets/media_display/_office_document.html.erb +9 -7
  60. data/app/views/curation_concerns/file_sets/media_display/_pdf.html.erb +7 -5
  61. data/app/views/curation_concerns/file_sets/show.html.erb +2 -2
  62. data/app/views/curation_concerns/file_sets/upload/_alerts.html.erb +3 -3
  63. data/app/views/curation_concerns/file_sets/upload/_form.html.erb +1 -1
  64. data/app/views/curation_concerns/file_sets/upload/_script_templates.html.erb +1 -1
  65. data/app/views/curation_concerns/permissions/confirm.html.erb +1 -1
  66. data/app/views/curation_concerns/single_use_links_viewer/show.html.erb +1 -1
  67. data/app/views/embargoes/edit.html.erb +4 -4
  68. data/app/views/layouts/curation_concerns.html.erb +1 -1
  69. data/app/views/leases/edit.html.erb +3 -3
  70. data/app/views/shared/_add_works.html.erb +6 -3
  71. data/app/views/upload_sets/_base_metadata.html.erb +12 -0
  72. data/app/views/upload_sets/_metadata.html.erb +3 -13
  73. data/app/views/upload_sets/edit.html.erb +1 -1
  74. data/config/locales/curation_concerns.en.yml +46 -0
  75. data/curation_concerns.gemspec +5 -4
  76. data/lib/curation_concerns/engine.rb +5 -0
  77. data/lib/curation_concerns/form_builder.rb +16 -0
  78. data/lib/curation_concerns/rails/routes.rb +7 -5
  79. data/lib/generators/curation_concerns/install_generator.rb +1 -1
  80. data/lib/generators/curation_concerns/work/work_generator.rb +1 -1
  81. data/spec/actors/curation_concerns/file_set_actor_spec.rb +26 -16
  82. data/spec/controllers/curation_concerns/file_sets_controller_json_spec.rb +14 -4
  83. data/spec/controllers/curation_concerns/file_sets_controller_spec.rb +3 -3
  84. data/spec/controllers/curation_concerns/generic_works_controller_json_spec.rb +4 -4
  85. data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +21 -0
  86. data/spec/controllers/curation_concerns/single_use_links_controller_spec.rb +2 -2
  87. data/spec/controllers/curation_concerns/single_use_links_viewer_controller_spec.rb +1 -1
  88. data/spec/controllers/upload_sets_controller_spec.rb +20 -27
  89. data/spec/factories/file_sets.rb +1 -0
  90. data/spec/factories/generic_works.rb +1 -0
  91. data/spec/factories/users.rb +0 -12
  92. data/spec/features/collection_spec.rb +1 -3
  93. data/spec/forms/collection_edit_form_spec.rb +16 -1
  94. data/spec/forms/upload_set_form_spec.rb +55 -0
  95. data/spec/forms/work_form_spec.rb +68 -3
  96. data/spec/helpers/curation_concerns/ability_helper_spec.rb +45 -0
  97. data/spec/helpers/curation_concerns/permissions_helper_spec.rb +12 -0
  98. data/spec/helpers/url_helper_spec.rb +0 -3
  99. data/spec/indexers/collection_indexer_spec.rb +5 -0
  100. data/spec/indexers/{file_set_indexing_service_spec.rb → file_set_indexer_spec.rb} +40 -2
  101. data/spec/indexers/{generic_work_indexing_service_spec.rb → work_indexer_spec.rb} +1 -1
  102. data/spec/inputs/multi_value_with_help_input_spec.rb +32 -0
  103. data/spec/inputs/select_with_help_input_spec.rb +43 -0
  104. data/spec/inputs/select_with_modal_help_input_spec.rb +21 -0
  105. data/spec/jobs/import_url_job_spec.rb +33 -1
  106. data/spec/jobs/ingest_file_job_spec.rb +29 -16
  107. data/spec/jobs/upload_set_update_job_spec.rb +24 -11
  108. data/spec/lib/curation_concerns/messages_spec.rb +2 -2
  109. data/spec/lib/curation_concerns/name_spec.rb +20 -0
  110. data/spec/lib/curation_concerns/null_logger_spec.rb +10 -0
  111. data/spec/models/curation_concerns/collection_behavior_spec.rb +41 -10
  112. data/spec/models/curation_concerns/work_behavior_spec.rb +1 -13
  113. data/spec/models/file_set_spec.rb +19 -4
  114. data/spec/models/generic_work_spec.rb +7 -2
  115. data/spec/models/quick_classification_query_spec.rb +35 -0
  116. data/spec/models/upload_set_spec.rb +5 -7
  117. data/spec/presenters/curation_concerns/collection_presenter_spec.rb +20 -0
  118. data/spec/presenters/curation_concerns/file_set_presenter_spec.rb +10 -3
  119. data/spec/presenters/curation_concerns/work_show_presenter_spec.rb +13 -1
  120. data/spec/renderers/curation_concerns/attribute_renderer_spec.rb +41 -8
  121. data/spec/routing/curation_concerns/routes_spec.rb +2 -2
  122. data/spec/routing/route_spec.rb +1 -1
  123. data/spec/services/file_set_audit_service_spec.rb +46 -4
  124. data/spec/spec_helper.rb +5 -7
  125. data/spec/views/collections/_sort_and_per_page.html.erb_spec.rb +32 -0
  126. data/spec/views/curation_concerns/base/_attributes.html.erb_spec.rb +8 -1
  127. data/spec/views/curation_concerns/base/show.html.erb_spec.rb +36 -2
  128. data/spec/views/curation_concerns/file_sets/_file_set.html.erb_spec.rb +3 -2
  129. data/spec/views/curation_concerns/file_sets/show.html.erb_spec.rb +56 -0
  130. data/spec/views/curation_concerns/single_use_links_viewer/show.html.erb_spec.rb +19 -0
  131. data/spec/views/shared/_add_content.html.erb_spec.rb +3 -3
  132. data/spec/views/single_use_links/new_download.html.erb_spec.rb +1 -1
  133. data/spec/views/upload_sets/_metadata.html.erb_spec.rb +28 -0
  134. metadata +80 -50
  135. data/app/assets/stylesheets/curation_concerns/help_requests.scss +0 -3
  136. data/app/controllers/concerns/curation_concerns/without_namespace.rb +0 -16
  137. data/app/controllers/registrations_controller.rb +0 -19
  138. data/app/controllers/sessions_controller.rb +0 -4
  139. data/app/views/curation_concerns/file_sets/_multiple_upload.html.erb +0 -3
  140. data/spec/fixtures/Example.ogg +0 -0
  141. data/spec/fixtures/charter.docx +0 -0
  142. data/spec/fixtures/countdown.avi +0 -0
  143. data/spec/fixtures/curation_concerns_generic_stub.txt +0 -1
  144. data/spec/fixtures/empty_file.txt +0 -0
  145. data/spec/fixtures/files/image.png +0 -0
  146. data/spec/fixtures/image.jp2 +0 -0
  147. data/spec/fixtures/image.jpg +0 -0
  148. data/spec/fixtures/piano_note.wav +0 -0
  149. data/spec/fixtures/sample_mpeg4.mp4 +0 -0
  150. data/spec/fixtures/small_file.txt +0 -1
  151. data/spec/fixtures/spoken-text.m4a +0 -0
  152. data/spec/fixtures/test.pdf +0 -0
  153. data/spec/fixtures/test4.pdf +0 -0
  154. data/spec/fixtures/test5.mp3 +0 -0
  155. data/spec/fixtures/world.png +0 -0
@@ -12,7 +12,7 @@
12
12
  <h3 class="title"><%= klass.human_readable_type %></h3>
13
13
  <p class="short-description"><%= klass.human_readable_short_description %></p>
14
14
  <%= link_to 'Add New',
15
- main_app.new_polymorphic_path([:curation_concerns, klass]),
15
+ main_app.new_polymorphic_path(klass),
16
16
  class: "add-button btn btn-primary #{dom_class(klass, 'add_new')}"
17
17
  %>
18
18
  </li>
@@ -1,11 +1,11 @@
1
1
  <% if can?(:edit, file_set.id) %>
2
- <%= link_to( 'Edit', edit_polymorphic_path([main_app, :curation_concerns, file_set]),
2
+ <%= link_to( 'Edit', edit_polymorphic_path([main_app, file_set]),
3
3
  { class: 'btn btn-default', title: "Edit #{file_set}" }) %>
4
4
  <%= link_to( 'Rollback', main_app.versions_curation_concerns_file_set_path(file_set),
5
5
  { class: 'btn btn-default', title: "Rollback to previous version" }) %>
6
6
  <% end %>
7
7
  <% if can?(:destroy, file_set.id) %>
8
- <%= link_to( 'Delete', polymorphic_path([main_app, :curation_concerns, file_set]),
8
+ <%= link_to( 'Delete', polymorphic_path([main_app, file_set]),
9
9
  class: 'btn btn-default', method: :delete, title: "Delete #{file_set}",
10
10
  data: {confirm: "Deleting #{file_set} from #{t('curation_concerns.product_name')} is permanent. Click OK to delete this from #{t('curation_concerns.product_name')}, or Cancel to cancel this operation"}
11
11
  )%>
@@ -1,4 +1,4 @@
1
- <%= simple_form_for [main_app, :curation_concerns, curation_concern],
1
+ <%= simple_form_for [main_app, curation_concern],
2
2
  html: { multipart: true },
3
3
  wrapper_mappings: { multifile: :horizontal_file_input } do |f| %>
4
4
  <div class="row">
@@ -0,0 +1,41 @@
1
+ <div class="modal-div">
2
+ <!-- Modal -->
3
+ <div class="modal fade" id="rightsModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
4
+ <div class="modal-dialog">
5
+ <div class="modal-content">
6
+ <div class="modal-header">
7
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
8
+ <h2 id="rightsModallLabel"><%= t('sufia.product_name') %> License Descriptions</h2>
9
+ </div>
10
+ <div class="modal-body">
11
+ <p>Creative Commons licenses can take the following combinations, which is what a depositor sees on the page where metadata (descriptions) are entered. Via the drop-down menu, the depositor may select any of the following licenses (these are all described at "About the Licenses" on the Creative Commons site):
12
+ </p> <ul>
13
+ <li><b>Attribution 3.0: CC BY</b><br/>
14
+ With this license you allow others to "distribute, remix, tweak, and build" on your deposited content - including for commercial purposes - provided they attribute you as the original creator.</li>
15
+ <li><b>Attribution-Share-Alike 3.0: CC BY-SA</b> <br/>
16
+ With this license you allow others to "remix, tweak, and build" on your deposited content, including for commercial uses, provided they attribute you as the original creator AND incorporate the same level of licensing (i.e., CC BY-SA) for the newly resulting creation. "All new works based on yours will carry the same license, so any derivatives will also allow commercial use."</li>
17
+ <li><b>Attribution-NoDerivs 3.0: CC BY-ND </b><br/>
18
+ With this license you permit "redistribution, commercial and non-commercial," provided the content remains unaltered and intact (i.e., whole) and provided you are attributed as the original creator.</li>
19
+ <li><b>Attribution-Non-Commercial 3.0: CC BY-NC</b><br/>
20
+ With this license you allow others to "remix, tweak, and build" on your content in non-commercial ways. While they must credit you as the original creator and while the remixed, tweaked, or expanded upon content must remain non-commercial, they do not have to apply identical license terms on the new content.</li>
21
+ <li><b>Attribution-NonCommercial-NoDerivs 3.0 CC BY-NC-ND</b><br/>
22
+ With this license you share your work with others and allow them to download your work, provided they attribute you as the creator and refrain from changing the content in any way and from using it for commercial means. </li>
23
+ <li><b>Attribution-Non-Commercial-Share-Alike 3.0: CC BY-NC-SA</b><br/>
24
+ With this license you allow others to "remix, tweak, and build" on your content in non-commercial ways, provided they give you credit (as the original creator) and also apply the same license level to the newly resulting creations.</li>
25
+ <li><b>Attribution-Non-Commercial-Share-Alike-NoDerivs 3.0: CC BY-NC-SA-ND</b><br/>
26
+ With this license you share your work with others and allow them to download it, provided they attribute you as the creator; they must also refrain from changing the content in any way and from using it for commercial means. </li>
27
+ <li><b>Public Domain Mark 1.0 </b><br/>
28
+ When content is in the public domain, it has no known copyright owner. </li>
29
+ <li><b>CC0 1.0 Universal </b><br/>
30
+ With this license you are waiving your rights as copyright owner to the content you upload. This means your content may be distributed and reused without attribution, without restriction. CC0 is a license that one applies to one's own work; rarely does one apply it to another's work, unless one has the appropriate rights to do so.</li>
31
+ </ul>
32
+ </p>
33
+ <p> Please note: Another license option that is listed is <b>"All rights reserved."</b> With this license you - as the copyright holder - reserve all rights held under copyright law, such as for distribution and creation of derivative works. This means that no one can use your content in a work - such as a presentation or article - or create derivatives from it without your permission.</p>
34
+ </div>
35
+ <div class="modal-footer">
36
+ <button class="btn btn-primary" data-dismiss="modal">Close</button>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ </div>
@@ -1,4 +1,7 @@
1
1
  <%= link_to main_app.download_path(file_set), target: "_new", title: "Download the document" do %>
2
- <%= image_tag "default.png", alt: "No preview available", class: "img-responsive" %>
2
+ <figure>
3
+ <%= image_tag "default.png", alt: "No preview available", class: "img-responsive" %>
4
+ <figcaption>Download the document</figcaption>
5
+ </figure>
3
6
  <% end %>
4
7
 
@@ -1,8 +1,9 @@
1
- <%= link_to main_app.download_path(file_set), target: "_new", title: "Download the full-sized image" do %>
2
- <%= image_tag(main_app.download_path(file_set, file: 'thumbnail'),
3
- class: "img-responsive",
4
- alt: "Download the full-sized image of #{file_set.to_s}"
5
- ) %>
6
- Download the full-sized image
7
- <% end %>
8
-
1
+ <%= link_to main_app.download_path(file_set), target: "_new", title: "Download the full-sized image" do %>
2
+ <figure>
3
+ <%= image_tag(main_app.download_path(file_set, file: 'thumbnail'),
4
+ class: "img-responsive",
5
+ alt: "Download the full-sized image of #{file_set.to_s}"
6
+ ) %>
7
+ <figcaption>Download the full-sized image</figcaption>
8
+ </figure>
9
+ <% end %>
@@ -1,7 +1,9 @@
1
- <%= link_to main_app.download_path(file_set), target: "_new", title: "Download the document" do %>
2
- <%= image_tag(main_app.download_path(file_set, file: 'thumbnail'),
3
- class: "img-responsive",
4
- alt: "Download the document \"#{file_set.to_s}\""
5
- ) %>
6
- Download the document
7
- <% end %>
1
+ <%= link_to main_app.download_path(file_set), target: "_new", title: "Download the document" do %>
2
+ <figure>
3
+ <%= image_tag(main_app.download_path(file_set, file: 'thumbnail'),
4
+ class: "img-responsive",
5
+ alt: "Download the document \"#{file_set.to_s}\""
6
+ ) %>
7
+ <figcaption>Download the document</figcaption>
8
+ </figure>
9
+ <% end %>
@@ -1,7 +1,9 @@
1
- <%= link_to main_app.download_path(file_set), target: "_new", title: "Download the full-sized PDF" do%>
2
- <%= image_tag main_app.download_path(file_set, file: 'thumbnail'),
3
- class: "img-responsive",
4
- alt: "Download the full-sized PDF of #{file_set.to_s}" %>
5
- Download the full-sized PDF
1
+ <%= link_to main_app.download_path(file_set), target: "_new", title: "Download the full-sized PDF" do %>
2
+ <figure>
3
+ <%= image_tag main_app.download_path(file_set, file: 'thumbnail'),
4
+ class: "img-responsive",
5
+ alt: "Download the full-sized PDF of #{file_set.to_s}" %>
6
+ <figcaption>Download the full-sized PDF</figcaption>
7
+ </figure>
6
8
  <% end %>
7
9
 
@@ -1,6 +1,6 @@
1
1
  <% provide :page_title, @presenter.page_title %>
2
2
  <% provide :page_header do %>
3
- <h1>File Details</h1>
3
+ <h1>File Details <small><%= @presenter.title %></small></h1>
4
4
  <% end %>
5
5
  <%= media_display @presenter %>
6
6
  <%= render "attributes", curation_concern: @presenter %>
@@ -8,7 +8,7 @@
8
8
  <div class="form-actions">
9
9
  <%= link_to "Download this File", main_app.download_path(@presenter), class: 'btn btn-default' %>
10
10
  <% if can? :edit, @presenter.id %>
11
- <%= link_to "Edit this File", edit_polymorphic_path([main_app, :curation_concerns, @presenter]), class: 'btn btn-default' %>
11
+ <%= link_to "Edit this File", edit_polymorphic_path([main_app, @presenter]), class: 'btn btn-default' %>
12
12
  <% end %>
13
13
 
14
14
  <%= link_to "Back to #{parent.human_readable_type}", parent_path(parent), class: 'btn btn-default' %>
@@ -2,17 +2,17 @@
2
2
  <div class="alert alert-info hide" id="success">
3
3
  You have successfully uploaded some of your files. Either continue to upload or edit use the links below to abandon the rest of your added files.
4
4
  <p>
5
- <%= link_to 'Add Descriptions', edit_polymorphic_path([main_app, :curation_concerns, @presenter]), class: 'btn' %>
5
+ <%= link_to 'Add Descriptions', edit_polymorphic_path([main_app, @presenter]), class: 'btn' %>
6
6
  </p>
7
7
  </div>
8
8
 
9
9
  <div class="alert hide" id="fail">
10
- There was a problem during upload. Please click the &quot;Start Upload&quot; button or <%= link_to 'start over', edit_polymorphic_path([main_app, :curation_concerns, @presenter]) %>
10
+ There was a problem during upload. Please click the &quot;Start Upload&quot; button or <%= link_to 'start over', edit_polymorphic_path([main_app, @presenter]) %>
11
11
  </div>
12
12
 
13
13
  <div class="alert hide" id="partial_fail">
14
14
  One or more files did not upload successfully. To continue using the files uploaded use one of the links below.<br />
15
- <%= link_to 'Add Descriptions', edit_polymorphic_path([main_app, :curation_concerns, @presenter]), class: 'btn' %>
15
+ <%= link_to 'Add Descriptions', edit_polymorphic_path([main_app, @presenter]), class: 'btn' %>
16
16
  </div>
17
17
 
18
18
  <div class="alert hide" id="errmsg"> </div>
@@ -1,6 +1,6 @@
1
1
  <%= form_for(FileSet.new, url: main_app.curation_concerns_file_sets_path(parent_id: @presenter.id), html: { multipart: true, id: 'fileupload' }) do |f| %>
2
2
  <div class="well">
3
- <%= render partial: 'curation_concerns/file_sets/upload/form_fields', presenter: @presenter, locals: { upload_set_id: ActiveFedora::Noid::Service.new.mint } %>
3
+ <%= render 'curation_concerns/file_sets/upload/form_fields', presenter: @presenter, upload_set_id: ActiveFedora::Noid::Service.new.mint %>
4
4
  </div>
5
5
  <% end %>
6
6
 
@@ -1,6 +1,6 @@
1
1
  <div class="alert alert-info hide" id="redirect-loc" type="text/x-jquery-tmpl">
2
2
  <%-# Script redirects here once the uploads are complete %>
3
- <%= polymorphic_path([main_app, :curation_concerns, @presenter]) %>
3
+ <%= polymorphic_path([main_app, @presenter]) %>
4
4
  </div>
5
5
 
6
6
  <!-- The template to display files available for upload -->
@@ -16,6 +16,6 @@
16
16
  </div>
17
17
  <div class="form-actions panel-footer">
18
18
  <%= button_to "Yes please.", main_app.copy_curation_concerns_permission_path(curation_concern), class: 'btn btn-primary' %>
19
- <%= link_to "No. I'll update it manually.", polymorphic_path([main_app, :curation_concerns, curation_concern]), class: 'btn' %>
19
+ <%= link_to "No. I'll update it manually.", polymorphic_path([main_app, curation_concern]), class: 'btn' %>
20
20
  </div>
21
21
  </div>
@@ -1,5 +1,5 @@
1
1
  <div >
2
- <h1 class="lower"><%= @asset %></h1>
2
+ <h1 class="lower"><%= @presenter %></h1>
3
3
  <h2 class="non lower">Actions</h2>
4
4
  <p>
5
5
  <%= link_to "Download (can only be used once)", @download_link, target: '_blank', data: { 'no-turbolink' => ''} %>
@@ -3,7 +3,7 @@
3
3
  <% end %>
4
4
 
5
5
  <h2>Current Embargo</h2>
6
- <%= simple_form_for [:curation_concerns, curation_concern] do |f| %>
6
+ <%= simple_form_for [main_app, curation_concern] do |f| %>
7
7
  <fieldset id="set-access-controls">
8
8
  <section class="help-block">
9
9
  <p>
@@ -25,12 +25,12 @@
25
25
  <div class="col-md-12 form-actions">
26
26
  <% if curation_concern.embargo_release_date %>
27
27
  <%= f.submit "Update Embargo", class: 'btn btn-primary' %>
28
- <%= link_to "Deactivate Embargo", embargo_path(curation_concern), :method => :delete, class: 'btn btn-danger' %>
28
+ <%= link_to "Deactivate Embargo", embargo_path(curation_concern), method: :delete, class: 'btn btn-danger' %>
29
29
  <% else %>
30
30
  <%= f.submit "Apply Embargo", class: 'btn btn-primary' %>
31
31
  <% end %>
32
32
  <%= link_to 'Cancel and manage all embargoes', embargoes_path, class: 'btn btn-default' %>
33
- <%= link_to "Return to editing this #{curation_concern.human_readable_type}", edit_polymorphic_path([:curation_concerns, curation_concern]), class: 'btn btn-default' %>
33
+ <%= link_to "Return to editing this #{curation_concern.human_readable_type}", [:edit, curation_concern], class: 'btn btn-default' %>
34
34
  </div>
35
35
  </div>
36
36
  <% end %>
@@ -39,5 +39,5 @@
39
39
  <% if curation_concern.embargo_history.empty? %>
40
40
  This <%= curation_concern.human_readable_type %> has never had embargoes applied to it.
41
41
  <% else %>
42
- <%= render partial:"embargo_history" %>
42
+ <%= render partial: "embargo_history" %>
43
43
  <% end %>
@@ -19,4 +19,4 @@
19
19
 
20
20
  <% end %>
21
21
 
22
- <%= render :template => 'layouts/boilerplate' %>
22
+ <%= render template: 'layouts/boilerplate' %>
@@ -3,7 +3,7 @@
3
3
  <% end %>
4
4
 
5
5
  <h2>Current Lease</h2>
6
- <%= simple_form_for [:curation_concerns, curation_concern] do |f| %>
6
+ <%= simple_form_for curation_concern do |f| %>
7
7
  <fieldset id="set-access-controls">
8
8
  <section class="help-block">
9
9
  <p>
@@ -25,12 +25,12 @@
25
25
  <div class="col-md-12 form-actions">
26
26
  <% if curation_concern.lease_expiration_date %>
27
27
  <%= f.submit "Update Lease", class: 'btn btn-primary' %>
28
- <%= link_to "Deactivate Lease", lease_path(curation_concern), :method => :delete, class: 'btn btn-danger' %>
28
+ <%= link_to "Deactivate Lease", lease_path(curation_concern), method: :delete, class: 'btn btn-danger' %>
29
29
  <% else %>
30
30
  <%= f.submit "Apply Lease", class: 'btn btn-primary' %>
31
31
  <% end %>
32
32
  <%= link_to 'Cancel and manage all leases', leases_path, class: 'btn btn-default' %>
33
- <%= link_to "Return to editing this #{curation_concern.human_readable_type}", edit_polymorphic_path([:curation_concerns, curation_concern]), class: 'btn btn-default' %>
33
+ <%= link_to "Return to editing this #{curation_concern.human_readable_type}", [:edit, curation_concern], class: 'btn btn-default' %>
34
34
  </div>
35
35
  </div>
36
36
  <% end %>
@@ -1,14 +1,17 @@
1
1
  <strong class="menu-heading item-with-options">Add a Work</strong>
2
2
  <ul class="item-options quick-classify">
3
- <% CurationConcerns::QuickClassificationQuery.each_for_context(current_user) do |concern| %>
3
+ <% classification = CurationConcerns::QuickClassificationQuery.new(current_user) %>
4
+ <% classification.each do |concern| %>
4
5
  <li><%= link_to(
5
6
  "New #{concern.human_readable_type}",
6
- main_app.new_polymorphic_path([:curation_concerns, concern]),
7
+ new_polymorphic_path([main_app, concern]),
7
8
  class: "item-option contextual-quick-classify #{dom_class(concern, 'new').gsub('_', '-')}",
8
9
  role: 'menuitem'
9
10
  ) %>
10
11
  </li>
11
12
  <% end %>
12
- <li><%= link_to 'More Options', curation_concerns.new_classify_concern_path, class: 'item-option link-to-full-list', role: 'menuitem' %></li>
13
+ <% unless classification.all? %>
14
+ <li><%= link_to 'More Options', curation_concerns.new_classify_concern_path, class: 'item-option link-to-full-list', role: 'menuitem' %></li>
15
+ <% end %>
13
16
  </ul>
14
17
 
@@ -0,0 +1,12 @@
1
+ <%#= f.input :resource_type, as: :select_with_help, collection: CurationConcerns.config.resource_types,
2
+ input_html: { class: 'form-control', multiple: true } %>
3
+
4
+ <%= f.input :tag, as: :multi_value_with_help %>
5
+
6
+ <%= f.input :creator, as: :multi_value_with_help %>
7
+
8
+ <%= f.input :rights, as: :select_with_modal_help, collection: RightsService.select_options,
9
+ input_html: { class: 'form-control', multiple: true } %>
10
+
11
+ <%= render "curation_concerns/file_sets/rights_modal" %>
12
+
@@ -4,11 +4,11 @@
4
4
  <div class="col-sm-8">
5
5
  <h3>Applies to individual files uploaded</h3>
6
6
  <%= content_tag :p, t('curation_concerns.upload_set.help.title'), class: "help-block" %>
7
- <% @upload_set.file_sets.sort { |a,b| a.label.downcase <=> b.label.downcase }.each_with_index do |gen_f, index| %>
7
+ <% f.object.works.each_with_index do |work, index| %>
8
8
  <div class="form-group">
9
9
  <%= f.input_label :title, as: :multi_value_with_help, label: "Title #{index + 1}" %>
10
10
  <div id="additional_title_clone">
11
- <%= f.text_field :title, name: "title[#{gen_f.id}][]", value: gen_f.label, class: 'form-control', required: true %>
11
+ <%= f.text_field :title, name: "title[#{work.id}][]", value: work.title, class: 'form-control', required: true %>
12
12
  </div>
13
13
  </div>
14
14
  <% end %>
@@ -27,17 +27,7 @@
27
27
  <div class="row">
28
28
  <div class="col-sm-6">
29
29
  <h3>Applies to all files just uploaded</h3>
30
- <%= f.input :resource_type, as: :select_with_help, collection: Sufia.config.resource_types,
31
- input_html: { class: 'form-control', multiple: true } %>
32
-
33
- <%= f.input :tag, as: :multi_value_with_help %>
34
-
35
- <%= f.input :creator, as: :multi_value_with_help %>
36
-
37
- <%= f.input :rights, as: :select_with_modal_help, collection: RightsService.select_options,
38
- input_html: { class: 'form-control', multiple: true } %>
39
-
40
- <%= render "file_sets/rights_modal" %>
30
+ <%= render 'base_metadata', f: f %>
41
31
 
42
32
  <button id="show_addl_descriptions" class="btn btn-default" aria-label="reveal additional metadata description fields">Show Additional Fields</button>
43
33
  <!-- hidden on initial load -->
@@ -10,7 +10,7 @@
10
10
  <%= link_to "<i class='glyphicon glyphicon-dashboard'></i> #{t('curation_concerns.bread_crumb.works_list')}".html_safe, main_app.curation_concerns_generic_works_path %>
11
11
  once this step is finished. <span class="required"><abbr title="required">*</abbr></span> indicates required fields.
12
12
  </p>
13
- <%= simple_form_for [main_app, @upload_set, @form], html: { multipart: true }, builder: Sufia::FormBuilder do |f| %>
13
+ <%= simple_form_for [main_app, @form], html: { multipart: true }, builder: CurationConcerns::FormBuilder do |f| %>
14
14
 
15
15
  <%= render 'metadata', f: f %>
16
16
 
@@ -55,6 +55,52 @@ en:
55
55
  default: "Unable to process your request. See errors for more info."
56
56
  internal_error:
57
57
  default: "The server encountered an error."
58
+ schema_org:
59
+ resource_type:
60
+ Article: "http://schema.org/Article"
61
+ Audio: "http://schema.org/AudioObject"
62
+ Book: "http://schema.org/Book"
63
+ Conference Proceeding: "http://schema.org/ScholarlyArticle"
64
+ Dataset: "http://schema.org/Dataset"
65
+ Dissertation: "http://schema.org/ScholarlyArticle"
66
+ Image: "http://schema.org/ImageObject"
67
+ Map or Cartographic Material: "http://schema.org/Map"
68
+ Masters Thesis: "http://schema.org/ScholarlyArticle"
69
+ Part of Book: "http://schema.org/Book"
70
+ Research Paper: "http://schema.org/ScholarlyArticle"
71
+ Software or Program Code: "http://schema.org/Code"
72
+ Video: "http://schema.org/VideoObject"
73
+ based_near:
74
+ type: "http://schema.org/Place"
75
+ property: contentLocation
76
+ value: name
77
+ contributor:
78
+ type: "http://schema.org/Person"
79
+ property: contributor
80
+ # used as the itemprop value for itemscoped attributes
81
+ value: name
82
+ creator:
83
+ type: "http://schema.org/Person"
84
+ property: creator
85
+ value: name
86
+ date_created:
87
+ property: dateCreated
88
+ description:
89
+ property: description
90
+ language:
91
+ property: inLanguage
92
+ publisher:
93
+ type: "http://schema.org/Organization"
94
+ property: publisher
95
+ value: name
96
+ subject:
97
+ type: "http://schema.org/Thing"
98
+ property: about
99
+ value: name
100
+ tag:
101
+ property: keywords
102
+ title:
103
+ property: name
58
104
  blacklight:
59
105
  search:
60
106
  fields:
@@ -14,18 +14,19 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = ""
15
15
  spec.license = "APACHE2"
16
16
 
17
- spec.files = `git ls-files | grep -v ^curation_concerns-models`.split($\)
17
+ spec.files = `git ls-files | grep -v ^curation_concerns-models | grep -v ^spec/fixtures`.split($\)
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_dependency 'hydra-head', '~> 9.0'
23
- spec.add_dependency "breadcrumbs_on_rails", "~> 2.3.0"
23
+ spec.add_dependency "breadcrumbs_on_rails", "~> 2.3"
24
24
  spec.add_dependency "jquery-ui-rails"
25
- spec.add_dependency "simple_form", '~> 3.1.0'
25
+ spec.add_dependency "simple_form", '~> 3.1'
26
26
  spec.add_dependency 'curation_concerns-models', version
27
27
  spec.add_dependency 'hydra-editor', '~> 1.1'
28
28
  spec.add_dependency 'blacklight_advanced_search', ['>= 5.1.4', '< 6.0']
29
+ spec.add_dependency 'rails_autolink'
29
30
 
30
31
  spec.add_development_dependency "devise", "~> 3.0"
31
32
  spec.add_development_dependency "bundler", "~> 1.6"
@@ -40,5 +41,5 @@ Gem::Specification.new do |spec|
40
41
  spec.add_development_dependency "poltergeist", ">= 1.5.0"
41
42
  spec.add_development_dependency "factory_girl"
42
43
  spec.add_development_dependency "database_cleaner", "< 1.1.0"
43
-
44
+ spec.add_development_dependency 'mida', '~> 0.3.4'
44
45
  end
@@ -7,6 +7,11 @@ require 'jquery-ui-rails'
7
7
  require 'qa'
8
8
 
9
9
  module CurationConcerns
10
+ # Ensures that routes to curation_concerns are prefixed with `curation_concerns_`
11
+ # def self.use_relative_model_naming?
12
+ # false
13
+ # end
14
+
10
15
  class Engine < ::Rails::Engine
11
16
  isolate_namespace CurationConcerns
12
17
  require 'breadcrumbs_on_rails'
@@ -0,0 +1,16 @@
1
+ module CurationConcerns
2
+ class FormBuilder < SimpleForm::FormBuilder
3
+ def input_label(attribute_name, options = {})
4
+ options = options.dup
5
+ options[:input_html] = options.except(:as, :boolean_style, :collection, :label_method, :value_method, *ATTRIBUTE_COMPONENTS)
6
+ options = @defaults.deep_dup.deep_merge(options) if @defaults
7
+
8
+ input = find_input(attribute_name, options)
9
+ wrapper = find_wrapper(input.input_type, options)
10
+ components = (wrapper.components.map(&:namespace) & ATTRIBUTE_COMPONENTS) + [:input]
11
+ components.map { |component| SimpleForm::Wrappers::Leaf.new(component) }
12
+
13
+ input.label.html_safe
14
+ end
15
+ end
16
+ end
@@ -2,14 +2,13 @@ module ActionDispatch::Routing
2
2
  class Mapper
3
3
  def curation_concerns_basic_routes
4
4
  resources :downloads, only: :show
5
- # Batch edit routes
6
- get 'upload_sets/:id/edit' => 'upload_sets#edit', as: :edit_upload_set
7
- post 'upload_sets/:id' => 'upload_sets#update', as: :upload_set_file_sets
5
+ resources :upload_sets, only: [:edit, :update]
8
6
 
9
7
  namespace :curation_concerns, path: :concern do
10
8
  CurationConcerns.config.registered_curation_concern_types.map(&:tableize).each do |curation_concern_name|
11
9
  namespaced_resources curation_concern_name, except: [:index]
12
10
  end
11
+
13
12
  resources :permissions, only: [] do
14
13
  member do
15
14
  get :confirm
@@ -60,16 +59,19 @@ module ActionDispatch::Routing
60
59
 
61
60
  private
62
61
 
62
+ # routing namepace arguments, for using a path other than the default
63
+ ROUTE_OPTIONS = { 'curation_concerns' => { path: :concern } }
64
+
63
65
  # Namespaces routes appropriately
64
66
  # @example route_namespaced_target("curation_concerns/generic_work") is equivalent to
65
- # namespace "curation_concerns" do
67
+ # namespace "curation_concerns", path: :concern do
66
68
  # resources "generic_work", except: [:index]
67
69
  # end
68
70
  def namespaced_resources(target, opts = {})
69
71
  if target.include?('/')
70
72
  the_namespace = target[0..target.index('/') - 1]
71
73
  new_target = target[target.index('/') + 1..-1]
72
- namespace the_namespace do
74
+ namespace the_namespace, ROUTE_OPTIONS.fetch(the_namespace, nil) do
73
75
  namespaced_resources(new_target, opts)
74
76
  end
75
77
  else
@@ -60,7 +60,7 @@ module CurationConcerns
60
60
  " mount Hydra::Collections::Engine => '/'\n"\
61
61
  " mount CurationConcerns::Engine, at: '/'\n"\
62
62
  " resources :welcome, only: 'index'\n"\
63
- " root to: 'welcome#index'\n"\
63
+ " root 'welcome#index'\n"\
64
64
  " curation_concerns_collections\n"\
65
65
  " curation_concerns_basic_routes\n"\
66
66
  " curation_concerns_embargo_management\n"\
@@ -65,7 +65,7 @@ class CurationConcerns::WorkGenerator < Rails::Generators::NamedBase
65
65
  end
66
66
 
67
67
  def create_views
68
- create_file "app/views/curation_concerns/#{plural_file_name}/_#{file_name}.html.erb" do
68
+ create_file "app/views/#{plural_file_name}/_#{file_name}.html.erb" do
69
69
  "<%# This is a search result view %>\n" \
70
70
  "<%= render 'catalog/document', document: #{file_name}, document_counter: #{file_name}_counter %>\n"
71
71
  end
@@ -8,6 +8,7 @@ describe CurationConcerns::FileSetActor do
8
8
  let(:file_set) { create(:file_set) }
9
9
  let(:actor) { described_class.new(file_set, user) }
10
10
  let(:uploaded_file) { fixture_file_upload('/world.png', 'image/png') }
11
+ let(:local_file) { File.open(File.join(fixture_path, 'world.png')) }
11
12
 
12
13
  describe 'creating metadata and content' do
13
14
  let(:upload_set_id) { nil }
@@ -23,22 +24,13 @@ describe CurationConcerns::FileSetActor do
23
24
  expect(CharacterizeJob).to receive(:perform_later)
24
25
  expect(IngestFileJob).to receive(:perform_later).with(file_set.id, /world\.png$/, 'image/png', user.user_key)
25
26
  allow(actor).to receive(:acquire_lock_for).and_yield
26
- actor.create_metadata(upload_set_id, work)
27
+ actor.create_metadata(work)
27
28
  actor.create_content(uploaded_file)
28
29
  end
29
30
 
30
- context 'when an upload_set_id and work are not provided' do
31
- let(:upload_set_id) { nil }
32
- it "leaves the associations blank" do
33
- expect(subject.upload_set).to be_nil
34
- expect(subject.generic_works).to be_empty
35
- end
36
- end
37
-
38
- context 'when a upload_set_id is provided' do
39
- let(:upload_set_id) { ActiveFedora::Noid::Service.new.mint }
31
+ context 'when a work is not provided' do
40
32
  it "leaves the association blank" do
41
- expect(subject.upload_set).to be_instance_of UploadSet
33
+ expect(subject.generic_works).to be_empty
42
34
  end
43
35
  end
44
36
 
@@ -67,7 +59,7 @@ describe CurationConcerns::FileSetActor do
67
59
 
68
60
  it 'copies visibility from the parent' do
69
61
  allow(actor).to receive(:acquire_lock_for).and_yield
70
- actor.create_metadata(nil, work)
62
+ actor.create_metadata(work)
71
63
  saved_file = file_set.reload
72
64
  expect(saved_file.visibility).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
73
65
  end
@@ -80,6 +72,23 @@ describe CurationConcerns::FileSetActor do
80
72
  actor.create_content(uploaded_file)
81
73
  end
82
74
 
75
+ context 'using ::File' do
76
+ before do
77
+ allow(CharacterizeJob).to receive(:perform_later)
78
+ allow(IngestFileJob).to receive(:perform_later)
79
+ actor.create_content(local_file)
80
+ end
81
+
82
+ it 'sets the label and title' do
83
+ expect(file_set.label).to eq(File.basename(local_file))
84
+ expect(file_set.title).to eq([File.basename(local_file)])
85
+ end
86
+
87
+ it 'does not set the mime_type' do
88
+ expect(file_set.mime_type).to be_nil
89
+ end
90
+ end
91
+
83
92
  context 'when file_set.title is empty and file_set.label is not' do
84
93
  let(:file) { 'world.png' }
85
94
  let(:long_name) { 'an absurdly long title that goes on way to long and messes up the display of the page which should not need to be this big in order to show this impossibly long, long, long, oh so long string' }
@@ -125,20 +134,21 @@ describe CurationConcerns::FileSetActor do
125
134
  actor.destroy
126
135
  expect { file_set.reload }.to raise_error ActiveFedora::ObjectNotFoundError
127
136
  end
137
+
128
138
  context "representative of a work" do
129
139
  let!(:work) do
130
140
  work = create(:generic_work)
131
141
  # this is not part of a block on the create, since the work must be saved
132
142
  # before the representative can be assigned
133
- work.members << file_set
143
+ work.ordered_members << file_set
134
144
  work.representative = file_set
135
145
  work.save
136
146
  work
137
147
  end
138
148
 
139
- it "removes representative" do
149
+ it "removes representative and the proxy association" do
140
150
  expect(work.reload.representative_id).to eq(file_set.id)
141
- actor.destroy
151
+ expect { actor.destroy }.to change { ActiveFedora::Aggregation::Proxy.count }.by(-1)
142
152
  expect(work.reload.representative_id).to be_nil
143
153
  end
144
154
  end