sufia 1.3.0 → 2.0.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 (163) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -3
  3. data/Gemfile +1 -0
  4. data/Releasing_sufia.md +3 -0
  5. data/SUFIA_VERSION +1 -0
  6. data/app/assets/javascripts/sufia.js +22 -24
  7. data/app/assets/javascripts/sufia/batch_select_all.js +2 -0
  8. data/app/assets/javascripts/sufia/fileupload.js +6 -0
  9. data/app/assets/javascripts/sufia/uploader.js +165 -0
  10. data/app/assets/javascripts/terms_of_service.js +36 -30
  11. data/app/assets/stylesheets/{scholarsphere-bootstrap.css → application-bootstrap.css} +0 -0
  12. data/app/assets/stylesheets/sufia.css.scss +1 -1
  13. data/app/controllers/batch_controller.rb +1 -0
  14. data/app/controllers/concerns/sufia/users_controller_behavior.rb +2 -1
  15. data/app/helpers/generic_file_helper.rb +17 -0
  16. data/{lib/sufia → app}/jobs/content_delete_event_job.rb +0 -0
  17. data/{lib/sufia → app}/jobs/content_deposit_event_job.rb +0 -0
  18. data/{lib/sufia → app}/jobs/content_new_version_event_job.rb +0 -0
  19. data/{lib/sufia → app}/jobs/content_restored_version_event_job.rb +0 -0
  20. data/{lib/sufia → app}/jobs/content_update_event_job.rb +0 -0
  21. data/{lib/sufia → app}/jobs/event_job.rb +0 -0
  22. data/{lib/sufia → app}/jobs/user_edit_profile_event_job.rb +0 -0
  23. data/{lib/sufia → app}/jobs/user_follow_event_job.rb +0 -0
  24. data/{lib/sufia → app}/jobs/user_unfollow_event_job.rb +0 -0
  25. data/app/models/contact_form.rb +2 -2
  26. data/app/views/_ga.html.erb +2 -2
  27. data/app/views/batch_edits/_batch_edits_actions.html.erb +1 -0
  28. data/app/views/batch_edits/_check_all.html.erb +1 -2
  29. data/app/views/catalog/_sort_and_per_page.html.erb +1 -1
  30. data/app/views/dashboard/_batch_edits_actions.html.erb +2 -0
  31. data/app/views/dashboard/_sort_and_per_page.html.erb +1 -1
  32. data/app/views/generic_files/_breadcrumbs.html.erb +5 -1
  33. data/app/views/generic_files/_descriptions.html.erb +6 -4
  34. data/app/views/generic_files/_dropbox_import.html.erb +3 -0
  35. data/app/views/generic_files/_field_display.html.erb +12 -0
  36. data/app/views/generic_files/_field_form.html.erb +1 -1
  37. data/app/views/generic_files/_multiple_upload.html.erb +4 -135
  38. data/app/views/generic_files/_permission_form.html.erb +5 -5
  39. data/app/views/generic_files/_show_descriptions.html.erb +6 -14
  40. data/app/views/generic_files/_show_details.html.erb +2 -2
  41. data/app/views/generic_files/edit_fields/_resource_type.html.erb +9 -0
  42. data/app/views/generic_files/edit_fields/_rights.html.erb +1 -1
  43. data/app/views/generic_files/edit_fields/_type.html.erb +4 -1
  44. data/app/views/generic_files/new.html.erb +18 -1
  45. data/app/views/generic_files/show_fields/_default.html.erb +12 -0
  46. data/app/views/generic_files/upload/_agreement.html.erb +5 -0
  47. data/app/views/generic_files/upload/_alerts.html.erb +19 -0
  48. data/app/views/generic_files/upload/_dropbox_chooser.html.erb +39 -0
  49. data/app/views/generic_files/upload/_form.html.erb +6 -0
  50. data/app/views/generic_files/upload/_form_fields.html.erb +47 -0
  51. data/app/views/generic_files/upload/_script_templates.html.erb +61 -0
  52. data/app/views/generic_files/upload/_tos_checkbox.html.erb +3 -0
  53. data/app/views/layouts/_head-tag-content.html.erb +22 -0
  54. data/app/views/layouts/{hydra-head.html.erb → homepage.html.erb} +3 -44
  55. data/app/views/layouts/sufia-one-column.html.erb +43 -0
  56. data/app/views/layouts/sufia-two-column.html.erb +45 -0
  57. data/app/views/static/agreement.html.erb +12 -11
  58. data/app/views/static/mendeley.html.erb +2 -2
  59. data/app/views/static/terms.html.erb +11 -11
  60. data/app/views/static/zotero.html.erb +2 -2
  61. data/config/initializers/sufia_events.rb +3 -0
  62. data/config/locales/sufia.en.yml +3 -6
  63. data/features/step_definitions/{scholarsphere.rb → sufia.rb} +0 -0
  64. data/lib/generators/sufia/sufia_generator.rb +1 -1
  65. data/lib/generators/sufia/templates/config/resque_config.rb +1 -1
  66. data/lib/generators/sufia/templates/config/sufia.rb +3 -0
  67. data/lib/sufia.rb +1 -50
  68. data/lib/sufia/batch_edits_controller_behavior.rb +4 -0
  69. data/lib/sufia/controller.rb +13 -0
  70. data/lib/sufia/dashboard_controller_behavior.rb +3 -2
  71. data/lib/sufia/files_controller_behavior.rb +35 -12
  72. data/lib/sufia/version.rb +1 -1
  73. data/spec/controllers/batch_edits_controller_spec.rb +2 -2
  74. data/spec/controllers/generic_files_controller_spec.rb +37 -1
  75. data/spec/models/generic_file_spec.rb +6 -6
  76. data/spec/models/properties_datastream_spec.rb +8 -7
  77. data/spec/models/transcode_audio_job_spec.rb +1 -1
  78. data/spec/models/transcode_video_job_spec.rb +1 -1
  79. data/spec/views/batch_edits/check_all_spec.rb +22 -0
  80. data/sufia-models/.gitignore +17 -0
  81. data/sufia-models/Gemfile +4 -0
  82. data/sufia-models/LICENSE.md +177 -0
  83. data/sufia-models/README.md +39 -0
  84. data/sufia-models/Rakefile +1 -0
  85. data/{app → sufia-models/app}/models/batch.rb +2 -4
  86. data/{app → sufia-models/app}/models/checksum_audit_log.rb +3 -4
  87. data/{app → sufia-models/app}/models/datastreams/batch_rdf_datastream.rb +0 -0
  88. data/{app → sufia-models/app}/models/datastreams/file_content_datastream.rb +0 -0
  89. data/{app → sufia-models/app}/models/datastreams/fits_datastream.rb +0 -0
  90. data/{app → sufia-models/app}/models/datastreams/generic_file_rdf_datastream.rb +12 -12
  91. data/{app → sufia-models/app}/models/datastreams/paranoid_rights_datastream.rb +0 -15
  92. data/{app → sufia-models/app}/models/datastreams/properties_datastream.rb +1 -2
  93. data/{app → sufia-models/app}/models/domain_term.rb +0 -0
  94. data/{app → sufia-models/app}/models/follow.rb +0 -0
  95. data/{app → sufia-models/app}/models/generic_file.rb +0 -0
  96. data/{app → sufia-models/app}/models/geo_names_resource.rb +0 -0
  97. data/{app → sufia-models/app}/models/group.rb +0 -0
  98. data/{app → sufia-models/app}/models/local_authority.rb +0 -0
  99. data/{app → sufia-models/app}/models/local_authority_entry.rb +0 -0
  100. data/{app → sufia-models/app}/models/single_use_link.rb +0 -0
  101. data/{app → sufia-models/app}/models/subject_local_authority_entry.rb +0 -0
  102. data/{app → sufia-models/app}/models/trophy.rb +0 -0
  103. data/{app → sufia-models/app}/models/version_committer.rb +0 -0
  104. data/sufia-models/config/locales/sufia.en.yml +6 -0
  105. data/sufia-models/lib/sufia/models.rb +34 -0
  106. data/{lib/sufia → sufia-models/lib/sufia/models}/active_fedora/redis.rb +0 -0
  107. data/{lib/sufia → sufia-models/lib/sufia/models}/active_record/redis.rb +0 -0
  108. data/{lib → sufia-models/lib/sufia/models}/active_support/core_ext/marshal.rb +0 -0
  109. data/sufia-models/lib/sufia/models/engine.rb +61 -0
  110. data/sufia-models/lib/sufia/models/file_content.rb +9 -0
  111. data/{lib/sufia → sufia-models/lib/sufia/models}/file_content/extract_metadata.rb +2 -2
  112. data/{lib/sufia → sufia-models/lib/sufia/models}/file_content/versions.rb +0 -0
  113. data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file.rb +3 -34
  114. data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file/actions.rb +16 -1
  115. data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file/audit.rb +1 -1
  116. data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file/characterization.rb +1 -2
  117. data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file/export.rb +0 -0
  118. data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file/permissions.rb +0 -1
  119. data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file/thumbnail.rb +3 -3
  120. data/sufia-models/lib/sufia/models/generic_file/web_form.rb +45 -0
  121. data/{lib/sufia → sufia-models/lib/sufia/models}/id_service.rb +11 -7
  122. data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/audit_job.rb +0 -0
  123. data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/batch_update_job.rb +0 -0
  124. data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/characterize_job.rb +0 -0
  125. data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/ffmpeg_transcode_job.rb +3 -3
  126. data/sufia-models/lib/sufia/models/jobs/import_url_job.rb +55 -0
  127. data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/resolrize_job.rb +0 -0
  128. data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/transcode_audio_job.rb +0 -0
  129. data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/transcode_video_job.rb +0 -0
  130. data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/unzip_job.rb +16 -4
  131. data/{lib/sufia → sufia-models/lib/sufia/models}/model_methods.rb +0 -0
  132. data/{lib/sufia → sufia-models/lib/sufia/models}/noid.rb +1 -1
  133. data/{lib/sufia/queue → sufia-models/lib/sufia/models}/resque.rb +0 -2
  134. data/{lib/sufia → sufia-models/lib/sufia/models}/solr_document_behavior.rb +0 -0
  135. data/{lib/sufia → sufia-models/lib/sufia/models}/user.rb +1 -1
  136. data/{lib/sufia → sufia-models/lib/sufia/models}/utils.rb +0 -0
  137. data/sufia-models/lib/sufia/models/version.rb +5 -0
  138. data/sufia-models/lib/tasks/sufia-models_tasks.rake +7 -0
  139. data/sufia-models/sufia-models.gemspec +44 -0
  140. data/sufia.gemspec +2 -12
  141. data/tasks/release.rake +90 -0
  142. data/tasks/sufia-dev.rake +1 -1
  143. data/tasks/sufia.rake +1 -3
  144. metadata +118 -238
  145. data/app/views/generic_files/show_fields/_based_near.html.erb +0 -12
  146. data/app/views/generic_files/show_fields/_contributor.html.erb +0 -12
  147. data/app/views/generic_files/show_fields/_creator.html.erb +0 -12
  148. data/app/views/generic_files/show_fields/_date_created.html.erb +0 -12
  149. data/app/views/generic_files/show_fields/_description.html.erb +0 -12
  150. data/app/views/generic_files/show_fields/_identifier.html.erb +0 -9
  151. data/app/views/generic_files/show_fields/_language.html.erb +0 -9
  152. data/app/views/generic_files/show_fields/_publisher.html.erb +0 -12
  153. data/app/views/generic_files/show_fields/_related_url.html.erb +0 -11
  154. data/app/views/generic_files/show_fields/_resource_type.html.erb +0 -9
  155. data/app/views/generic_files/show_fields/_rights.html.erb +0 -9
  156. data/app/views/generic_files/show_fields/_subject.html.erb +0 -12
  157. data/app/views/generic_files/show_fields/_tag.html.erb +0 -9
  158. data/app/views/generic_files/show_fields/_title.html.erb +0 -12
  159. data/lib/sufia/file_content.rb +0 -8
  160. data/lib/sufia/generic_file/web_form.rb +0 -15
  161. data/vendor/assets/javascripts/fileupload.js +0 -6
  162. data/vendor/assets/javascripts/fileupload/application.js +0 -185
  163. data/vendor/assets/javascripts/fileupload/jquery-ui-1.8.14.custom.min.js +0 -76
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c996c5fa4051c743da19c5d5f6bb7a9cc68d696e
4
- data.tar.gz: 6254959c903a88cfb98bd79cad26bbd34a9c6d6d
3
+ metadata.gz: 5ad309d6c3fa30869b2f0924d74a036d13711336
4
+ data.tar.gz: 11696006de86c1fc1e1d382c11476aa731d6b374
5
5
  SHA512:
6
- metadata.gz: a53f0c3971b91c537eb2df04cc6bd007936aedb42369ea39eab11c3257f8ecdd64be4e7ccb4b16dc20c0aa3b119e7fefbcaf7d32c4553e380192b4374093f4d2
7
- data.tar.gz: dc0110f641efaf867351a92ca8377b1af250faedf4bf4923560df235cb05b5424eb3837849f04485eeb0175341bce4b6e44c0b298f6010d0febbc652a057938f
6
+ metadata.gz: e829d3786073cc52aeff34a888d320734f147bdacc5c83a8f664b34e5b6db15dbb1235dd35530667f0f0f39e754720c7038e52310b20d13195c31d79ce35a311
7
+ data.tar.gz: ce151f41d016ac992461ca7dcdc2e926e4270c10ba58140b0cea06428c7c8bce27216eb45b308efe8cecb7356b0584a802848f204370126cd97274f9a8aeb5e9
data/.gitignore CHANGED
@@ -14,9 +14,6 @@ ruby-gemset
14
14
  .rvmrc
15
15
  Gemfile.lock
16
16
 
17
- # This file is generated automatically by: rake scholarsphere:generate_secret
18
- config/initializers/secret_token.rb
19
-
20
17
  ## MAC OS
21
18
  .DS_Store
22
19
 
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ gemspec
5
5
 
6
6
  # Required for doing pagination inside an engine. See https://github.com/amatsuda/kaminari/pull/322
7
7
  gem 'kaminari', github: 'harai/kaminari', branch: 'route_prefix_prototype'
8
+ gem 'sufia-models', path: './sufia-models'
8
9
 
9
10
  group :development, :test do
10
11
  gem 'activerecord-import', '0.3.0'
@@ -0,0 +1,3 @@
1
+ Update /SUFIA_VERSION
2
+
3
+ rake all:release
data/SUFIA_VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.0.0
@@ -38,7 +38,7 @@ limitations under the License.
38
38
 
39
39
  //= require batch_edit
40
40
  //= require terms_of_service
41
- //= require fileupload
41
+ //= require sufia/fileupload
42
42
  //= require sufia/permissions
43
43
  //= require sufia/trophy
44
44
  //= require sufia/batch_select_all
@@ -123,31 +123,29 @@ $(function() {
123
123
  /*
124
124
  * facets lists
125
125
  */
126
- $("li.expandable").click(function(){
127
- $(this).next("ul").slideToggle();
128
-
129
- $(this).find('i').toggleClass("icon-chevron-down");
130
- });
131
-
132
- $("li.expandable_new").click(function(){
133
- $(this).find('i').toggleClass("icon-chevron-down");
134
- });
126
+ $("li.expandable").click(function(){
127
+ $(this).next("ul").slideToggle();
128
+ $(this).find('i').toggleClass("icon-chevron-down");
129
+ });
135
130
 
136
- $(".sorts-dash").click(function(){
137
- var itag =$(this).find('i');
138
- toggle_icon(itag);
139
- sort = itag.attr('class') == "icon-caret-down" ? itag.attr('id')+' desc': itag.attr('id') +' asc';
140
- $('#sort').val(sort).selected = true;
141
- $(".icon-refresh").parent().click();
142
- });
143
- $(".sorts").click(function(){
144
- var itag =$(this).find('i');
145
- toggle_icon(itag);
146
- sort = itag.attr('class') == "icon-caret-down" ? itag.attr('id')+' desc': itag.attr('id');
147
- $('input[name="sort"]').attr('value', sort);
148
- $(".icon-search").parent().click();
149
- });
131
+ $("li.expandable_new").click(function(){
132
+ $(this).find('i').toggleClass("icon-chevron-down");
133
+ });
150
134
 
135
+ $(".sorts-dash").click(function(){
136
+ var itag =$(this).find('i');
137
+ toggle_icon(itag);
138
+ sort = itag.attr('class') == "icon-caret-down" ? itag.attr('id')+' desc': itag.attr('id') +' asc';
139
+ $('#sort').val(sort).selected = true;
140
+ $(".icon-refresh").parent().click();
141
+ });
142
+ $(".sorts").click(function(){
143
+ var itag =$(this).find('i');
144
+ toggle_icon(itag);
145
+ sort = itag.attr('class') == "icon-caret-down" ? itag.attr('id')+' desc': itag.attr('id');
146
+ $('input[name="sort"]').attr('value', sort);
147
+ $(".icon-search").parent().click();
148
+ });
151
149
  }); //closing function at the top of the page
152
150
 
153
151
 
@@ -4,9 +4,11 @@
4
4
  otherPage = typeof otherPage !== 'undefined' ? otherPage : !window.batch_part_on_other_page;
5
5
  var n = $(".batch_document_selector:checked").length;
6
6
  if ((n>0) || (forceOn)) {
7
+ $('.batch-toggle').show();
7
8
  $('.batch-select-all').show();
8
9
  $('#batch-edit').show();
9
10
  } else if ( otherPage){
11
+ $('.batch-toggle').hide();
10
12
  $('.batch-select-all').hide();
11
13
  $('#batch-edit').hide();
12
14
  }
@@ -0,0 +1,6 @@
1
+ //= require sufia/uploader
2
+ // This file is the default initialization of the fileupload. If you want to call
3
+ // sufiaUploader with other options (like afterSubmit), then override this file.
4
+ $(function() {
5
+ $('#fileupload').sufiaUploader();
6
+ });
@@ -0,0 +1,165 @@
1
+ //= require fileupload/tmpl
2
+ //= require fileupload/jquery.iframe-transport
3
+ //= require fileupload/jquery.fileupload.js
4
+ //= require fileupload/jquery.fileupload-ui.js
5
+ //= require fileupload/locale.js
6
+ //
7
+ /*jslint nomen: true */
8
+ /*global $ */
9
+
10
+
11
+ //200 MB max file size
12
+ var max_file_size = 200000000;
13
+ var max_file_size_str = "200 MB";
14
+ //500 MB max total upload size
15
+ var max_total_file_size = 500000000;
16
+ var max_file_count = 100;
17
+ var max_total_file_size_str = "500 MB";
18
+ var first_file_after_max = '';
19
+ var filestoupload =0;
20
+
21
+ (function( $ ){
22
+ 'use strict';
23
+
24
+ $.fn.sufiaUploader = function( options ) {
25
+
26
+ // Create some defaults, extending them with any options that were provided
27
+ // option afterSubmit: function(form, event, data)
28
+ var settings = $.extend( { }, options);
29
+ var files_done =0;
30
+ var error_string ='';
31
+
32
+ function uploadStopped() {
33
+ if (files_done == filestoupload && (files_done >0)){
34
+ var loc = $("#redirect-loc").html()
35
+ $(location).attr('href',loc);
36
+ } else if (error_string.length > 0){
37
+ // an error occured
38
+ if (files_done == 0) {
39
+ $("#fail").fadeIn('slow')
40
+ } else {
41
+ $("#partial_fail").fadeIn('slow')
42
+ }
43
+ $("#errmsg").html(error_string);
44
+ $("#errmsg").fadeIn('slow');
45
+ }
46
+ }
47
+
48
+ function uploadAdd(e, data) {
49
+ filestoupload++;
50
+ if ( $('#terms_of_service').is(':checked') )
51
+ $('#main_upload_start').attr('disabled', false);
52
+ }
53
+
54
+ function uploadAdded(e, data) {
55
+ if (data.files[0].error == 'acceptFileTypes'){
56
+ $($('#fileupload .files .cancel button')[data.context[0].rowIndex]).click();
57
+ }
58
+ var total_sz = parseInt($('#total_upload_size').val()) + data.files[0].size;
59
+ // is file size too big
60
+ if (data.files[0].size > max_file_size) {
61
+ $($('#fileupload .files .cancel button')[data.context[0].rowIndex]).click();
62
+ $("#errmsg").html(data.files[0].name + " is too big. No files over " + max_file_size_str + " can be uploaded.");
63
+ $("#errmsg").fadeIn('slow');
64
+ }
65
+ // cumulative upload file size is too big
66
+ else if( total_sz > max_total_file_size) {
67
+ if (first_file_after_max == '') first_file_after_max = data.files[0].name;
68
+ $($('#fileupload .files .cancel button')[data.context[0].rowIndex]).click();
69
+ $("#errmsg").html("All files selected from " + first_file_after_max + " and after will not be uploaded because your total upload is too big. You may not upload more than " + max_total_file_size_str + " in one upload.");
70
+ $("#errmsg").fadeIn('slow');
71
+ }
72
+ else if( filestoupload > max_file_count) {
73
+ if (first_file_after_max == '') first_file_after_max = data.files[0].name;
74
+ $($('#fileupload .files .cancel button')[data.context[0].rowIndex]).click();
75
+ $("#errmsg").html("All files selected from " + first_file_after_max + " and after will not be uploaded because your total number of files is too big. You may not upload more than " + max_file_count + " files in one upload.");
76
+ $("#errmsg").fadeIn('slow');
77
+ }
78
+ else {
79
+ $('#total_upload_size').val( parseInt($('#total_upload_size').val()) + data.files[0].size );
80
+ }
81
+ }
82
+
83
+
84
+ function uploadDone(e, data) {
85
+ var file = ($.isArray(data.result) && data.result[0]) || {error: 'emptyResult'};
86
+ if (!file.error) {
87
+ files_done++;
88
+ } else {
89
+ if (error_string.length > 0) {
90
+ error_string += '<br/>';
91
+ }
92
+ error_string += file.error;
93
+ }
94
+ }
95
+
96
+ // Takes the contextual values in the file you're uploading
97
+ // and assign them to a value in the form that is being uploaded:
98
+ // based off of https://github.com/blueimp/jQuery-File-Upload/wiki/How-to-submit-additional-Form-Data
99
+ function uploadSubmit(e, data) {
100
+ $('#relative_path').val(data.files[0].webkitRelativePath)
101
+ if (settings.afterSubmit) {
102
+ settings.afterSubmit(this, e, data)
103
+ }
104
+ }
105
+
106
+ function uploadFail(e, data) {
107
+ if (data.errorThrown == 'abort') {
108
+ filestoupload--;
109
+ if ((files_done == filestoupload)&&(files_done >0)){
110
+ var loc = $("#redirect-loc").html()+"?file_count="+filestoupload
111
+ $(location).attr('href',loc);
112
+ }
113
+ $('#total_upload_size').val( parseInt($('#total_upload_size').val()) - data.files[0].size );
114
+
115
+ } else {
116
+ if (error_string.length > 0) {
117
+ error_string += '<br/>';
118
+ }
119
+ error_string += data.errorThrown + ": " + data.textStatus;
120
+ }
121
+ }
122
+
123
+ var $container = this;
124
+ return this.each(function() {
125
+ // Initialize the jQuery File Upload widget:
126
+ $(this).fileupload();
127
+
128
+ // Enable iframe cross-domain access via redirect option:
129
+ $('#fileupload').fileupload(
130
+ 'option',
131
+ 'redirect',
132
+ window.location.href.replace(
133
+ /\/[^\/]*$/,
134
+ '/cors/result.html?%s'
135
+ )
136
+ );
137
+
138
+ $('#fileupload').fileupload(
139
+ 'option',
140
+ 'acceptFileTypes',
141
+ /^[^\.].*$/i
142
+ );
143
+
144
+ $('#fileupload').bind("fileuploadstop", uploadStopped);
145
+
146
+ // count the number of uploaded files to send to edit
147
+ $('#fileupload').bind("fileuploadadd", uploadAdd);
148
+
149
+
150
+ // check the validation on if the file type is not accepted just click cancel for the user as we do not want them to see all the hidden files
151
+ $('#fileupload').bind("fileuploadadded", uploadAdded);
152
+
153
+ // count the number of files completed and ready to send to edit
154
+ $('#fileupload').bind("fileuploaddone", uploadDone);
155
+
156
+ $('#fileupload').bind('fileuploadsubmit', uploadSubmit);
157
+
158
+
159
+ // on fail if abort (aka cancel) decrease the number of uploaded files to send
160
+ $('#fileupload').bind("fileuploadfail", uploadFail);
161
+
162
+ });
163
+
164
+ };
165
+ })( jQuery );
@@ -1,35 +1,41 @@
1
1
  jQuery.fn.exists = function(){return this.length>0;}
2
2
 
3
3
  $(function () {
4
- if (!$('#terms_of_service').exists()) {
5
- // deactivate if there is no checkbox, which allows installations to skip the agreement.
6
- return;
7
- }
8
-
9
- $('#main_upload_start').attr('disabled', true);
10
- $("#upload_tooltip").hide();
11
- $("#main_upload_start_span").mousemove(function(e){
12
- if ( !$('#terms_of_service').is(':checked') ){
13
- $('#main_upload_start').attr('disabled', true);
14
- $("#upload_tooltip").show();
15
- $("#upload_tooltip").css({
16
- top: (e.clientY+5)+ "px",
17
- left: (e.clientX+5) + "px"
18
- });
19
- } else {
20
- if (filestoupload > 0) $('#main_upload_start').attr('disabled', false);
21
- $("#upload_tooltip").hide();
22
- }
23
- });
24
- $("#main_upload_start_span").mouseout(function(e){
25
- $("#upload_tooltip").hide();
26
- });
27
- $("#main_upload_start_span").mouseleave(function(e){
28
- $("#upload_tooltip").hide();
4
+ // all activate-submit buttons are disabled by default
5
+ $('.activate-submit').each(function() {
6
+ $(this).prop('disabled', true);
7
+ });
8
+ // set up tooltip
9
+ $('.activate-container').tooltip({
10
+ 'placement': 'bottom',
11
+ 'delay': {show: 500, hide: 100}
29
12
  });
30
- $('#terms_of_service').click(function () {
31
- $('#main_upload_start').attr('disabled', !((this.checked) && (filestoupload > 0)));
32
- $("#upload_tooltip").hide();
33
- });
34
- });
35
13
 
14
+ // when data-activate checkbox is clicked, change the
15
+ // disable state of all activate-submit buttons
16
+ $('input[data-activate]').on("click", function () {
17
+ // get the checked state of the checkbox clicked and
18
+ // set all other tos checkboxes to same state
19
+ var bool = $(this).is(":checked");
20
+ // if box is checked - enable submit, otherwise disable
21
+ var disable = (bool) ? false : true;
22
+ $('input[data-activate]').attr('checked', bool);
23
+ $('.activate-submit').attr('disabled', disable);
24
+ })
25
+
26
+ // show/hide the tooltip depending if the agreement is already checked
27
+ $('.activate-container').mousemove(function(e){
28
+ if ($('input[data-activate]').is(':checked')) {
29
+ $('.activate-container').tooltip('hide')
30
+ }
31
+ else {
32
+ $('.activate-container').tooltip('show')
33
+ }
34
+ });
35
+ $('.activate-container').mouseout(function(e){
36
+ $('.activate-container').tooltip('hide')
37
+ });
38
+ $('.activate-container').mouseleave(function(e){
39
+ $('.activate-container').tooltip('hide')
40
+ });
41
+ });
@@ -1,7 +1,7 @@
1
1
  /* ...
2
2
  *= require_self
3
3
  *= require bootstrap.min
4
- *= require scholarsphere-bootstrap
4
+ *= require application-bootstrap
5
5
  *= require trophy
6
6
  *= require blacklight_more_facets
7
7
  *= require batch_edit
@@ -16,6 +16,7 @@ class BatchController < ApplicationController
16
16
  include Hydra::Controller::ControllerBehavior
17
17
  include Hydra::Controller::UploadBehavior
18
18
  include Sufia::Noid # for normalize_identifier method
19
+ layout "sufia-one-column"
19
20
 
20
21
  before_filter :has_access?
21
22
  prepend_before_filter :normalize_identifier, :only=>[:edit, :show, :update, :destroy]
@@ -2,6 +2,7 @@ module Sufia::UsersControllerBehavior
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
+ layout "sufia-one-column"
5
6
  prepend_before_filter :find_user, :except => [:index, :search, :notifications_number]
6
7
  before_filter :authenticate_user!, only: [:edit, :update, :follow, :unfollow, :toggle_trophy]
7
8
  before_filter :user_is_current_user, only: [:edit, :update, :toggle_trophy]
@@ -63,7 +64,7 @@ module Sufia::UsersControllerBehavior
63
64
 
64
65
  def toggle_trophy
65
66
  id = params[:file_id]
66
- id = "#{Sufia::Engine.config.id_namespace}:#{id}" unless id.include?(":")
67
+ id = "#{Sufia.config.id_namespace}:#{id}" unless id.include?(":")
67
68
  unless current_user.can? :edit, id
68
69
  redirect_to root_path, alert: "You do not have permissions to the file"
69
70
  return false
@@ -53,6 +53,10 @@ module GenericFileHelper
53
53
  def render_batch_edit_field_partial(key, locals)
54
54
  render_edit_field_partial_with_action('batch_edit', key, locals)
55
55
  end
56
+
57
+ def render_show_field_partial(key, locals)
58
+ render_show_field_partial_with_action('generic_files', key, locals)
59
+ end
56
60
 
57
61
  private
58
62
 
@@ -67,6 +71,19 @@ module GenericFileHelper
67
71
  end
68
72
  end
69
73
  end
74
+
75
+ def render_show_field_partial_with_action(action, key, locals)
76
+ ["#{action}/show_fields/#{key}", "#{action}/show_fields/default"].each do |str|
77
+ # XXX rather than handling this logic through exceptions, maybe there's a Rails internals method
78
+ # for determining if a partial template exists..
79
+ begin
80
+ return render :partial => str, :locals=>locals.merge({key: key})
81
+ rescue ActionView::MissingTemplate
82
+ nil
83
+ end
84
+ end
85
+ end
86
+
70
87
 
71
88
  def more_or_less_button(key, html_class, symbol)
72
89
  # TODO, there could be more than one element with this id on the page, but the fuctionality doesn't work without it.
File without changes
File without changes
File without changes