sufia 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +247 -215
  3. data/README.md +7 -3
  4. data/SUFIA_VERSION +1 -1
  5. data/app/assets/javascripts/sufia.js +5 -2
  6. data/app/assets/javascripts/sufia/proxy_rights.js +68 -0
  7. data/app/assets/javascripts/sufia/transfers.js +3 -0
  8. data/app/assets/javascripts/sufia/user_search.js +31 -0
  9. data/app/assets/stylesheets/jquery-ui.css +17 -17
  10. data/app/assets/stylesheets/sufia.css.scss +3 -2
  11. data/app/assets/stylesheets/sufia/_proxy-rights.scss +10 -0
  12. data/app/controllers/concerns/sufia/contact_form_controller_behavior.rb +22 -23
  13. data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +41 -0
  14. data/app/controllers/concerns/sufia/files_controller_behavior.rb +1 -0
  15. data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +76 -0
  16. data/app/controllers/concerns/sufia/users_controller_behavior.rb +9 -11
  17. data/app/controllers/depositors_controller.rb +3 -0
  18. data/app/controllers/transfers_controller.rb +3 -0
  19. data/app/helpers/sufia/dashboard_helper_behavior.rb +15 -0
  20. data/app/helpers/sufia/sufia_helper_behavior.rb +24 -2
  21. data/app/jobs/content_depositor_change_event_job.rb +50 -0
  22. data/app/views/dashboard/_index_partials/_contents.html.erb +18 -0
  23. data/app/views/dashboard/_index_partials/_proxy_rights.html.erb +23 -0
  24. data/app/views/dashboard/_index_partials/_transfers.html.erb +14 -0
  25. data/app/views/generic_files/proxy.html.erb +5 -0
  26. data/app/views/generic_files/upload/_form.html.erb +7 -2
  27. data/app/views/my/_action_menu.html.erb +3 -1
  28. data/app/views/records/edit_fields/_default.html.erb +1 -1
  29. data/app/views/transfers/_received.html.erb +58 -0
  30. data/app/views/transfers/_sent.html.erb +38 -0
  31. data/app/views/transfers/index.html.erb +7 -0
  32. data/app/views/transfers/new.html.erb +23 -0
  33. data/app/views/users/_proxies.html.erb +8 -0
  34. data/app/views/users/_user_util_links_extra.html.erb +1 -0
  35. data/app/views/users/edit.html.erb +6 -1
  36. data/config/locales/sufia.en.yml +9 -4
  37. data/config/routes.rb +14 -3
  38. data/lib/sufia.rb +7 -5
  39. data/lib/sufia/version.rb +1 -1
  40. data/spec/controllers/authorities_controller_spec.rb +6 -6
  41. data/spec/controllers/batch_controller_spec.rb +29 -29
  42. data/spec/controllers/batch_edits_controller_spec.rb +7 -7
  43. data/spec/controllers/catalog_controller_spec.rb +9 -9
  44. data/spec/controllers/collections_controller_spec.rb +28 -28
  45. data/spec/controllers/content_blocks_controller_spec.rb +3 -3
  46. data/spec/controllers/dashboard_controller_spec.rb +1 -1
  47. data/spec/controllers/depositors_controller_spec.rb +50 -0
  48. data/spec/controllers/downloads_controller_spec.rb +22 -22
  49. data/spec/controllers/featured_work_lists_controller_spec.rb +1 -1
  50. data/spec/controllers/featured_works_controller_spec.rb +1 -1
  51. data/spec/controllers/generic_files_controller_spec.rb +98 -90
  52. data/spec/controllers/homepage_controller_spec.rb +1 -1
  53. data/spec/controllers/mailbox_controller_spec.rb +10 -10
  54. data/spec/controllers/my/collections_controller_spec.rb +1 -1
  55. data/spec/controllers/my/files_controller_spec.rb +1 -1
  56. data/spec/controllers/my/highlights_controller_spec.rb +1 -1
  57. data/spec/controllers/my/shares_controller_spec.rb +1 -1
  58. data/spec/controllers/my_controller_spec.rb +1 -1
  59. data/spec/controllers/pages_controller_spec.rb +1 -1
  60. data/spec/controllers/single_use_links_controller_spec.rb +46 -50
  61. data/spec/controllers/single_use_links_viewer_controller_spec.rb +16 -16
  62. data/spec/controllers/static_controller_spec.rb +9 -9
  63. data/spec/controllers/tinymce_assets_controller_spec.rb +1 -1
  64. data/spec/controllers/transfers_controller_spec.rb +212 -0
  65. data/spec/controllers/users_controller_spec.rb +1 -1
  66. data/spec/factories/generic_files.rb +4 -4
  67. data/spec/factories/proxy_deposit_requests.rb +6 -0
  68. data/spec/features/browse_dashboard_files_spec.rb +25 -36
  69. data/spec/features/browse_files_spec.rb +18 -13
  70. data/spec/features/catalog_search_spec.rb +3 -6
  71. data/spec/features/cloud_upload_spec.rb +5 -7
  72. data/spec/features/collection_spec.rb +28 -35
  73. data/spec/features/contact_form_spec.rb +24 -24
  74. data/spec/features/display_dashboard_spec.rb +11 -11
  75. data/spec/features/ingest_upload_files_spec.rb +10 -10
  76. data/spec/features/notifications_spec.rb +11 -11
  77. data/spec/features/ownership_transfer_spec.rb +111 -0
  78. data/spec/features/proxy_spec.rb +52 -0
  79. data/spec/features/search_spec.rb +1 -1
  80. data/spec/features/single_use_links_spec.rb +28 -18
  81. data/spec/features/users_spec.rb +3 -3
  82. data/spec/helpers/batch_edits_helper_spec.rb +1 -1
  83. data/spec/helpers/content_block_helper_spec.rb +1 -1
  84. data/spec/helpers/dashboard_helper_spec.rb +1 -1
  85. data/spec/helpers/generic_file_helper_spec.rb +1 -1
  86. data/spec/helpers/records_helper_spec.rb +1 -1
  87. data/spec/helpers/sufia_helper_spec.rb +8 -8
  88. data/spec/helpers/trophy_helper_spec.rb +1 -1
  89. data/spec/jobs/audit_job_spec.rb +5 -5
  90. data/spec/jobs/batch_update_job_spec.rb +14 -14
  91. data/spec/jobs/content_depositor_change_event_job_spec.rb +22 -0
  92. data/spec/jobs/event_jobs_spec.rb +104 -104
  93. data/spec/jobs/import_url_job_spec.rb +2 -2
  94. data/spec/jobs/ingest_local_file_job_spec.rb +1 -1
  95. data/spec/lib/sufia/breadcrumbs_spec.rb +3 -3
  96. data/spec/lib/sufia/id_service_spec.rb +1 -1
  97. data/spec/lib/sufia/upload_complete_behavior_spec.rb +4 -4
  98. data/spec/models/ability_spec.rb +59 -15
  99. data/spec/models/batch_spec.rb +16 -16
  100. data/spec/models/characterization_spec.rb +1 -1
  101. data/spec/models/checksum_audit_log_spec.rb +34 -26
  102. data/spec/models/collection_spec.rb +1 -1
  103. data/spec/models/download_spec.rb +1 -1
  104. data/spec/models/featured_work_list_spec.rb +1 -1
  105. data/spec/models/featured_work_spec.rb +15 -4
  106. data/spec/models/file_content_datastream_spec.rb +14 -14
  107. data/spec/models/file_usage_spec.rb +1 -1
  108. data/spec/models/fits_datastream_spec.rb +1 -1
  109. data/spec/models/generic_file/reload_on_save_spec.rb +4 -4
  110. data/spec/models/generic_file/visibility_spec.rb +1 -1
  111. data/spec/models/generic_file/web_form_spec.rb +6 -5
  112. data/spec/models/generic_file_rdf_datastream_spec.rb +1 -1
  113. data/spec/models/generic_file_spec.rb +254 -220
  114. data/spec/models/geo_names_resource_spec.rb +2 -2
  115. data/spec/models/local_authority_spec.rb +60 -59
  116. data/spec/models/pageview_spec.rb +1 -1
  117. data/spec/models/properties_datastream_spec.rb +29 -10
  118. data/spec/models/proxy_deposit_request_spec.rb +107 -0
  119. data/spec/models/single_use_link_spec.rb +13 -13
  120. data/spec/models/solr_document_spec.rb +1 -1
  121. data/spec/models/trophy_spec.rb +6 -6
  122. data/spec/models/user_spec.rb +38 -22
  123. data/spec/routing/featured_works_route_spec.rb +1 -1
  124. data/spec/routing/ownership_transfers_route_spec.rb +45 -0
  125. data/spec/routing/route_spec.rb +42 -42
  126. data/spec/services/noid_spec.rb +2 -2
  127. data/spec/spec_helper.rb +10 -5
  128. data/spec/support/cleaner.rb +12 -0
  129. data/spec/support/features.rb +5 -0
  130. data/spec/support/features/session_helpers.rb +3 -17
  131. data/spec/support/locations.rb +36 -0
  132. data/spec/support/poltergeist.rb +11 -0
  133. data/spec/support/proxies.rb +14 -0
  134. data/spec/support/selectors.rb +122 -0
  135. data/spec/views/batch/edit.html.erb_spec.rb +1 -1
  136. data/spec/views/batch_edits/check_all_spec.rb +4 -4
  137. data/spec/views/catalog/index.html.erb_spec.rb +1 -1
  138. data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +1 -1
  139. data/spec/views/collections/_form.html.erb_spec.rb +3 -1
  140. data/spec/views/collections/_show_descriptions.html.erb_spec.rb +1 -1
  141. data/spec/views/dashboard/index_spec.rb +3 -6
  142. data/spec/views/generic_file/edit.html.erb_spec.rb +1 -1
  143. data/spec/views/generic_file/show.html.erb_spec.rb +1 -1
  144. data/spec/views/generic_file/stats.html.erb_spec.rb +1 -1
  145. data/spec/views/my/facet.html.erb_spec.rb +2 -2
  146. data/spec/views/users/_follower_modal.html.erb_spec.rb +1 -1
  147. data/spec/views/users/_following_modal.html.erb_spec.rb +1 -1
  148. data/spec/views/users/_notify_number.html.erb_spec.rb +1 -1
  149. data/spec/views/users/_user_util_links.html.erb_spec.rb +1 -1
  150. data/spec/views/users/index.html.erb_spec.rb +2 -2
  151. data/spec/views/users/show.html.erb_spec.rb +2 -2
  152. data/sufia-models/app/models/concerns/sufia/ability.rb +22 -0
  153. data/sufia-models/app/models/concerns/sufia/generic_file.rb +1 -0
  154. data/sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb +22 -0
  155. data/sufia-models/app/models/concerns/sufia/properties_datastream_behavior.rb +3 -0
  156. data/sufia-models/app/models/concerns/sufia/user.rb +9 -0
  157. data/sufia-models/app/models/proxy_deposit_request.rb +85 -0
  158. data/sufia-models/app/models/proxy_deposit_rights.rb +4 -0
  159. data/sufia-models/app/models/sufia/avatar_uploader.rb +2 -3
  160. data/sufia-models/lib/generators/sufia/models/install_generator.rb +9 -1
  161. data/sufia-models/lib/generators/sufia/models/proxies_generator.rb +53 -0
  162. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_requests.rb +16 -0
  163. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_rights.rb +11 -0
  164. data/sufia-models/lib/sufia/models/engine.rb +1 -1
  165. data/sufia-models/lib/sufia/models/version.rb +1 -1
  166. data/sufia.gemspec +2 -1
  167. data/tasks/sufia-dev.rake +5 -0
  168. metadata +82 -6
  169. data/tasks/sufia-db.rake +0 -21
data/README.md CHANGED
@@ -32,7 +32,7 @@ Sufia has the following features:
32
32
  * Full-text indexing & searching
33
33
  * Responsive, fluid, Bootstrap 3-based UI
34
34
  * Dynamically configurable featured works and researchers on homepage
35
- * Proxy deposit and transfers of ownership (coming soon!)
35
+ * Proxy deposit and transfers of ownership
36
36
 
37
37
  ## License
38
38
 
@@ -119,8 +119,8 @@ Turbolinks does not mix well with Blacklight.
119
119
 
120
120
  #### Kaminari
121
121
 
122
- The line with kaminari listed as a dependency in Gemfile is a temporary fix to address a
123
- [problem](https://github.com/amatsuda/kaminari/pull/322) in the current release of kaminari.
122
+ The line with kaminari listed as a dependency in Gemfile is a temporary fix to address a
123
+ [problem](https://github.com/amatsuda/kaminari/pull/322) in the current release of kaminari.
124
124
  Technically you should not have to list kaminari, which is a dependency of blacklight and sufia.
125
125
 
126
126
  #### Bundler
@@ -139,6 +139,10 @@ Bundler could not find compatible versions for gem "bootstrap-sass":
139
139
 
140
140
  The solution is to update your bundler gem to the latest version.
141
141
 
142
+ ### Proxies and Transfers
143
+
144
+ To add proxies and transfers to your Sufia 4-based app, run the 'sufia:models:proxies' generator and then run 'rake db:migrate'.
145
+
142
146
  ### Analytics
143
147
 
144
148
  Sufia provides support for capturing usage information via Google Analytics and for displaying usage stats in the UI.
@@ -1 +1 @@
1
- 4.0.1
1
+ 4.1.0
@@ -19,6 +19,7 @@
19
19
  //= require jquery.validate
20
20
  //= require swfobject
21
21
  //= require ZeroClipboard.min
22
+ //= require select2
22
23
 
23
24
  //= require flot/excanvas
24
25
  //= require flot/jquery.flot
@@ -42,9 +43,13 @@
42
43
  //= require sufia/editor
43
44
  //= require sufia/ga_events
44
45
  //= require sufia/tabs
46
+ //= require sufia/user_search
47
+ //= require sufia/transfers
48
+ //= require sufia/proxy_rights
45
49
  //= require hydra/batch_select
46
50
  //= require sufia/dashboard_actions
47
51
  //= require sufia/batch
52
+
48
53
  //= require hydra_collections
49
54
  //= require browse_everything
50
55
  //= require jquery.blacklightTagCloud
@@ -98,10 +103,8 @@ Blacklight.onLoad(function() {
98
103
  });
99
104
  };
100
105
 
101
-
102
106
  $("a[rel=popover]").click(function() { return false;});
103
107
 
104
-
105
108
  /*
106
109
  * facets lists
107
110
  */
@@ -0,0 +1,68 @@
1
+ (function( $ ){
2
+
3
+ $.fn.proxyRights = function( options ) {
4
+
5
+ // Create some defaults, extending them with any options that were provided
6
+ var settings = $.extend( { }, options);
7
+
8
+ var $container = this;
9
+
10
+ function addContributor(name, id, grantor) {
11
+ data = {name: name, id: id}
12
+
13
+ $.ajax({
14
+ type: "POST",
15
+ url: '/users/'+grantor+'/depositors',
16
+ dataType: 'json',
17
+ data: {grantee_id: id},
18
+ success: function (data) {
19
+ if (data.name !== undefined) {
20
+ row = rowTemplate(data);
21
+ $('#authorizedProxies tbody', $container).append(row);
22
+ if (settings.afterAdd)
23
+ settings.afterAdd(this, cloneElem);
24
+ }
25
+ }
26
+ })
27
+ return false;
28
+ }
29
+
30
+ function removeContributor(event) {
31
+ event.preventDefault();
32
+ $.ajax({
33
+ url: $(this).closest('a').prop('href'),
34
+ type: "post",
35
+ dataType: "json",
36
+ data: {"_method":"delete"}
37
+ });
38
+ $(this).closest('tr').remove();
39
+ return false;
40
+ }
41
+
42
+ function rowTemplate (data) {
43
+ return '<tr>'+
44
+ '<td class="depositor-name">'+data.name+'</td>'+
45
+ '<td><a class="remove-proxy-button" data-method="delete" href="'+data.delete_path+'" rel="nofollow">'+
46
+ '<i class="glyphicon glyphicon-remove"></i></a>'+
47
+ '</td>'+
48
+ '</tr>'
49
+ }
50
+
51
+ $("#user").userSearch();
52
+ $("#user").on("change", function() {
53
+ // Remove the choice from the select2 widget and put it in the table.
54
+ obj = $("#user").select2("data")
55
+ grantor = $('#user').data('grantor')
56
+ $("#user").select2("val", '')
57
+ addContributor(obj.text, obj.id, grantor);
58
+ });
59
+
60
+ $('body').on('click', 'a.remove-proxy-button', removeContributor);
61
+
62
+ };
63
+
64
+ })( jQuery );
65
+
66
+ Blacklight.onLoad(function() {
67
+ $('.proxy-rights').proxyRights();
68
+ });
@@ -0,0 +1,3 @@
1
+ $(document).ready(function() {
2
+ $("#proxy_deposit_request_transfer_to").userSearch();
3
+ });
@@ -0,0 +1,31 @@
1
+ (function( $ ){
2
+
3
+ $.fn.userSearch = function( options ) {
4
+ // Create some defaults, extending them with any options that were provided
5
+ var settings = $.extend( { }, options);
6
+
7
+ var $container = this;
8
+
9
+ return this.each(function() {
10
+ $(this).select2( {
11
+ placeholder: "Search for a user",
12
+ minimumInputLength: 2,
13
+ initSelection: function(element, callback) { },
14
+ ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
15
+ url: "/users.json",
16
+ dataType: 'json',
17
+ data: function (term, page) {
18
+ return {
19
+ uq: term // search term
20
+ };
21
+ },
22
+ results: function (data, page) { // parse the results into the format expected by Select2.
23
+ // since we are using custom formatting functions we do not need to alter remote JSON data
24
+ return {results: data};
25
+ }
26
+ },
27
+ }).select2('data', null);
28
+ });
29
+
30
+ };
31
+ })( jQuery );
@@ -243,25 +243,25 @@ body .ui-tooltip { border-width: 2px; }
243
243
  .ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
244
244
  .ui-widget .ui-widget { font-size: 1em; }
245
245
  .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }
246
- .ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }
246
+ .ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }
247
247
  .ui-widget-content a { color: #222222/*{fcContent}*/; }
248
- .ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }
248
+ .ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }
249
249
  .ui-widget-header a { color: #222222/*{fcHeader}*/; }
250
250
 
251
251
  /* Interaction states
252
252
  ----------------------------------*/
253
- .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }
253
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }
254
254
  .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; }
255
- .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; }
255
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; }
256
256
  .ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: #212121/*{fcHover}*/; text-decoration: none; }
257
- .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }
257
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }
258
258
  .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; }
259
259
 
260
260
  /* Interaction Cues
261
261
  ----------------------------------*/
262
- .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
262
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
263
263
  .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }
264
- .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
264
+ .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
265
265
  .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; }
266
266
  .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }
267
267
  .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
@@ -273,14 +273,14 @@ body .ui-tooltip { border-width: 2px; }
273
273
  ----------------------------------*/
274
274
 
275
275
  /* states and images */
276
- .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
277
- .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
278
- .ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
279
- .ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
280
- .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }
281
- .ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }
282
- .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
283
- .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
276
+ .ui-icon { width: 16px; height: 16px; background-image: url(ui-icons_222222_256x240.png)/*{iconsContent}*/; }
277
+ .ui-widget-content .ui-icon {background-image: url(ui-icons_222222_256x240.png)/*{iconsContent}*/; }
278
+ .ui-widget-header .ui-icon {background-image: url(ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
279
+ .ui-state-default .ui-icon { background-image: url(ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
280
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(ui-icons_454545_256x240.png)/*{iconsHover}*/; }
281
+ .ui-state-active .ui-icon {background-image: url(ui-icons_454545_256x240.png)/*{iconsActive}*/; }
282
+ .ui-state-highlight .ui-icon {background-image: url(ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
283
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
284
284
 
285
285
  /* positioning */
286
286
  .ui-icon-carat-1-n { background-position: 0 0; }
@@ -470,5 +470,5 @@ body .ui-tooltip { border-width: 2px; }
470
470
  .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
471
471
 
472
472
  /* Overlays */
473
- .ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
474
- .ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }
473
+ .ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
474
+ .ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }
@@ -3,6 +3,7 @@
3
3
  *= require generic_files
4
4
  *= require video-js
5
5
  *= require jquery-ui
6
+ *= require select2
6
7
  *= require sufia-audio-overrides
7
8
  *= require nestable
8
9
  */
@@ -14,7 +15,7 @@
14
15
  // Use import here instead of require so we can use the Sass variables defined in Bootstrap and Blacklight
15
16
  // TODO: Probably should use import throughout and move all of Sufia's stylesheets into a single named directory.
16
17
  @import 'sufia/settings','sufia/header','sufia/styles','sufia/file-listing','sufia/collections','sufia/batch-edit',
17
- 'sufia/dashboard','sufia/home-page','sufia/featured','sufia/tagcloud','sufia/usage-stats','sufia/catalog','sufia/buttons';
18
+ 'sufia/dashboard','sufia/home-page','sufia/featured','sufia/tagcloud','sufia/usage-stats','sufia/catalog','sufia/buttons','sufia/proxy-rights';
18
19
 
19
20
  #browse-everything {
20
21
  top:10%;
@@ -48,4 +49,4 @@
48
49
 
49
50
  .button_to-inline {
50
51
  display: inline-block;
51
- }
52
+ }
@@ -0,0 +1,10 @@
1
+ table#authorizedProxies {
2
+ a.remove-proxy-button {
3
+ i {
4
+ color: darken(red, 30%);
5
+ }
6
+ &:hover i {
7
+ color: red;
8
+ }
9
+ }
10
+ }
@@ -1,31 +1,30 @@
1
1
  module Sufia
2
2
  module ContactFormControllerBehavior
3
+ def new
4
+ @contact_form = ContactForm.new
5
+ end
3
6
 
4
- def new
5
- @contact_form = ContactForm.new
6
- end
7
-
8
- def create
9
- @contact_form = ContactForm.new(params[:contact_form])
10
- @contact_form.request = request
11
- # not spam and a valid form
12
- logger.warn "*** MARK ***"
13
- if @contact_form.deliver
14
- flash.now[:notice] = 'Thank you for your message!'
15
- after_deliver
16
- render :new
17
- else
18
- flash[:error] = 'Sorry, this message was not sent successfully. '
19
- flash[:error] << @contact_form.errors.full_messages.map { |s| s.to_s }.join(",")
7
+ def create
8
+ @contact_form = ContactForm.new(params[:contact_form])
9
+ @contact_form.request = request
10
+ # not spam and a valid form
11
+ logger.warn "*** MARK ***"
12
+ if @contact_form.deliver
13
+ flash.now[:notice] = 'Thank you for your message!'
14
+ after_deliver
15
+ render :new
16
+ else
17
+ flash.now[:error] = 'Sorry, this message was not sent successfully. '
18
+ flash.now[:error] << @contact_form.errors.full_messages.map(&:to_s).join(",")
19
+ render :new
20
+ end
21
+ rescue
22
+ flash.now[:error] = 'Sorry, this message was not delivered.'
20
23
  render :new
21
24
  end
22
- rescue
23
- flash[:error] = 'Sorry, this message was not delivered.'
24
- render :new
25
- end
26
25
 
27
- def after_deliver
28
- return unless Sufia::Engine.config.enable_contact_form_delivery
29
- end
26
+ def after_deliver
27
+ return unless Sufia::Engine.config.enable_contact_form_delivery
28
+ end
30
29
  end
31
30
  end
@@ -0,0 +1,41 @@
1
+ module Sufia
2
+ module DepositorsControllerBehavior
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ before_filter :authenticate_user!
7
+ before_filter :validate_users, only: :create
8
+ end
9
+
10
+ def create
11
+ grantor = authorize_and_return_grantor
12
+ grantee = ::User.from_url_component(params[:grantee_id])
13
+ if grantor.can_receive_deposits_from.include?(grantee)
14
+ head :ok
15
+ else
16
+ grantor.can_receive_deposits_from << grantee
17
+ render json: { name: grantee.name, delete_path: sufia.user_depositor_path(grantor.user_key, grantee.user_key) }
18
+ end
19
+ end
20
+
21
+ def destroy
22
+ grantor = authorize_and_return_grantor
23
+ grantor.can_receive_deposits_from.delete(::User.from_url_component(params[:id]))
24
+ head :ok
25
+ end
26
+
27
+ def validate_users
28
+ if params[:user_id] == params[:grantee_id]
29
+ head :ok
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def authorize_and_return_grantor
36
+ grantor = ::User.from_url_component(params[:user_id])
37
+ authorize! :edit, grantor
38
+ return grantor
39
+ end
40
+ end
41
+ end
@@ -211,6 +211,7 @@ module Sufia
211
211
  def update_metadata_from_upload_screen
212
212
  # Relative path is set by the jquery uploader when uploading a directory
213
213
  @generic_file.relative_path = params[:relative_path] if params[:relative_path]
214
+ @generic_file.on_behalf_of = params[:on_behalf_of] if params[:on_behalf_of]
214
215
  end
215
216
  end
216
217
  end
@@ -0,0 +1,76 @@
1
+ module Sufia
2
+ module TransfersControllerBehavior
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ before_action :load_proxy_deposit_request, only: :create
7
+ load_and_authorize_resource :proxy_deposit_request, parent: false, except: :index
8
+ before_action :get_pid_and_authorize_depositor, only: [:new, :create]
9
+ # Catch permission errors
10
+ # TODO we should make this a module in Sufia
11
+ rescue_from CanCan::AccessDenied do |exception|
12
+ if current_user and current_user.persisted?
13
+ redirect_to root_url, alert: exception.message
14
+ else
15
+ session["user_return_to"] = request.url
16
+ redirect_to new_user_session_url, alert: exception.message
17
+ end
18
+ end
19
+ end
20
+
21
+ def new
22
+ @generic_file = ::GenericFile.load_instance_from_solr(@pid)
23
+ end
24
+
25
+ def create
26
+ @proxy_deposit_request.sending_user = current_user
27
+ if @proxy_deposit_request.save
28
+ redirect_to sufia.transfers_path, notice: "Transfer request created"
29
+ else
30
+ redirect_to root_url, alert: @proxy_deposit_request.errors.full_messages.to_sentence
31
+ end
32
+ end
33
+
34
+ def index
35
+ @incoming = ProxyDepositRequest.where(receiving_user_id: current_user.id).reject &:deleted_file?
36
+ @outgoing = ProxyDepositRequest.where(sending_user_id: current_user.id)
37
+ end
38
+
39
+ def accept
40
+ @proxy_deposit_request.transfer!(params[:reset])
41
+ if params[:sticky]
42
+ current_user.can_receive_deposits_from << @proxy_deposit_request.sending_user
43
+ end
44
+ redirect_to sufia.transfers_path, notice: "Transfer complete"
45
+ end
46
+
47
+ def reject
48
+ @proxy_deposit_request.reject!
49
+ redirect_to sufia.transfers_path, notice: "Transfer rejected"
50
+ end
51
+
52
+ def destroy
53
+ @proxy_deposit_request.cancel!
54
+ redirect_to sufia.transfers_path, notice: "Transfer canceled"
55
+ end
56
+
57
+ private
58
+
59
+ def get_pid_and_authorize_depositor
60
+ @pid = Sufia::Noid.namespaceize(params[:id])
61
+ authorize! :edit, @pid
62
+ raise Hydra::AccessDenied unless ::GenericFile.load_instance_from_solr(@pid).depositor == current_user.user_key
63
+ @proxy_deposit_request.pid = @pid
64
+ rescue
65
+ redirect_to root_url, alert: 'You are not authorized to transfer this file'
66
+ end
67
+
68
+ def load_proxy_deposit_request
69
+ @proxy_deposit_request = ProxyDepositRequest.new(proxy_deposit_request_params)
70
+ end
71
+
72
+ def proxy_deposit_request_params
73
+ params.require(:proxy_deposit_request).permit(:transfer_to)
74
+ end
75
+ end
76
+ end