curation_concerns 1.6.3 → 1.7.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/.travis.yml +2 -8
  4. data/README.md +27 -1
  5. data/app/actors/curation_concerns/actors/base_actor.rb +2 -3
  6. data/app/actors/curation_concerns/actors/file_set_actor.rb +1 -1
  7. data/app/actors/curation_concerns/actors/grant_edit_to_depositor_actor.rb +19 -0
  8. data/app/actors/curation_concerns/actors/initialize_workflow_actor.rb +19 -0
  9. data/app/assets/javascripts/curation_concerns/charts.js +47 -0
  10. data/app/assets/javascripts/curation_concerns/curation_concerns.js +2 -0
  11. data/app/assets/javascripts/curation_concerns/workflow_actions_affix.js +11 -0
  12. data/app/assets/stylesheets/curation_concerns/_admin.scss +18 -0
  13. data/app/assets/stylesheets/curation_concerns/_curation_concerns.scss +1 -0
  14. data/app/assets/stylesheets/curation_concerns/_positioning.scss +11 -0
  15. data/app/controllers/concerns/curation_concerns/act_as_admin_controller.rb +25 -0
  16. data/app/controllers/concerns/curation_concerns/admin_controller_behavior.rb +38 -0
  17. data/app/controllers/concerns/curation_concerns/admin_page.rb +18 -0
  18. data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +3 -2
  19. data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +158 -159
  20. data/app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb +4 -6
  21. data/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb +2 -1
  22. data/app/controllers/concerns/curation_concerns/leases_controller_behavior.rb +4 -6
  23. data/app/controllers/concerns/curation_concerns/single_use_links_viewer_controller_behavior.rb +2 -1
  24. data/app/controllers/curation_concerns/admin/workflow_roles_controller.rb +36 -0
  25. data/app/controllers/curation_concerns/workflow_actions_controller.rb +25 -0
  26. data/app/conversions/power_converters/polymorphic_type.rb +7 -0
  27. data/app/conversions/power_converters/sipity_action.rb +9 -0
  28. data/app/conversions/power_converters/sipity_action_name.rb +8 -0
  29. data/app/conversions/power_converters/sipity_agent.rb +6 -0
  30. data/app/conversions/power_converters/sipity_entity.rb +12 -0
  31. data/app/conversions/power_converters/sipity_role.rb +8 -0
  32. data/app/conversions/power_converters/sipity_workflow_id.rb +16 -0
  33. data/app/conversions/power_converters/sipity_workflow_state.rb +10 -0
  34. data/app/conversions/power_converters.rb +6 -0
  35. data/app/forms/curation_concerns/forms/workflow_action_form.rb +62 -0
  36. data/app/forms/curation_concerns/forms/workflow_responsibility_form.rb +42 -0
  37. data/app/helpers/curation_concerns/charts_helper.rb +23 -0
  38. data/app/helpers/curation_concerns/main_app_helpers.rb +1 -0
  39. data/app/helpers/curation_concerns/url_helper.rb +2 -5
  40. data/app/indexers/curation_concerns/indexes_workflow.rb +44 -0
  41. data/app/indexers/curation_concerns/work_indexer.rb +1 -2
  42. data/app/jobs/import_export_job.rb +46 -0
  43. data/app/models/concerns/curation_concerns/ability.rb +2 -0
  44. data/app/models/concerns/curation_concerns/permissions/writable.rb +7 -8
  45. data/app/models/concerns/curation_concerns/publishable.rb +6 -0
  46. data/app/models/concerns/curation_concerns/solr_document_behavior.rb +8 -0
  47. data/app/models/concerns/curation_concerns/user.rb +5 -0
  48. data/app/models/curation_concerns/group.rb +23 -0
  49. data/app/models/curation_concerns/workflow_action_info.rb +13 -0
  50. data/app/models/sipity/agent.rb +21 -0
  51. data/app/models/sipity/comment.rb +13 -0
  52. data/app/models/sipity/entity.rb +32 -0
  53. data/app/models/sipity/entity_specific_responsibility.rb +21 -0
  54. data/app/models/sipity/method.rb +5 -0
  55. data/app/models/sipity/notifiable_context.rb +26 -0
  56. data/app/models/sipity/notification.rb +28 -0
  57. data/app/models/sipity/notification_recipient.rb +17 -0
  58. data/app/models/sipity/role.rb +43 -0
  59. data/app/models/sipity/workflow.rb +19 -0
  60. data/app/models/sipity/workflow_action.rb +25 -0
  61. data/app/models/sipity/workflow_responsibility.rb +23 -0
  62. data/app/models/sipity/workflow_role.rb +13 -0
  63. data/app/models/sipity/workflow_state.rb +26 -0
  64. data/app/models/sipity/workflow_state_action.rb +9 -0
  65. data/app/models/sipity/workflow_state_action_permission.rb +8 -0
  66. data/app/models/vocab/fedora_resource_status.rb +4 -1
  67. data/app/presenters/curation_concerns/admin/workflow_role_presenter.rb +40 -0
  68. data/app/presenters/curation_concerns/work_show_presenter.rb +4 -0
  69. data/app/presenters/curation_concerns/workflow_presenter.rb +43 -0
  70. data/app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb +1 -1
  71. data/app/search_builders/curation_concerns/search_filters.rb +0 -1
  72. data/app/services/curation_concerns/actors/actor_factory.rb +3 -1
  73. data/app/services/curation_concerns/admin_set_service.rb +13 -4
  74. data/app/services/curation_concerns/work_form_service.rb +11 -0
  75. data/app/services/curation_concerns/workflow/action_taken_service.rb +57 -0
  76. data/app/services/curation_concerns/workflow/activate_object.rb +9 -0
  77. data/app/services/curation_concerns/workflow/deactivate_object.rb +11 -0
  78. data/app/services/curation_concerns/workflow/default_workflow_strategy.rb +13 -0
  79. data/app/services/curation_concerns/workflow/method_generator.rb +55 -0
  80. data/app/services/curation_concerns/workflow/notification_configuration_parameter.rb +42 -0
  81. data/app/services/curation_concerns/workflow/notification_generator.rb +64 -0
  82. data/app/services/curation_concerns/workflow/notification_service.rb +66 -0
  83. data/app/services/curation_concerns/workflow/permission_generator.rb +95 -0
  84. data/app/services/curation_concerns/workflow/permission_query.rb +432 -0
  85. data/app/services/curation_concerns/workflow/remove_depositor_permissions.rb +11 -0
  86. data/app/services/curation_concerns/workflow/sipity_actions_generator.rb +49 -0
  87. data/app/services/curation_concerns/workflow/state_machine_generator.rb +102 -0
  88. data/app/services/curation_concerns/workflow/status_list_service.rb +52 -0
  89. data/app/services/curation_concerns/workflow/workflow_action_service.rb +56 -0
  90. data/app/services/curation_concerns/workflow/workflow_by_model_name_strategy.rb +14 -0
  91. data/app/services/curation_concerns/workflow/workflow_factory.rb +64 -0
  92. data/app/services/curation_concerns/workflow/workflow_importer.rb +103 -0
  93. data/app/services/curation_concerns/workflow/workflow_permissions_generator.rb +49 -0
  94. data/app/services/curation_concerns/workflow/workflow_schema.rb +56 -0
  95. data/app/services/rights_service.rb +1 -1
  96. data/app/services/sipity.rb +2 -0
  97. data/app/sources/curation_concerns/resource_statistics_source.rb +101 -0
  98. data/app/values/curation_concerns/chart_data.rb +61 -0
  99. data/app/views/curation_concerns/admin/_admin_menu.html.erb +5 -0
  100. data/app/views/curation_concerns/admin/_resource_stats.html.erb +43 -0
  101. data/app/views/curation_concerns/admin/_sidebar.html.erb +3 -0
  102. data/app/views/curation_concerns/admin/_total_embargo_visibility.html.erb +21 -0
  103. data/app/views/curation_concerns/admin/_total_objects.html.erb +1 -0
  104. data/app/views/curation_concerns/admin/_total_objects_charts.html.erb +12 -0
  105. data/app/views/curation_concerns/admin/index.html.erb +11 -0
  106. data/app/views/curation_concerns/admin/widgets/_pie.html.erb +1 -0
  107. data/app/views/curation_concerns/admin/workflow.html.erb +31 -0
  108. data/app/views/curation_concerns/admin/workflow_roles/index.html.erb +45 -0
  109. data/app/views/curation_concerns/base/_form_rights.html.erb +1 -1
  110. data/app/views/curation_concerns/base/_workflow_actions.html.erb +39 -0
  111. data/app/views/curation_concerns/base/show.html.erb +2 -0
  112. data/app/views/curation_concerns/file_sets/media_display/_office_document.html.erb +0 -1
  113. data/app/views/layouts/_head_tag_content.html.erb +13 -0
  114. data/app/views/layouts/admin.html.erb +10 -0
  115. data/app/views/shared/_my_actions.html.erb +4 -1
  116. data/config/initializers/precompile_assets.rb +1 -0
  117. data/config/locales/curation_concerns.en.yml +97 -56
  118. data/config/routes.rb +7 -0
  119. data/curation_concerns.gemspec +9 -3
  120. data/db/migrate/20160919151348_create_sipity.rb +163 -0
  121. data/db/migrate/20161012182404_create_sipity_workflow_methods.rb +10 -0
  122. data/lib/curation_concerns/configuration.rb +68 -0
  123. data/lib/curation_concerns/engine.rb +9 -1
  124. data/lib/curation_concerns/rails/routes.rb +1 -0
  125. data/lib/curation_concerns/version.rb +1 -1
  126. data/lib/curation_concerns.rb +1 -1
  127. data/lib/generators/curation_concerns/admin_dashboard_generator.rb +15 -0
  128. data/lib/generators/curation_concerns/install_generator.rb +7 -0
  129. data/lib/generators/curation_concerns/sample_data_generator.rb +12 -0
  130. data/lib/generators/curation_concerns/templates/app/controllers/curation_concerns/admin_controller.rb +61 -0
  131. data/lib/generators/curation_concerns/templates/catalog_controller.rb +1 -3
  132. data/lib/generators/curation_concerns/templates/config/curation_concerns.rb +39 -0
  133. data/lib/generators/curation_concerns/templates/db/seeds.rb +94 -0
  134. data/lib/generators/curation_concerns/templates/spec/models/collection_spec.rb +1 -1
  135. data/lib/generators/curation_concerns/templates/spec/models/file_set_spec.rb +1 -1
  136. data/lib/generators/curation_concerns/templates/workflow.json.erb +19 -0
  137. data/lib/generators/curation_concerns/work/USAGE +1 -0
  138. data/lib/generators/curation_concerns/work/templates/actor_spec.rb.erb +1 -1
  139. data/lib/generators/curation_concerns/work/templates/controller_spec.rb.erb +1 -1
  140. data/lib/generators/curation_concerns/work/templates/feature_spec.rb.erb +1 -1
  141. data/lib/generators/curation_concerns/work/templates/form_spec.rb.erb +1 -1
  142. data/lib/generators/curation_concerns/work/templates/model_spec.rb.erb +1 -1
  143. data/spec/abilities/admin_ability_spec.rb +15 -0
  144. data/spec/actors/curation_concerns/file_set_actor_spec.rb +24 -0
  145. data/spec/actors/curation_concerns/grant_edit_to_depositor_actor_spec.rb +32 -0
  146. data/spec/actors/curation_concerns/initialize_workflow_actor_spec.rb +33 -0
  147. data/spec/actors/curation_concerns/interpret_visibility_actor_spec.rb +1 -0
  148. data/spec/actors/curation_concerns/work_actor_spec.rb +10 -5
  149. data/spec/controllers/curation_concerns/acts_as_admin_controller_spec.rb +22 -0
  150. data/spec/controllers/curation_concerns/admin/workflow_roles_controller_spec.rb +26 -0
  151. data/spec/controllers/curation_concerns/admin_controller_spec.rb +64 -0
  152. data/spec/controllers/curation_concerns/generic_works_controller_json_spec.rb +11 -3
  153. data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +4 -4
  154. data/spec/controllers/curation_concerns/workflow_actions_controller_spec.rb +36 -0
  155. data/spec/conversions/power_converters/polymorphic_type_spec.rb +22 -0
  156. data/spec/conversions/power_converters/sipity_action_name_spec.rb +32 -0
  157. data/spec/conversions/power_converters/sipity_action_spec.rb +43 -0
  158. data/spec/conversions/power_converters/sipity_agent_spec.rb +20 -0
  159. data/spec/conversions/power_converters/sipity_entity_spec.rb +46 -0
  160. data/spec/conversions/power_converters/sipity_role_spec.rb +33 -0
  161. data/spec/conversions/power_converters/sipity_workflow_id_spec.rb +28 -0
  162. data/spec/conversions/power_converters/sipity_workflow_state_spec.rb +22 -0
  163. data/spec/factories/generic_works.rb +19 -6
  164. data/spec/factories/sipity_entities.rb +7 -0
  165. data/spec/factories/workflow_actions.rb +6 -0
  166. data/spec/factories/workflow_states.rb +6 -0
  167. data/spec/factories/workflows.rb +5 -0
  168. data/spec/features/admin_spec.rb +14 -0
  169. data/spec/features/create_child_work_spec.rb +1 -1
  170. data/spec/features/create_work_spec.rb +1 -1
  171. data/spec/features/embargo_spec.rb +1 -1
  172. data/spec/features/lease_spec.rb +1 -1
  173. data/spec/features/work_generator_spec.rb +2 -2
  174. data/spec/features/workflow_roles_spec.rb +48 -0
  175. data/spec/forms/curation_concerns/forms/workflow_action_form_spec.rb +111 -0
  176. data/spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb +33 -0
  177. data/spec/helpers/curation_concerns/charts_helper_spec.rb +62 -0
  178. data/spec/helpers/url_helper_spec.rb +11 -11
  179. data/spec/indexers/work_indexer_spec.rb +13 -1
  180. data/spec/javascripts/charts_spec.coffee +10 -0
  181. data/spec/javascripts/fixtures/chart_example.html +1 -0
  182. data/spec/jobs/import_export_job_spec.rb +28 -0
  183. data/spec/models/curation_concerns/group_spec.rb +15 -0
  184. data/spec/models/file_set_spec.rb +6 -2
  185. data/spec/models/generic_work_spec.rb +12 -0
  186. data/spec/models/sipity/agent_spec.rb +9 -0
  187. data/spec/models/sipity/comment_spec.rb +16 -0
  188. data/spec/models/sipity/entity_spec.rb +27 -0
  189. data/spec/models/sipity/entity_specific_responsibility_spec.rb +8 -0
  190. data/spec/models/sipity/notifiable_context_spec.rb +8 -0
  191. data/spec/models/sipity/notification_recipient_spec.rb +10 -0
  192. data/spec/models/sipity/notification_spec.rb +15 -0
  193. data/spec/models/sipity/role_spec.rb +30 -0
  194. data/spec/models/sipity/workflow_action_spec.rb +10 -0
  195. data/spec/models/sipity/workflow_responsibility_spec.rb +7 -0
  196. data/spec/models/sipity/workflow_role_spec.rb +7 -0
  197. data/spec/models/sipity/workflow_spec.rb +15 -0
  198. data/spec/models/sipity/workflow_state_action_permission_spec.rb +7 -0
  199. data/spec/models/sipity/workflow_state_action_spec.rb +7 -0
  200. data/spec/models/sipity/workflow_state_spec.rb +7 -0
  201. data/spec/models/user_spec.rb +12 -1
  202. data/spec/presenters/curation_concerns/work_show_presenter_spec.rb +12 -1
  203. data/spec/presenters/curation_concerns/workflow_presenter_spec.rb +39 -0
  204. data/spec/routing/route_spec.rb +13 -0
  205. data/spec/services/curation_concerns/admin_set_service_spec.rb +13 -0
  206. data/spec/services/curation_concerns/qa_select_service_spec.rb +75 -0
  207. data/spec/services/curation_concerns/workflow/action_taken_service_spec.rb +76 -0
  208. data/spec/services/curation_concerns/workflow/activate_object_spec.rb +20 -0
  209. data/spec/services/curation_concerns/workflow/deactivate_object_spec.rb +20 -0
  210. data/spec/services/curation_concerns/workflow/method_generator_spec.rb +43 -0
  211. data/spec/services/curation_concerns/workflow/notification_configuration_parameter_spec.rb +25 -0
  212. data/spec/services/curation_concerns/workflow/notification_generator_spec.rb +27 -0
  213. data/spec/services/curation_concerns/workflow/notification_service_spec.rb +81 -0
  214. data/spec/services/curation_concerns/workflow/permission_generator_spec.rb +52 -0
  215. data/spec/services/curation_concerns/workflow/permission_query_spec.rb +179 -0
  216. data/spec/services/curation_concerns/workflow/remove_depositor_permissions_spec.rb +21 -0
  217. data/spec/services/curation_concerns/workflow/sipity_actions_generator_spec.rb +30 -0
  218. data/spec/services/curation_concerns/workflow/state_machine_generator_spec.rb +46 -0
  219. data/spec/services/curation_concerns/workflow/status_list_service_spec.rb +46 -0
  220. data/spec/services/curation_concerns/workflow/workflow_importer_spec.rb +50 -0
  221. data/spec/services/curation_concerns/workflow/workflow_permissions_generator_spec.rb +37 -0
  222. data/spec/services/curation_concerns/workflow/workflow_schema_spec.rb +85 -0
  223. data/spec/sources/curation_concerns/resource_statistics_source_spec.rb +137 -0
  224. data/spec/spec_helper.rb +8 -1
  225. data/spec/test_app_templates/lib/generators/test_app_generator.rb +11 -0
  226. data/spec/views/curation_concerns/admin/_admin_menu.html.erb_spec.rb +23 -0
  227. data/spec/views/curation_concerns/admin/_resource_stats.html.erb_spec.rb +33 -0
  228. data/spec/views/curation_concerns/admin/_total_objects_charts.html.erb_spec.rb +28 -0
  229. data/spec/views/curation_concerns/admin/index.html.erb_spec.rb +26 -0
  230. data/spec/views/curation_concerns/admin/widgets/_pie.html.erb_spec.rb +17 -0
  231. data/spec/views/curation_concerns/base/file_manager.html.erb_spec.rb +1 -1
  232. data/spec/views/curation_concerns/base/show.html.erb_spec.rb +33 -0
  233. data/spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb +1 -1
  234. data/spec/views/shared/_my_actions.html.erb_spec.rb +1 -0
  235. data/tasks/workflow.rake +8 -0
  236. metadata +335 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 172fab1ebafb8c3dd0f68ce83a797cd58a8189b2
4
- data.tar.gz: 90c86d467af21617a3bd2a9cdb806f2ee5b3f8df
3
+ metadata.gz: 976d4594c0d89e8f8fc0fb3eb2e3fda2bc0de0e7
4
+ data.tar.gz: 0bba18a25f0eb32c5998c071544accdd09bcebd0
5
5
  SHA512:
6
- metadata.gz: c63887d9ff1971c2bf495ce9264247e145265789d8fb68ec77b98c987467f8a1e6ea045f7c2cca84ab335479aba5f079795f54f014e7229a715d814fb6218cb2
7
- data.tar.gz: 358867ae2f068736ae5daf0bc474f657dd22132218071b4e9e3b85432007710491901782716118cef08bb9c6ae6da4e00f682143c23880d5d1da59c470bf2570
6
+ metadata.gz: 2edb7a435f0b294fa1018bca41904327219d0b75ddc8ed736b20851b5d57bce7142085241e9d73e2d4df6c2784fad14fbe8851ff4f8302040af7e1cd2fb4472b
7
+ data.tar.gz: 1b31bc0aefd9067b0874e1dd0ab3e383a2a4c5f8b6190a2d977892d17b78edc9acdea5f7a8b3795d087f75cbc23d6ec1b0810da1851ab6bee974c28463bbd5eb
data/.rubocop.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  require: rubocop-rspec
2
2
  AllCops:
3
3
  DisplayCopNames: true
4
+ TargetRubyVersion: 2.1
4
5
  Include:
5
6
  - '**/Rakefile'
6
7
  - '**/config.ru'
@@ -47,6 +48,8 @@ Metrics/ModuleLength:
47
48
  - 'app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb'
48
49
  - 'app/models/concerns/curation_concerns/solr_document_behavior.rb'
49
50
  - 'app/controllers/concerns/curation_concerns/collections_controller_behavior.rb'
51
+ - 'app/services/curation_concerns/workflow/permission_query.rb'
52
+ - 'spec/services/curation_concerns/workflow/permission_query_spec.rb'
50
53
 
51
54
  Style/ZeroLengthPredicate:
52
55
  Enabled: false
@@ -165,6 +168,7 @@ RSpec/DescribeClass:
165
168
  - 'spec/views/**/*'
166
169
  - 'spec/routing/**/*'
167
170
  - 'spec/inputs/**/*'
171
+ - 'spec/conversions/**/*'
168
172
 
169
173
  RSpec/DescribedClass:
170
174
  Exclude:
data/.travis.yml CHANGED
@@ -7,15 +7,9 @@ env:
7
7
  global:
8
8
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
9
9
  matrix:
10
- - RAILS_VERSION=4.2.7
10
+ - RAILS_VERSION=4.2.7.1
11
11
  RDF_VERSION=1.99.1
12
- - RAILS_VERSION=5.0.0
12
+ - RAILS_VERSION=5.0.0.1
13
13
  RDF_VERSION=2.1.0
14
- notifications:
15
- irc:
16
- channels:
17
- - "irc.freenode.org#projecthydra"
18
- template:
19
- - "%{repository}//%{branch}@%{commit} by %{author}: %{message} - %{build_url}"
20
14
  before_script:
21
15
  - jdk_switcher use oraclejdk8
data/README.md CHANGED
@@ -11,7 +11,6 @@ Docs: [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.sv
11
11
 
12
12
  Join in: [![Slack Status](http://slack.projecthydra.org/badge.svg)](http://slack.projecthydra.org/) [![Ready](https://badge.waffle.io/projecthydra/curation_concerns.svg?label=ready&title=Ready)](http://waffle.io/projecthydra/curation_concerns)
13
13
 
14
-
15
14
  A Hydra-based Rails Engine that extends an application, adding the ability to Create, Read, Update and Destroy (CRUD) objects (based on [Hydra::Works](http://github.com/projecthydra/hydra-works)) and providing a generator for defining object types with custom workflows, views, access controls, etc.
16
15
 
17
16
  ## Prerequisites
@@ -109,6 +108,33 @@ rake engine_cart:generate
109
108
  rake curation_concerns:spec
110
109
  ```
111
110
 
111
+ ### Workflow
112
+
113
+ Load the workflows, workflow states, transitions and user roles:
114
+
115
+ ```
116
+ $ rails curation_concerns:workflow:load
117
+ ```
118
+
119
+ Now that the Roles are loaded, grant the appropriate roles to the users by visiting the "Workflow Roles" section of the admin dashboard
120
+
121
+ [Further documentation](https://github.com/projecthydra/curation_concerns/wiki/Defining-a-Workflow) for defining and customizing workflows.
122
+
123
+ _Something about notification should go here._
124
+
125
+ ### Adding Sample Data to Test Application
126
+
127
+ Sometimes when working with the test application, it can be helpful to have a repository populated with some number of objects. Rather than having to create them all through the user interface, which can be timely, the test application bundled with CurationConcerns provides a rake task that automatically creates 24 objects in the test application repository with different titles, levels of visibility, embargoes, and leases:
128
+
129
+ ``` bash
130
+ cd .internal_test_app
131
+ rake db:seed
132
+ ```
133
+
134
+ ### Configuring the Administration Panel
135
+
136
+ To configure the Administration Pane see [Admin Menu Guide](https://github.com/projecthydra/curation_concerns/wiki/Admin-Menu)
137
+
112
138
  ## Help
113
139
 
114
140
  If you have questions or need help, please email the [Hydra community tech list](mailto:hydra-tech@googlegroups.com) or stop by the [Hydra community IRC channel](irc://irc.freenode.net/projecthydra).
@@ -12,7 +12,7 @@ module CurationConcerns
12
12
  @cloud_resources = attributes.delete(:cloud_resources.to_s)
13
13
  apply_creation_data_to_curation_concern
14
14
  apply_save_data_to_curation_concern(attributes)
15
- next_actor.create(attributes) && save && run_callbacks(:after_create_concern)
15
+ save && next_actor.create(attributes) && run_callbacks(:after_create_concern)
16
16
  end
17
17
 
18
18
  def update(attributes)
@@ -38,8 +38,7 @@ module CurationConcerns
38
38
  end
39
39
 
40
40
  def apply_depositor_metadata
41
- curation_concern.apply_depositor_metadata(user.user_key)
42
- curation_concern.edit_users += [user.user_key]
41
+ curation_concern.depositor = user.user_key
43
42
  end
44
43
 
45
44
  def apply_deposit_date
@@ -125,7 +125,7 @@ module CurationConcerns
125
125
  end
126
126
 
127
127
  def assign_visibility?(file_set_params = {})
128
- !((file_set_params || {}).keys & %w(visibility embargo_release_date lease_expiration_date)).empty?
128
+ !((file_set_params || {}).keys.map(&:to_s) & %w(visibility embargo_release_date lease_expiration_date)).empty?
129
129
  end
130
130
 
131
131
  # copy visibility from source_concern to destination_concern
@@ -0,0 +1,19 @@
1
+ module CurationConcerns
2
+ module Actors
3
+ # Grants edit access to the depositor. This is implemented as a separate actor,
4
+ # so that it can be removed from the stack in cases where the depositor should not
5
+ # have edit access (e.g. mediated deposit)
6
+ class GrantEditToDepositorActor < AbstractActor
7
+ def create(attributes)
8
+ grant_edit_access
9
+ next_actor.create(attributes)
10
+ end
11
+
12
+ private
13
+
14
+ def grant_edit_access
15
+ curation_concern.edit_users += [user.user_key]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module CurationConcerns
2
+ module Actors
3
+ class InitializeWorkflowActor < AbstractActor
4
+ class_attribute :workflow_factory
5
+ self.workflow_factory = ::CurationConcerns::Workflow::WorkflowFactory
6
+
7
+ def create(attributes)
8
+ next_actor.create(attributes) && create_workflow(attributes)
9
+ end
10
+
11
+ private
12
+
13
+ # @return [TrueClass]
14
+ def create_workflow(attributes)
15
+ workflow_factory.create(curation_concern, attributes, user)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,47 @@
1
+ //= require highcharts
2
+ //= require highcharts/highcharts-more
3
+ //= require highcharts/modules/drilldown
4
+
5
+ (function( $ ){
6
+ $.fn.pie_chart = function(title, data) {
7
+ // Create the chart
8
+ $(this).highcharts({
9
+ chart: {
10
+ type: 'pie'
11
+ },
12
+ plotOptions: {
13
+ series: {
14
+ dataLabels: {
15
+ enabled: true,
16
+ format: '{point.name}: {point.y}'
17
+ }
18
+ }
19
+ },
20
+
21
+ credits: {
22
+ enabled: false
23
+ },
24
+
25
+ tooltip: {
26
+ headerFormat: '<span style="font-size:11px">{series.name}</span><br>',
27
+ pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.percentage:.2f}%</b> of total<br/>'
28
+ },
29
+ series: [{
30
+ name: title,
31
+ colorByPoint: true,
32
+ data: data.series
33
+ }],
34
+ title: null,
35
+ drilldown: data.drilldown
36
+ });
37
+ };
38
+ })( jQuery );
39
+
40
+ Blacklight.onLoad(function () {
41
+ $('.stats-pie').each (function () {
42
+ series = $(this).data('series');
43
+ title = $(this).data('title');
44
+ drilldown = $(this).data('drilldown');
45
+ $(this).pie_chart(title, series, drilldown);
46
+ });
47
+ });
@@ -10,7 +10,9 @@
10
10
  //= require curation_concerns/collections
11
11
  //= require curation_concerns/file_manager
12
12
  //= require curation_concerns/boot
13
+ //= require curation_concerns/charts
13
14
  //= require babel/polyfill
15
+ //= require curation_concerns/workflow_actions_affix
14
16
 
15
17
  // Initialize plugins and Bootstrap dropdowns on jQuery's ready event as well as
16
18
  // Turbolinks's page change event.
@@ -0,0 +1,11 @@
1
+ Blacklight.ready(function() {
2
+ $(document).on('scroll', function() {
3
+ var workflowDiv = $('#workflow_controls');
4
+ if($(window).scrollTop() + $(window).height() == $(document).height()){
5
+ workflowDiv.removeClass('workflow-affix');
6
+ }
7
+ if($(window).scrollTop() + $(window).height() < $('.form-actions').position().top) {
8
+ workflowDiv.addClass('workflow-affix');
9
+ }
10
+ });
11
+ });
@@ -0,0 +1,18 @@
1
+ @mixin widget-partial($col: 12) {
2
+ @include make-sm-column(12);
3
+ @include make-md-column($col);
4
+ .partial-wrapper {
5
+ @extend .panel;
6
+ @extend .panel-default;
7
+ }
8
+ }
9
+
10
+ .partial-total_objects {
11
+ @include widget-partial;
12
+ }
13
+ .partial-total_objects_charts {
14
+ @include widget-partial(6);
15
+ }
16
+ .partial-total_embargo_visibility {
17
+ @include widget-partial(6);
18
+ }
@@ -5,3 +5,4 @@
5
5
  @import "curation_concerns/typography";
6
6
  @import 'hydra-editor/multi_value_fields';
7
7
  @import 'curation_concerns/fileupload';
8
+ @import 'curation_concerns/admin';
@@ -138,3 +138,14 @@ legend + .form-group {
138
138
  display: block;
139
139
  padding: 0.5em 0;
140
140
  }
141
+
142
+ .workflow-affix {
143
+ position: fixed;
144
+ bottom: 0;
145
+ background: #FFF;
146
+ z-index: 2;
147
+ left: 0;
148
+ right: 0;
149
+ max-width: 1140px;
150
+ margin: 0 auto;
151
+ }
@@ -0,0 +1,25 @@
1
+ module CurationConcerns
2
+ # Behavior to allow any controller to be displayed within
3
+ # the administrative dashboard
4
+ #
5
+ # Example useage:
6
+ #
7
+ # module CurationConcerns
8
+ # class Admin::MyController < ApplicationController
9
+ # include CurationConcerns::ActAsAdminController
10
+ #
11
+ # # do my stuff ...
12
+ # end
13
+ # end
14
+ #
15
+ module ActAsAdminController
16
+ extend ActiveSupport::Concern
17
+ included do
18
+ before_action :load_configuration
19
+ layout 'admin'
20
+ end
21
+ def load_configuration
22
+ @configuration = CurationConcerns::AdminController.configuration
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,38 @@
1
+ module CurationConcerns
2
+ module AdminControllerBehavior
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ include AdminPage
7
+ before_action :require_permissions
8
+ end
9
+
10
+ def index
11
+ @resource_statistics = @configuration.fetch(:data_sources).fetch(:resource_stats).new
12
+ render 'index'
13
+ end
14
+
15
+ def search_builder
16
+ @search_builder ||= ::CatalogController.new.search_builder
17
+ end
18
+
19
+ def repository
20
+ @repository ||= ::CatalogController.new.repository
21
+ end
22
+
23
+ def workflow
24
+ @status_list = CurationConcerns::Workflow::StatusListService.new(current_user)
25
+ end
26
+
27
+ private
28
+
29
+ def require_permissions
30
+ authorize! :read, :admin_dashboard
31
+ end
32
+
33
+ # Loads the index action if it's only defined in the configuration.
34
+ def action_missing(action)
35
+ index if @configuration[:actions].include?(action)
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,18 @@
1
+ module CurationConcerns
2
+ module AdminPage
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ cattr_accessor :configuration
7
+ self.configuration = CurationConcerns.config.dashboard_configuration
8
+ before_action :load_configuration
9
+ layout "admin"
10
+ end
11
+
12
+ private
13
+
14
+ def load_configuration
15
+ @configuration = self.class.configuration.with_indifferent_access
16
+ end
17
+ end
18
+ end
@@ -17,7 +17,7 @@ module CurationConcerns
17
17
  # Catch permission errors
18
18
  rescue_from Hydra::AccessDenied, CanCan::AccessDenied do |exception|
19
19
  if exception.action == :edit
20
- redirect_to(collections.url_for(action: 'show'), alert: 'You do not have sufficient privileges to edit this document')
20
+ redirect_to(url_for(action: 'show'), alert: 'You do not have sufficient privileges to edit this document')
21
21
  elsif current_user && current_user.persisted?
22
22
  redirect_to root_url, alert: exception.message
23
23
  else
@@ -273,7 +273,8 @@ module CurationConcerns
273
273
  end
274
274
  end
275
275
 
276
- # Include 'catalog' and 'curation_concerns/base' in the search path for views
276
+ # Include 'catalog' and 'curation_concerns/base' in the search path for views, while prefering
277
+ # our local paths. Thus we are unable to just override `self.local_prefixes`
277
278
  def _prefixes
278
279
  @_prefixes ||= super + ['catalog', 'curation_concerns/base']
279
280
  end