sufia 6.0.0.beta1 → 6.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +12 -2
  3. data/Gemfile +10 -1
  4. data/History.md +21 -0
  5. data/SUFIA_VERSION +1 -1
  6. data/app/assets/images/orcid.png +0 -0
  7. data/app/assets/javascripts/sufia.js +1 -1
  8. data/app/assets/javascripts/sufia/batch_edit.js +36 -54
  9. data/app/assets/javascripts/sufia/edit_metadata.js +10 -11
  10. data/app/assets/javascripts/sufia/permissions.js +2 -26
  11. data/app/assets/stylesheets/sufia.css.scss +10 -2
  12. data/app/assets/stylesheets/sufia/_batch-edit.scss +8 -6
  13. data/app/assets/stylesheets/sufia/_dashboard.scss +10 -0
  14. data/app/assets/stylesheets/sufia/_settings.scss +1 -0
  15. data/app/assets/stylesheets/sufia/_styles.scss +5 -3
  16. data/app/controllers/batch_controller.rb +9 -6
  17. data/app/controllers/batch_edits_controller.rb +2 -2
  18. data/app/controllers/collections_controller.rb +19 -3
  19. data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +30 -29
  20. data/app/controllers/concerns/sufia/breadcrumbs.rb +8 -3
  21. data/app/controllers/concerns/sufia/files_controller_behavior.rb +19 -7
  22. data/app/controllers/concerns/sufia/users_controller_behavior.rb +14 -2
  23. data/app/controllers/single_use_links_viewer_controller.rb +5 -1
  24. data/app/forms/sufia/forms/batch_edit_form.rb +6 -0
  25. data/app/forms/sufia/forms/collection_edit_form.rb +17 -0
  26. data/app/forms/sufia/forms/generic_file_edit_form.rb +16 -0
  27. data/app/helpers/generic_file_helper.rb +3 -47
  28. data/app/helpers/sufia/permissions_helper.rb +29 -0
  29. data/app/helpers/sufia/sufia_helper_behavior.rb +11 -0
  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 +32 -0
  34. data/app/models/concerns/sufia/solr_document_behavior.rb +1 -1
  35. data/app/presenters/sufia/collection_presenter.rb +29 -0
  36. data/app/presenters/sufia/generic_file_presenter.rb +14 -0
  37. data/app/presenters/sufia/presenter_renderer.rb +53 -0
  38. data/app/views/batch/_metadata.html.erb +10 -44
  39. data/app/views/batch/_more_metadata.html.erb +3 -2
  40. data/app/views/batch/edit.html.erb +2 -2
  41. data/app/views/batch_edits/edit.html.erb +13 -17
  42. data/app/views/collections/_form.html.erb +5 -5
  43. data/app/views/collections/_show_descriptions.html.erb +8 -10
  44. data/app/views/collections/edit.html.erb +8 -9
  45. data/app/views/collections/edit_fields/_description.html.erb +1 -2
  46. data/app/views/dashboard/_index_partials/_stats.html.erb +3 -3
  47. data/app/views/generic_files/_descriptions.html.erb +5 -8
  48. data/app/views/generic_files/_permission_form.html.erb +8 -17
  49. data/app/views/generic_files/_show_descriptions.html.erb +3 -4
  50. data/app/views/generic_files/edit.html.erb +1 -2
  51. data/app/views/generic_files/jq_upload.json.jbuilder +8 -0
  52. data/app/views/records/edit_fields/_default.html.erb +5 -10
  53. data/app/views/records/edit_fields/_description.html.erb +5 -10
  54. data/app/views/records/edit_fields/_resource_type.html.erb +2 -5
  55. data/app/views/records/edit_fields/_rights.html.erb +3 -9
  56. data/app/views/single_use_links_viewer/show.html.erb +10 -16
  57. data/app/views/users/_profile.html.erb +1 -2
  58. data/app/views/users/_user_info.html.erb +20 -3
  59. data/app/views/users/edit.html.erb +11 -2
  60. data/app/views/users/show.html.erb +1 -1
  61. data/config/locales/sufia.en.yml +46 -26
  62. data/config/routes.rb +1 -1
  63. data/lib/generators/sufia/install_generator.rb +4 -0
  64. data/lib/sufia.rb +4 -0
  65. data/lib/sufia/form_builder.rb +16 -0
  66. data/lib/sufia/version.rb +1 -1
  67. data/spec/actors/generic_file/actor_spec.rb +1 -2
  68. data/spec/controllers/batch_controller_spec.rb +16 -48
  69. data/spec/controllers/batch_edits_controller_spec.rb +27 -16
  70. data/spec/controllers/collections_controller_spec.rb +81 -61
  71. data/spec/controllers/generic_files_controller_spec.rb +17 -2
  72. data/spec/controllers/users_controller_spec.rb +13 -3
  73. data/spec/features/collection_spec.rb +93 -88
  74. data/spec/features/users_spec.rb +1 -1
  75. data/spec/forms/collection_edit_form_spec.rb +20 -0
  76. data/spec/forms/generic_file_edit_form_spec.rb +26 -0
  77. data/spec/helpers/generic_file_helper_spec.rb +33 -7
  78. data/spec/helpers/permissions_helper_spec.rb +21 -0
  79. data/spec/inputs/multi_value_with_help_input_spec.rb +25 -0
  80. data/spec/inputs/select_with_modal_help_input_spec.rb +21 -0
  81. data/spec/jobs/batch_update_job_spec.rb +11 -14
  82. data/spec/lib/sufia/breadcrumbs_spec.rb +46 -8
  83. data/spec/models/generic_file_spec.rb +0 -13
  84. data/spec/models/user_spec.rb +23 -0
  85. data/spec/presenters/presenter_renderer_spec.rb +19 -0
  86. data/spec/presenters/sufia/generic_file_presenter_spec.rb +12 -0
  87. data/spec/spec_helper.rb +5 -0
  88. data/spec/support/input_support.rb +12 -0
  89. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  90. data/spec/views/batch/edit.html.erb_spec.rb +13 -23
  91. data/spec/views/batch_edits/edit.html.erb_spec.rb +19 -0
  92. data/spec/views/collections/_form.html.erb_spec.rb +26 -28
  93. data/spec/views/collections/_show_descriptions.html.erb_spec.rb +15 -9
  94. data/spec/views/dashboard/index_spec.rb +2 -2
  95. data/spec/views/generic_file/_permission_form.html.erb_spec.rb +23 -0
  96. data/spec/views/generic_file/edit.html.erb_spec.rb +5 -0
  97. data/spec/views/generic_file/show.html.erb_spec.rb +5 -0
  98. data/sufia-models/app/actors/sufia/generic_file/actor.rb +1 -1
  99. data/sufia-models/app/jobs/batch_update_job.rb +5 -5
  100. data/sufia-models/app/models/batch.rb +7 -3
  101. data/sufia-models/app/models/concerns/sufia/collection.rb +7 -25
  102. data/sufia-models/app/models/concerns/sufia/generic_file.rb +0 -1
  103. data/sufia-models/app/models/concerns/sufia/generic_file/export.rb +2 -2
  104. data/sufia-models/app/models/concerns/sufia/generic_file/indexing.rb +4 -13
  105. data/sufia-models/app/models/concerns/sufia/generic_file/metadata.rb +1 -1
  106. data/sufia-models/app/models/concerns/sufia/user.rb +24 -17
  107. data/sufia-models/app/models/sufia/orcid_validator.rb +8 -0
  108. data/sufia-models/app/services/sufia/generic_file_indexing_service.rb +13 -0
  109. data/sufia-models/app/services/sufia/indexing_service.rb +15 -0
  110. data/sufia-models/lib/generators/sufia/models/abstract_migration_generator.rb +30 -0
  111. data/sufia-models/lib/generators/sufia/models/cached_stats_generator.rb +3 -47
  112. data/sufia-models/lib/generators/sufia/models/install_generator.rb +11 -31
  113. data/sufia-models/lib/generators/sufia/models/orcid_field_generator.rb +19 -0
  114. data/sufia-models/lib/generators/sufia/models/proxies_generator.rb +2 -31
  115. data/sufia-models/lib/generators/sufia/models/templates/config/redis.yml +3 -0
  116. data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +3 -0
  117. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_orcid_to_users.rb +5 -0
  118. data/sufia-models/lib/generators/sufia/models/upgrade400_generator.rb +2 -33
  119. data/sufia-models/lib/generators/sufia/models/user_stats_generator.rb +31 -0
  120. data/sufia-models/lib/sufia/models/engine.rb +1 -0
  121. data/sufia-models/lib/sufia/models/version.rb +1 -1
  122. data/sufia-models/sufia-models.gemspec +5 -5
  123. data/sufia.gemspec +2 -3
  124. metadata +49 -39
  125. data/app/assets/javascripts/sufia/multiForm.js +0 -67
  126. data/app/helpers/records_helper.rb +0 -4
  127. data/app/helpers/sufia/records_helper_behavior.rb +0 -68
  128. data/app/views/batch_edits/update_edit.js.erb +0 -5
  129. data/app/views/collections/_edit_descriptions.html.erb +0 -18
  130. data/app/views/collections/edit_fields/_title.html.erb +0 -3
  131. data/app/views/generic_files/_field_form.html.erb +0 -20
  132. data/app/views/records/_edit_field.html.erb +0 -22
  133. data/app/views/records/edit_fields/_suffix.html.erb +0 -10
  134. data/app/views/records/edit_fields/_type.html.erb +0 -8
  135. data/app/views/users/_social_media_info.html.erb +0 -20
  136. data/spec/helpers/records_helper_spec.rb +0 -102
  137. data/spec/models/generic_file/web_form_spec.rb +0 -35
  138. data/sufia-models/app/models/concerns/sufia/generic_file/accessible_attributes.rb +0 -87
  139. data/sufia-models/app/models/concerns/sufia/generic_file/web_form.rb +0 -62
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66f52aa19e4ce45f68360e5c2dbc9bf9fd16a99b
4
- data.tar.gz: 0e7ec679161844f502e8fd27db596005b0352d36
3
+ metadata.gz: 23a8aa646f0192a0e3637c499d513f8ee363f128
4
+ data.tar.gz: 7d98159bb2f6b95131dc290c271a53e62e18a043
5
5
  SHA512:
6
- metadata.gz: 59957e8d5ebeeec6fc649ad82b802bd03e97e04d7d2a8607ceeff6e2cc46eb6560fa42c437cc55518b8903c9114155839c0589b404018b1a84f1d21baf71fe66
7
- data.tar.gz: 5009ca0eb029bd3b2caa86fae5b339e5b6a1b4af4b609d42e532595dd42b223010c2927afb5d08517cc78e1cb693ea9029a1af0f3754710c1b49cf6d5c90ff37
6
+ metadata.gz: 329dd1e4e2580887878b25c14f8dc7553de38dd570da8ff66e37739e853a8d074524e4de8c31afda32e0140591633a256ecd3f173e1da4ff6c8c91dc0252bdd0
7
+ data.tar.gz: eea2cc4345bbd3c245d6c638cf8442151cc89e68d88de0957cadabf4444248dbcdcac17c7caab02fafa3b583cb8bab1c11c0b676a37efaa2c61edfe52bba876a
data/.travis.yml CHANGED
@@ -1,10 +1,20 @@
1
1
  language: ruby
2
+ cache: bundler
3
+ sudo: false
2
4
  rvm:
3
5
  - 2.1
4
- - 2.0
5
6
  env:
6
7
  global:
7
- - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
8
+ - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
9
+
10
+ matrix:
11
+ - "RAILS_VERSION=4.1.8"
12
+ - "RAILS_VERSION=4.2.0"
13
+
14
+ matrix:
15
+ allow_failures:
16
+ - env: "RAILS_VERSION=4.2.0"
17
+
8
18
  notifications:
9
19
  email:
10
20
  recipients:
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ gemspec
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
8
  gem 'sufia-models', path: './sufia-models'
9
- gem 'sass-rails', '~> 4.0.3'
9
+ gem 'slop', '~> 3.6.0' # This just helps us generate a valid Gemfile.lock when Rails 4.2 is installed (which requires byebug which has a dependency on slop)
10
10
 
11
11
  group :development, :test do
12
12
  gem "simplecov", require: false
@@ -17,4 +17,13 @@ file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_
17
17
  if File.exists?(file)
18
18
  puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
19
19
  instance_eval File.read(file)
20
+ else
21
+ gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
22
+
23
+ if ENV['RAILS_VERSION'] and ENV['RAILS_VERSION'] =~ /^4.2/
24
+ gem 'responders', "~> 2.0"
25
+ gem 'sass-rails', ">= 5.0"
26
+ else
27
+ gem 'sass-rails', "< 5.0"
28
+ end
20
29
  end
data/History.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # History of Sufia releases
2
2
 
3
+ ## 4.3.1
4
+
5
+ * Adds an ORCID field to the user model. [Michael J. Giarlo]
6
+ * Styles count for views and downloads, refs #9672 [Michael Tribone]
7
+ * Merge pull request #787 from projecthydra/update_master_to_bl-5.8 [Justin Coyne]
8
+ * More facets modal defaults to numerical sort [Adam Wead]
9
+ * Upgrade to Blacklight 5.8 [Adam Wead]
10
+ * Adding select2 name look up to permissions form for GenericFile and Batch. [Carolyn Cole]
11
+ * Adding blacklight gallery default views to catalog controller to match with the new installer.
12
+ * Display file stats for user. Feature #9305 [Valerie Maher]
13
+ * Making sure the modal is actually sorted numerically and allow some files to be on the second p
14
+ * Fixing a bug that the home page crashes when a featured work has been destroyed [Carolyn Cole]
15
+ * Fixes button size and alignment issues with metadata and upload forms, refs #9569 [Michael Tribone]
16
+ * Updated dev notes [Valerie Maher]
17
+ * Disable check all instead of making it disappear. User testing indicated this was confusing [Carolyn Cole]
18
+ * Views should not use the invalid Agent schema.org class [Michael J. Giarlo]
19
+ * README should not implicitly suggest an outdated version of Sufia. (Inspired by #719 -- thx, @mistydemeo!) [Michael J. Giarlo]
20
+
21
+ ## 4.3.0 - YANKED
22
+
3
23
  ## 4.2.0
4
24
 
5
25
  * Caches google analytics data in the database so we do not have to retrieve them each time the page is loaded [Carolyn Cole]
@@ -172,6 +192,7 @@ This release contains bug fixes and css fixes found after the Sufia 4.0 release.
172
192
  * changing to bootstrap 3 danger from important to get the red background for permissions, and fixing collection detail spacing when there is no description [Carolyn Cole]
173
193
  * Upgrade to rspec 3. Fixes #493 [Carolyn Cole]
174
194
  * Removed extraneous colons preceding key names. Fixes #516 [kerchner]
195
+
175
196
  ## 4.0.0.rc1
176
197
 
177
198
  * Use the bootstrap_form helpers (bootstrap_forms is no longer available) [Justin Coyne]
data/SUFIA_VERSION CHANGED
@@ -1 +1 @@
1
- 6.0.0.beta1
1
+ 6.0.0.rc1
Binary file
@@ -35,7 +35,6 @@
35
35
  //= require sufia/trophy
36
36
  //= require sufia/featured_works
37
37
  //= require sufia/batch_select_all
38
- //= require sufia/multiForm
39
38
  //= require sufia/edit_metadata
40
39
  //= require sufia/single_use_link
41
40
  //= require sufia/audio
@@ -51,6 +50,7 @@
51
50
  //= require sufia/batch
52
51
 
53
52
  //= require hydra_collections
53
+ //= require hydra-editor/hydra-editor
54
54
 
55
55
  //
56
56
  // For Browse-everything until https://github.com/projecthydra-labs/browse-everything/issues/85 is resolved:
@@ -3,17 +3,6 @@ function batch_edit_init () {
3
3
  // initialize popover helpers
4
4
  $("a[rel=popover]").popover({ html: true });
5
5
 
6
- $("tr.expandable").click(function () {
7
- $(this).next("ul").slideToggle();
8
-
9
- $(this).find('i.toggle').toggleClass("glyphicon glyphicon-chevron-down");
10
- });
11
-
12
- $("tr.expandable_new").click(function () {
13
- $(this).find('i').toggleClass("glyphicon glyphicon-chevron-down");
14
- });
15
-
16
-
17
6
  function deserialize(Params) {
18
7
  var Data = Params.split("&");
19
8
  var i = Data.length;
@@ -116,32 +105,45 @@ function batch_edit_init () {
116
105
 
117
106
  ajaxManager.run();
118
107
 
119
- function after_ajax(form_id) {
120
- var key = form_id.replace("form_", "");
121
- var save_button = "#" + key + "_save";
122
- var outer_div = "#detail_" + key;
123
- $("#status_" + key).html("Changes Saved");
124
- $(save_button).removeAttr("disabled");
125
- $(outer_div).removeClass("loading");
126
- $('#' + form_id).children([".form-group"]).removeClass('hidden')
108
+
109
+ function after_ajax(form) {
110
+ form.enableForm();
127
111
  }
128
112
 
129
- function before_ajax(form_id) {
130
- var key = form_id.replace("form_", "");
131
- var save_button = "#" + key + "_save";
132
- var outer_div = "#detail_" + key;
133
- $(save_button).attr("disabled", "disabled");
134
- $(outer_div).addClass("loading");
135
- $('#' + form_id).children([".form-group"]).addClass('hidden')
113
+ function before_ajax(form) {
114
+ form.disableForm();
136
115
  }
137
116
 
117
+ var BatchEditField = function (form) {
118
+ this.form = form;
119
+ this.formButtons = form.find('.btn');
120
+ this.formFields = form.find('.form-group > *');
121
+ this.formRightPanel = form.find('.form-group');
122
+ this.statusField = form.find('.status');
123
+ }
124
+
125
+ BatchEditField.prototype = {
126
+ disableForm: function () {
127
+ this.formButtons.attr("disabled", "disabled");
128
+ this.formRightPanel.addClass("loading");
129
+ this.formFields.addClass('invisible')
130
+ },
131
+
132
+ enableForm: function () {
133
+ this.statusField.html("Changes Saved");
134
+ this.formButtons.removeAttr("disabled");
135
+ this.formRightPanel.removeClass("loading");
136
+ this.formFields.removeClass('invisible')
137
+ }
138
+ }
138
139
 
139
140
  function runSave(e) {
140
141
  e.preventDefault();
141
142
  var button = $(this);
142
- var form = $(button.parent().parent()[0]);
143
- var form_id = form[0].id
144
- before_ajax(form_id);
143
+ var form = button.closest('form');
144
+ var f = new BatchEditField(form);
145
+ var form_id = form[0].id;
146
+ before_ajax(f);
145
147
 
146
148
  ajaxManager.addReq({
147
149
  form: form_id,
@@ -150,38 +152,18 @@ function batch_edit_init () {
150
152
  dataType: "json",
151
153
  type: form.attr("method").toUpperCase(),
152
154
  data: form.serialize(),
153
- complete: function (e) {
154
- after_ajax(form_id);
155
- if (e.status == 200) {
156
- eval(e.responseText);
157
- } else {
158
- alert("Error! Status: " + e.status);
159
- }
155
+ success: function (e) {
156
+ after_ajax(f);
157
+ },
158
+ fail: function (e) {
159
+ alert("Error! Status: " + e.status);
160
160
  }
161
161
  });
162
162
  setTimeout(ajaxManager.runNow(), 100);
163
163
  }
164
164
 
165
- function enable_show_hide_links() {
166
- // Show/hide field details when clicking on a link with ID "expand_link_XXX".
167
- // We expect to find an element named detail_XXX in addition to the expand_link_XXX.
168
- // The "detail_XXX" element has the chevron icon.
169
- $('.glyphicon-chevron-right-helper').on('click', function() {
170
- var array = this.id.split("expand_link_");
171
- if (array.length > 1) {
172
- var docId = array[1];
173
- $("#detail_" + docId + " .expanded-details").slideToggle();
174
- var button = $("#expand_" + docId);
175
- button.toggleClass('glyphicon-chevron-right glyphicon-chevron-down');
176
- }
177
- return false;
178
- });
179
- }
180
-
181
165
  $("#permissions_save").click(runSave);
182
166
  $(".field-save").click(runSave);
183
- enable_show_hide_links();
184
-
185
167
  }
186
168
 
187
169
 
@@ -51,13 +51,11 @@ Blacklight.onLoad(function() {
51
51
 
52
52
  autocomplete_vocab.url_var = ['subject', 'language']; // the url variable to pass to determine the vocab to attach to
53
53
  autocomplete_vocab.field_name = new Array(); // the form name to attach the event for autocomplete
54
- autocomplete_vocab.add_btn_id = new Array(); // the id of the button pressed when adding an additional form element
55
54
 
56
55
  // loop over the autocomplete fields and attach the
57
56
  // events for autocomplete and create other array values for autocomplete
58
57
  for (var i=0; i < autocomplete_vocab.url_var.length; i++) {
59
58
  autocomplete_vocab.field_name.push('generic_file_' + autocomplete_vocab.url_var[i]);
60
- autocomplete_vocab.add_btn_id.push('additional_' + autocomplete_vocab.url_var[i] + '_submit');
61
59
  // autocompletes
62
60
  $("#" + autocomplete_vocab.field_name[i])
63
61
  // don't navigate away from the field on tab when selecting an item
@@ -68,19 +66,20 @@ Blacklight.onLoad(function() {
68
66
  }
69
67
  })
70
68
  .autocomplete( get_autocomplete_opts(autocomplete_vocab.url_var[i]) );
71
-
72
69
  }
73
70
 
74
71
 
75
- function setup_autocomplete(obj, cloneElem) {
76
- // should we attach an auto complete based on the input
77
- if (obj.id == 'additional_based_near_submit') {
78
- cloneElem.find('input[type=text]').autocomplete(cities_autocomplete_opts);
79
- }
80
- else if ( (index = $.inArray(obj.id, autocomplete_vocab.add_btn_id)) != -1 ) {
81
- cloneElem.find('input[type=text]').autocomplete(get_autocomplete_opts(autocomplete_vocab.url_var[index]));
72
+ // attach an auto complete based on the field
73
+ function setup_autocomplete(e, cloneElem) {
74
+ var $cloneElem = $(cloneElem);
75
+ // FIXME this code (comparing the id) depends on a bug. Each input has an id and the id is
76
+ // duplicated when you press the plus button. This is not valid html.
77
+ if ($cloneElem.attr("id") == 'generic_file_based_near') {
78
+ $cloneElem.autocomplete(cities_autocomplete_opts);
79
+ } else if ( (index = $.inArray($cloneElem.attr("id"), autocomplete_vocab.field_name)) != -1 ) {
80
+ $cloneElem.autocomplete(get_autocomplete_opts(autocomplete_vocab.url_var[index]));
82
81
  }
83
82
  }
84
83
 
85
- $('form').multiForm({afterAdd: setup_autocomplete});
84
+ $('.multi_value.form-group').manage_fields({add: setup_autocomplete});
86
85
  });
@@ -9,33 +9,9 @@
9
9
  */
10
10
 
11
11
  Blacklight.onLoad(function() {
12
- // input for uids - attach function to verify uid
13
- $('#new_user_name_skel').on('blur', function() {
14
- // clear out any existing messages
15
- $('#directory_user_result').html('');
16
- var un = $('#new_user_name_skel').val();
17
- var perm = $('#new_user_permission_skel').val();
18
- if ( $.trim(un).length == 0 ) {
19
- return;
20
- }
21
- $.ajax( {
22
- url: "/directory/user/" + un,
23
- success: function( data ) {
24
- if (data != null) {
25
- if (!data.length) {
26
- $('#directory_user_result').html('User id ('+un+ ') does not exist.');
27
- $('#new_user_name_skel').select();
28
- $('#new_user_permission_skel').val('none');
29
- return;
30
- }
31
- else {
32
- $('#new_user_permission_skel').focus();
33
- }
34
- }
35
- }
36
- });
37
12
 
38
- });
13
+ // Attach the user search select2 box to the permission form
14
+ $("#new_user_name_skel").userSearch();
39
15
 
40
16
  // add button for new user
41
17
  $('#add_new_user_skel').on('click', function() {
@@ -15,8 +15,11 @@
15
15
 
16
16
  // Use import here instead of require so we can use the Sass variables defined in Bootstrap and Blacklight
17
17
  // TODO: Probably should use import throughout and move all of Sufia's stylesheets into a single named directory.
18
- @import 'sufia/settings','sufia/header','sufia/styles','sufia/file-listing','sufia/collections','sufia/batch-edit',
19
- 'sufia/dashboard','sufia/home-page','sufia/featured','sufia/tagcloud','sufia/usage-stats','sufia/catalog','sufia/buttons','sufia/proxy-rights';
18
+ @import 'sufia/settings', 'sufia/header', 'sufia/styles', 'sufia/file-listing',
19
+ 'sufia/collections', 'sufia/batch-edit', 'sufia/dashboard', 'sufia/home-page',
20
+ 'sufia/featured', 'sufia/tagcloud', 'sufia/usage-stats', 'sufia/catalog', 'sufia/buttons',
21
+ 'sufia/proxy-rights';
22
+ @import 'hydra-editor/multi_value_fields';
20
23
 
21
24
  #browse-everything {
22
25
  top:10%;
@@ -35,6 +38,11 @@
35
38
  padding-top: 10px;
36
39
  }
37
40
 
41
+ .profile img.orcid {
42
+ float: left;
43
+ margin-right: 2px;
44
+ }
45
+
38
46
  /* This class is to workaround an issue in which Bootstrap requires a div to display a tooltip
39
47
  * on a disabled button. Using a span instead of a div would be ideal but unfortunately it does
40
48
  * not render the tooltip correctly in all browsers (e.g. in Chrome the tooltip is detected in
@@ -5,12 +5,6 @@
5
5
  top: 5px;
6
6
  }
7
7
 
8
- .form-horizontal .batch-group {
9
- @extend .form-group;
10
- margin-left: 0px;
11
- margin-right: 0px;
12
- }
13
-
14
8
  #hide_addl_descriptions {
15
9
  margin-bottom: 10px;
16
10
  }
@@ -19,3 +13,11 @@
19
13
  padding-top: 5px;
20
14
  }
21
15
 
16
+ .glyphicon-chevron-right-helper.collapsed .chevron {
17
+ @extend .glyphicon-chevron-right;
18
+ }
19
+ .glyphicon-chevron-right-helper .chevron {
20
+ @extend .glyphicon;
21
+ @extend .glyphicon-chevron-down;
22
+ }
23
+
@@ -18,6 +18,16 @@
18
18
  background-color: $badge-background-color;
19
19
  color: $badge-font-color;
20
20
  }
21
+ .badge-optional {
22
+ background-color: $badge-optional-background-color;
23
+ border-radius: 2px;
24
+ color: $badge-font-color;
25
+ padding: 0 .25em;
26
+ }
27
+ .views-downloads-dashboard {
28
+ list-style-type: none;
29
+ padding-left: 0;
30
+ }
21
31
  .panel-default > .panel-heading {
22
32
  background-color: $panel-background-color;
23
33
  }
@@ -23,6 +23,7 @@ $teal: #2CAEB7;
23
23
  $vermilion: #F30;
24
24
 
25
25
  $badge-background-color: $highlight-yellow;
26
+ $badge-optional-background-color: $gray-medium;
26
27
  $badge-font-color: $classic-white;
27
28
  $content-wrapper-background-color: $cream-light;
28
29
  $dashboard-background-color: $classic-white;
@@ -75,9 +75,11 @@ button {
75
75
  min-height: 4em;
76
76
  }
77
77
 
78
- .required-field {
79
- color: red;
80
- font-size: small;
78
+ label.required, span.required {
79
+ abbr{
80
+ color: red;
81
+ font-size: small;
82
+ }
81
83
  }
82
84
 
83
85
  @media only screen and (min-width: 768px) {
@@ -6,11 +6,8 @@ class BatchController < ApplicationController
6
6
  prepend_before_filter :normalize_identifier, only: [:edit, :show, :update, :destroy]
7
7
 
8
8
  def edit
9
- @batch = Batch.find_or_create(params[:id])
10
- @generic_file = GenericFile.new
11
- @generic_file.creator = [current_user.name]
12
- @generic_file.title = @batch.generic_files.map(&:label)
13
- @generic_file.initialize_fields
9
+ @batch = Batch.find_or_create(params[:id])
10
+ @form = edit_form
14
11
  end
15
12
 
16
13
  def update
@@ -18,13 +15,19 @@ class BatchController < ApplicationController
18
15
  @batch = Batch.find_or_create(params[:id])
19
16
  @batch.status = ["processing"]
20
17
  @batch.save
21
- Sufia.queue.push(BatchUpdateJob.new(current_user.user_key, params))
18
+ file_attributes = Sufia::Forms::BatchEditForm.model_attributes(params[:generic_file])
19
+ Sufia.queue.push(BatchUpdateJob.new(current_user.user_key, params[:id], params[:title], file_attributes, params[:visibility]))
22
20
  flash[:notice] = 'Your files are being processed by ' + t('sufia.product_name') + ' in the background. The metadata and access controls you specified are being applied. Files will be marked <span class="label label-danger" title="Private">Private</span> until this process is complete (shouldn\'t take too long, hang in there!). You may need to refresh your dashboard to see these updates.'
23
21
  redirect_to sufia.dashboard_files_path
24
22
  end
25
23
 
26
24
  protected
27
25
 
26
+ def edit_form
27
+ generic_file = GenericFile.new(creator: [current_user.name], title: @batch.generic_files.map(&:label))
28
+ Sufia::Forms::BatchEditForm.new(generic_file)
29
+ end
30
+
28
31
  # override this method if you need to initialize more complex RDF assertions (b-nodes)
29
32
  def initialize_fields(file)
30
33
  file.initialize_fields