hyrax 2.1.0.rc1 → 2.1.0.rc2

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CONTRIBUTING.md +6 -6
  3. data/README.md +18 -8
  4. data/app/assets/javascripts/hyrax/app.js.erb +1 -1
  5. data/app/assets/javascripts/hyrax/collections.js +16 -13
  6. data/app/assets/javascripts/hyrax/monkey_patch_turbolinks.js.coffee +12 -0
  7. data/app/assets/stylesheets/hyrax/dashboard.scss +4 -0
  8. data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -7
  9. data/app/controllers/hyrax/my_controller.rb +1 -0
  10. data/app/helpers/hyrax/collections_helper.rb +9 -0
  11. data/app/models/sipity/workflow.rb +6 -7
  12. data/app/presenters/hyrax/work_show_presenter.rb +4 -1
  13. data/app/services/hyrax/adapters/nesting_index_adapter.rb +1 -0
  14. data/app/services/hyrax/collection_types/create_service.rb +2 -2
  15. data/app/services/hyrax/file_set_fixity_check_service.rb +1 -1
  16. data/app/views/hyrax/dashboard/collections/_form.html.erb +1 -1
  17. data/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb +11 -6
  18. data/app/views/hyrax/dashboard/collections/_modal_parent_collection_remove_deny.html.erb +14 -0
  19. data/app/views/hyrax/dashboard/collections/_show_add_items_actions.html.erb +1 -1
  20. data/app/views/hyrax/dashboard/collections/_show_parent_collection_row.html.erb +11 -1
  21. data/app/views/hyrax/dashboard/collections/show.html.erb +1 -0
  22. data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +1 -1
  23. data/app/views/hyrax/my/collections/index.html.erb +8 -2
  24. data/app/views/hyrax/my/works/_tabs.html.erb +1 -2
  25. data/app/views/hyrax/my/works/index.html.erb +11 -0
  26. data/config/locales/hyrax.de.yml +19 -8
  27. data/config/locales/hyrax.en.yml +14 -3
  28. data/config/locales/hyrax.es.yml +13 -2
  29. data/config/locales/hyrax.fr.yml +13 -2
  30. data/config/locales/hyrax.it.yml +13 -2
  31. data/config/locales/hyrax.pt-BR.yml +13 -2
  32. data/config/locales/hyrax.zh.yml +13 -2
  33. data/hyrax.gemspec +1 -1
  34. data/lib/generators/hyrax/templates/db/migrate/20170810190549_update_collection_type_column_options.rb.erb +9 -1
  35. data/lib/hyrax/version.rb +1 -1
  36. data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +2 -3
  37. data/spec/features/collection_multi_membership_spec.rb +32 -33
  38. data/spec/features/dashboard/all_works.rb +2 -1
  39. data/spec/features/dashboard/collection_spec.rb +35 -13
  40. data/spec/features/work_show_spec.rb +6 -6
  41. data/spec/helpers/hyrax/collections_helper_spec.rb +16 -0
  42. data/spec/models/sipity/workflow_spec.rb +9 -0
  43. data/spec/presenters/hyrax/work_show_presenter_spec.rb +2 -2
  44. data/spec/services/hyrax/adapters/nesting_index_adapter_spec.rb +7 -3
  45. data/spec/services/hyrax/collection_types/create_service_spec.rb +2 -2
  46. data/spec/services/hyrax/collections_service_spec.rb +1 -1
  47. data/spec/services/hyrax/file_set_fixity_check_service_spec.rb +13 -0
  48. data/spec/spec_helper.rb +1 -0
  49. data/spec/support/optional_example.rb +16 -0
  50. data/spec/support/selectors.rb +15 -1
  51. data/spec/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb_spec.rb +13 -21
  52. data/spec/views/hyrax/dashboard/collections/_show_add_items_actions.html.erb_spec.rb +5 -3
  53. data/spec/views/hyrax/dashboard/collections/_show_parent_collection_row.html.erb_spec.rb +35 -15
  54. data/spec/views/hyrax/my/collections/index.html.erb_spec.rb +34 -0
  55. data/spec/views/hyrax/my/works/index.html.erb_spec.rb +3 -0
  56. data/template.rb +1 -1
  57. metadata +15 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7758e362b3ead3c21f48bf9cf6763565ea0304fb
4
- data.tar.gz: 3788d88af39d4ab5b81a17bb94bf90d39e2852fa
3
+ metadata.gz: 2f567b87262e35a9cb150d7155519d89714b19b0
4
+ data.tar.gz: 1ba5abb5d18be1edaacdb1bceb77030e1dfa1c66
5
5
  SHA512:
6
- metadata.gz: 4c1e3c4e80619330f7e5dd1d624a38296618d2dc40e371485d70039e52068af1dbb9593cea59a5aac0a6951b392b82800426d530a13825523517637ce9cac7e7
7
- data.tar.gz: 02d3518cccfd2c631cda0e27b1dfa200bbbec739c184d211da2d9ec215f663d19f13623009bd5bc96fef967152244729acb9def82aa67d320543d44c12907636
6
+ metadata.gz: b72273e1c7ecb34223b97e5839232fcdcb5f26d036903bdb2e50f2ec45d437a52edcf88012fc88f2d6c0c14a4a7ac9bd46965b3cdeada506d6e553352f38418f
7
+ data.tar.gz: 389b8b29eee7704e80cf71cdceb6ed8f8e96c0bde66a312bb06f31a73cf3996f0e4afbeba6ae132b7f04132a15b036b6ba06e14385ec7c51ff90c8fab65572dd
@@ -6,16 +6,16 @@ keeping on top of things.
6
6
 
7
7
  ## Code of Conduct
8
8
 
9
- The Samvera Community is dedicated to providing a welcoming and positive
9
+ The Samvera Community is dedicated to providing a welcoming and positive
10
10
  experience for all its members, whether they are at a formal gathering, in
11
- a social setting, or taking part in activities online. Please see our
11
+ a social setting, or taking part in activities online. Please see our
12
12
  [Code of Conduct](CODE_OF_CONDUCT.md) for more information.
13
13
 
14
14
  ## Samvera Community Intellectual Property Licensing and Ownership
15
15
 
16
- All code contributors must have an Individual Contributor License Agreement
17
- (iCLA) on file with the Samvera Steering Group. If the contributor works for
18
- an institution, the institution must have a Corporate Contributor License
16
+ All code contributors must have an Individual Contributor License Agreement
17
+ (iCLA) on file with the Samvera Steering Group. If the contributor works for
18
+ an institution, the institution must have a Corporate Contributor License
19
19
  Agreement (cCLA) on file.
20
20
 
21
21
  https://wiki.duraspace.org/display/samvera/Samvera+Community+Intellectual+Property+Licensing+and+Ownership
@@ -64,7 +64,7 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
64
64
  * This work greatly increases the usability of the code base and supports the on-ramping of new committers.
65
65
  * We will all be understanding of one another's time constraints in this area.
66
66
  * YARD examples:
67
- * [Hydra::Works::RemoveGenericFile](https://github.com/projecthydra-labs/hydra-works/blob/master/lib/hydra/works/services/generic_work/remove_generic_file.rb)
67
+ * [Hyrax::AdminSet](https://github.com/samvera/hyrax/blob/master/app/models/admin_set.rb)
68
68
  * [ActiveTriples::LocalName::Minter](https://github.com/ActiveTriples/active_triples-local_name/blob/master/lib/active_triples/local_name/minter.rb)
69
69
  * [Getting started with YARD](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
70
70
 
data/README.md CHANGED
@@ -63,7 +63,7 @@ The Samvera community is here to help. Please see our [support guide](./.github/
63
63
  # Getting started
64
64
 
65
65
  This document contains instructions specific to setting up an app with __Hyrax
66
- v2.1.0.rc1__. If you are looking for instructions on installing a different
66
+ v2.1.0.rc2__. If you are looking for instructions on installing a different
67
67
  version, be sure to select the appropriate branch or tag from the drop-down
68
68
  menu above.
69
69
 
@@ -80,8 +80,8 @@ Prerequisites are required for both creating a Hyrax\-based app and contributing
80
80
 
81
81
  Hyrax requires the following software to work:
82
82
 
83
- 1. [Solr](http://lucene.apache.org/solr/) version >= 5.x (tested up to 6.4.1)
84
- 1. [Fedora Commons](http://www.fedora-commons.org/) digital repository version >= 4.5.1 (tested up to 4.7.1)
83
+ 1. [Solr](http://lucene.apache.org/solr/) version >= 5.x (tested up to 7.0.0)
84
+ 1. [Fedora Commons](http://www.fedora-commons.org/) digital repository version >= 4.5.1 (tested up to 4.7.5)
85
85
  1. A SQL RDBMS (MySQL, PostgreSQL), though **note** that SQLite will be used by default if you're looking to get up and running quickly
86
86
  1. [Redis](http://redis.io/), a key-value store
87
87
  1. [ImageMagick](http://www.imagemagick.org/) with JPEG-2000 support
@@ -132,7 +132,7 @@ Note here that the following commands assume you're setting up Hyrax in a develo
132
132
 
133
133
  First, you'll need a working Ruby installation. You can install this via your operating system's package manager -- you are likely to get farther with OSX, Linux, or UNIX than Windows but your mileage may vary -- but we recommend using a Ruby version manager such as [RVM](https://rvm.io/) or [rbenv](https://github.com/sstephenson/rbenv).
134
134
 
135
- We recommend either Ruby 2.4 or the latest 2.3 version.
135
+ We recommend either Ruby 2.5 or the latest 2.4 version.
136
136
 
137
137
  ## Redis
138
138
 
@@ -142,11 +142,11 @@ Starting up Redis will depend on your operating system, and may in fact already
142
142
 
143
143
  ## Rails
144
144
 
145
- Hyrax requires Rails 5. We recommend the latest Rails 5.0 release.
145
+ Hyrax requires Rails 5. We recommend the latest Rails 5.1 release.
146
146
 
147
147
  ```
148
148
  # If you don't already have Rails at your disposal...
149
- gem install rails -v 5.0.6
149
+ gem install rails -v 5.1.6
150
150
  ```
151
151
 
152
152
  ### JavaScript runtime
@@ -162,7 +162,7 @@ NOTE: The steps need to be done in order to create a new Hyrax based app.
162
162
  Generate a new Rails application using the template.
163
163
 
164
164
  ```
165
- rails _5.0.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.1.0.rc1/template.rb
165
+ rails _5.1.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.1.0.rc2/template.rb
166
166
  ```
167
167
 
168
168
  Generating a new Rails application using Hyrax's template above takes cares of a number of steps for you, including:
@@ -200,7 +200,7 @@ Many of the services performed by Hyrax are resource intensive, and therefore ar
200
200
 
201
201
  Hyrax implements these jobs using the Rails [ActiveJob](http://edgeguides.rubyonrails.org/active_job_basics.html) framework, allowing you to choose the message queue system of your choice.
202
202
 
203
- For initial testing and development, it is recommended that you change the default ActiveJob adapter from `:async` to `:inline`. This adapter will execute jobs immediately (in the foreground) as they are received. This can be accomplished by adding the following to your `config/application.rb`
203
+ For initial development, it is recommended that you change the default ActiveJob adapter from `:async` to `:inline`. This adapter will execute jobs immediately (in the foreground) as they are received. This can be accomplished by adding the following to your `config/environments/development.rb`
204
204
 
205
205
  ```
206
206
  class Application < Rails::Application
@@ -210,6 +210,16 @@ class Application < Rails::Application
210
210
  end
211
211
  ```
212
212
 
213
+ For testing, it is recommended that you use the [built-in `:test` adapter](http://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/TestAdapter.html) which stores enqueued and performed jobs, running only those configured to run during test setup. To do this, add the following to `config/environments/test.rb`:
214
+
215
+ ```ruby
216
+ Rails.application.configure do
217
+ # ...
218
+ config.active_job.queue_adapter = :test
219
+ # ...
220
+ end
221
+ ```
222
+
213
223
  **For production applications** you will want to use a more robust message queue system such as [Sidekiq](http://sidekiq.org/). The Hyrax Development Guide has a detailed walkthrough of [installing and configuring Sidekiq](https://github.com/samvera/hyrax/wiki/Using-Sidekiq-with-Hyrax).
214
224
 
215
225
  ## Create default administrative set
@@ -48,7 +48,7 @@ Hyrax = {
48
48
  // The Collection edit page
49
49
  collectionEditor: function() {
50
50
  var CollectionControls = require('hyrax/collections/editor');
51
- var controls = new CollectionControls($('#collection_permissions'));
51
+ var controls = new CollectionControls($('#collection-edit-controls'));
52
52
  },
53
53
 
54
54
  // Collections v2 - collections related js should (over time) be moved here
@@ -1,3 +1,5 @@
1
+ var autocompleteModule = require('hyrax/autocomplete');
2
+
1
3
  Blacklight.onLoad(function () {
2
4
 
3
5
  /**
@@ -182,18 +184,31 @@ Blacklight.onLoad(function () {
182
184
  $('[data-behavior="updates-collection"]').on('click', function() {
183
185
  var string_to_replace = "collection_replace_id",
184
186
  form = $(this).closest("form"),
185
- collection_id = $(".collection-selector:checked")[0].value;
187
+ collection_id = $('#member_of_collection_ids')[0].value;
186
188
 
187
189
  form[0].action = form[0].action.replace(string_to_replace, collection_id);
188
190
  form.append('<input type="hidden" value="add" name="collection[members]"></input>');
189
191
  });
190
192
 
193
+ // Initializes the autocomplete element for the add to collection modal
194
+ $('#collection-list-container').on('show.bs.modal', function() {
195
+ var inputField = $('#member_of_collection_ids');
196
+ var autocomplete = new autocompleteModule();
197
+ autocomplete.setup(inputField, inputField.data('autocomplete'), inputField.data('autocompleteUrl'));
198
+ });
199
+
191
200
  // Display access deny for edit request.
192
201
  $('#documents').find('.edit-collection-deny-button').on('click', function (e) {
193
202
  e.preventDefault();
194
203
  $('#collections-to-edit-deny-modal').modal('show');
195
204
  });
196
205
 
206
+ // Display access deny for remove parent collection button.
207
+ $('#parent-collections-wrapper').find('.remove-parent-from-collection-deny-button').on('click', function (e) {
208
+ e.preventDefault();
209
+ $('#parent-collection-to-remove-deny-modal').modal('show');
210
+ });
211
+
197
212
  // Remove this parent collection list button clicked
198
213
  $('#parent-collections-wrapper')
199
214
  .find('.remove-from-collection-button')
@@ -266,18 +281,6 @@ Blacklight.onLoad(function () {
266
281
  }
267
282
  });
268
283
 
269
- $('#show-more-parent-collections').on('click', function () {
270
- $(this).hide();
271
- $("#more-parent-collections").show();
272
- $("#show-less-parent-collections").show();
273
- });
274
-
275
- $('#show-less-parent-collections').on('click', function () {
276
- $(this).hide();
277
- $("#more-parent-collections").hide();
278
- $("#show-more-parent-collections").show();
279
- });
280
-
281
284
  // Add to collection modal form post
282
285
  $('#add-to-collection-modal').find('.modal-add-button').on('click', function (e) {
283
286
  var $self = $(this),
@@ -9,3 +9,15 @@ if Turbolinks?
9
9
  else
10
10
  @failed = true
11
11
  @delegate.requestFailedWithStatusCode(@xhr.status, @xhr.responseText)
12
+
13
+ # Fixes a back/forward navigation problem with UV and turbolinks
14
+ # See https://github.com/samvera/hyrax/issues/2964
15
+ # This is based on https://github.com/turbolinks/turbolinks/issues/219#issuecomment-275838923
16
+ $(window).on 'popstate', (event) =>
17
+ @turbolinks_location = Turbolinks.Location.wrap(window.location)
18
+ return if Turbolinks.controller.location.requestURL == @turbolinks_location.requestURL
19
+ return if event.state?.turbolinks
20
+ if @window_turbolinks = window.history.state?.turbolinks
21
+ Turbolinks.controller.historyPoppedToLocationWithRestorationIdentifier(@turbolinks_location, @window_turbolinks.restorationIdentifier)
22
+ else
23
+ Turbolinks.controller.historyPoppedToLocationWithRestorationIdentifier(@turbolinks_location, Turbolinks.uuid())
@@ -46,6 +46,10 @@ body.dashboard {
46
46
  margin-top: 0.5em;
47
47
  }
48
48
 
49
+ .count-display {
50
+ font-size: 1.1em;
51
+ }
52
+
49
53
  .tabs {
50
54
  margin-top: $tab-margin;
51
55
  position: relative;
@@ -73,9 +73,6 @@ module Hyrax
73
73
  end
74
74
 
75
75
  def edit
76
- member_works
77
- # this is used to populate the "add to a collection" action for the members
78
- @user_collections = find_collections_for_form
79
76
  form
80
77
  end
81
78
 
@@ -129,7 +126,6 @@ module Hyrax
129
126
 
130
127
  def after_update_error
131
128
  form
132
- query_collection_members
133
129
  respond_to do |format|
134
130
  format.html { render action: 'edit' }
135
131
  format.json { render json: @collection.errors, status: :unprocessable_entity }
@@ -153,11 +149,12 @@ module Hyrax
153
149
  end
154
150
  end
155
151
 
156
- def after_destroy(id)
152
+ def after_destroy(_id)
153
+ # leaving id to avoid changing the method's parameters prior to release
157
154
  respond_to do |format|
158
155
  format.html do
159
156
  redirect_to my_collections_path,
160
- notice: t('hyrax.dashboard.my.action.collection_delete_success', id: id)
157
+ notice: t('hyrax.dashboard.my.action.collection_delete_success')
161
158
  end
162
159
  format.json { head :no_content, location: my_collections_path }
163
160
  end
@@ -166,7 +163,7 @@ module Hyrax
166
163
  def after_destroy_error(id)
167
164
  respond_to do |format|
168
165
  format.html do
169
- flash[:notice] = t('hyrax.dashboard.my.action.collection_delete_fail', id: id)
166
+ flash[:notice] = t('hyrax.dashboard.my.action.collection_delete_fail')
170
167
  render :edit, status: :unprocessable_entity
171
168
  end
172
169
  format.json { render json: { id: id }, status: :unprocessable_entity, location: dashboard_collection_path(@collection) }
@@ -56,6 +56,7 @@ module Hyrax
56
56
  @empty_batch = batch.empty?
57
57
  @all_checked = (count_on_page == @document_list.count)
58
58
  @add_works_to_collection = params.fetch(:add_works_to_collection, '')
59
+ @add_works_to_collection_label = params.fetch(:add_works_to_collection_label, '')
59
60
  end
60
61
 
61
62
  def query_solr
@@ -20,6 +20,15 @@ module Hyrax
20
20
  content_tag :span, safe_join([t('hyrax.collection.is_part_of'), ': '] + collection_links)
21
21
  end
22
22
 
23
+ ##
24
+ # Append a collection_type_id to the existing querystring (whether or not it has pre-existing params)
25
+ # @return [String] the original url with and added collection_type_id param
26
+ def append_collection_type_url(url, collection_type_id)
27
+ uri = URI.parse(url)
28
+ uri.query = [uri.query, "collection_type_id=#{collection_type_id}"].compact.join('&')
29
+ uri.to_s
30
+ end
31
+
23
32
  # @return [Boolean]
24
33
  def has_collection_search_parameters?
25
34
  params[:cq].present?
@@ -39,20 +39,19 @@ module Sipity
39
39
  # Within the given permission_template scope:
40
40
  # * Activate the specified workflow_id or workflow_name
41
41
  # * Deactivate the other workflows
42
- #
43
- # TODO: Resolve https://github.com/samvera/hyrax/issues/2151 as the documentation is aspirational and not reality
44
- #
45
42
  # @param permission_template [Hyrax::PermissionTemplate] The scope for activation of the workflow id
46
43
  # @param workflow_id [Integer] The workflow_id within the given permission_template that should be activated
47
44
  # @param workflow_name [String] The name of the workflow within the given permission template that should be activated
48
- # @return [TrueClass]
45
+ # @return [Sipity::Workflow] active workflow
49
46
  # @raise [ActiveRecord::RecordNotFound] When we have a mismatch on permission template and workflow id or workflow name
50
47
  # @raise [RuntimeError] When you don't specify a workflow_id or workflow_name
51
48
  def self.activate!(permission_template:, workflow_id: nil, workflow_name: nil)
52
49
  raise "You must specify a workflow_id or workflow_name to activate!" if workflow_id.blank? && workflow_name.blank?
53
- finder_attributes = { permission_template: permission_template, id: workflow_id, name: workflow_name }.compact
54
- Sipity::Workflow.find_by!(finder_attributes).tap do |workflow|
55
- Sipity::Workflow.where(permission_template: permission_template, active: true).update(active: nil)
50
+ workflow_to_activate = Sipity::Workflow.find_by!({ permission_template: permission_template, id: workflow_id, name: workflow_name }.compact)
51
+ active_workflow = Sipity::Workflow.where(permission_template: permission_template, active: true)
52
+ return workflow_to_activate if workflow_to_activate == active_workflow.first
53
+ workflow_to_activate.tap do |workflow|
54
+ active_workflow.update(active: nil)
56
55
  workflow.update!(active: true)
57
56
  end
58
57
  end
@@ -57,7 +57,10 @@ module Hyrax
57
57
 
58
58
  # @return [Boolean] render the UniversalViewer
59
59
  def universal_viewer?
60
- Hyrax.config.iiif_image_server? &&
60
+ representative_id.present? &&
61
+ representative_presenter.present? &&
62
+ representative_presenter.image? &&
63
+ Hyrax.config.iiif_image_server? &&
61
64
  members_include_viewable_image?
62
65
  end
63
66
 
@@ -133,6 +133,7 @@ module Hyrax
133
133
  def self.find_solr_document_by(id:)
134
134
  query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids([id])
135
135
  document = ActiveFedora::SolrService.query(query, rows: 1).first
136
+ document = ActiveFedora::Base.find(id).to_solr if document.nil?
136
137
  raise "Unable to find SolrDocument with ID=#{id}" if document.nil?
137
138
  document
138
139
  end
@@ -40,7 +40,7 @@ module Hyrax
40
40
  require_membership: false,
41
41
  assigns_workflow: false,
42
42
  assigns_visibility: false,
43
- badge_color: "#663333",
43
+ badge_color: "#705070",
44
44
  participants: [{ agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE, agent_id: ::Ability.admin_group_name, access: Hyrax::CollectionTypeParticipant::MANAGE_ACCESS },
45
45
  { agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE, agent_id: ::Ability.registered_group_name, access: Hyrax::CollectionTypeParticipant::CREATE_ACCESS }]
46
46
  }.freeze
@@ -58,7 +58,7 @@ module Hyrax
58
58
  require_membership: true,
59
59
  assigns_workflow: true,
60
60
  assigns_visibility: true,
61
- badge_color: "#663333",
61
+ badge_color: "#405060",
62
62
  participants: [{ agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE, agent_id: ::Ability.admin_group_name, access: Hyrax::CollectionTypeParticipant::MANAGE_ACCESS },
63
63
  { agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE, agent_id: ::Ability.admin_group_name, access: Hyrax::CollectionTypeParticipant::CREATE_ACCESS }]
64
64
  }.freeze
@@ -78,7 +78,7 @@ module Hyrax
78
78
  def fixity_check_file(file)
79
79
  versions = file.has_versions? ? file.versions.all : [file]
80
80
 
81
- versions = [versions.max_by(&:created)] if latest_version_only
81
+ versions = [versions.max_by(&:created)] if file.has_versions? && latest_version_only
82
82
 
83
83
  versions.collect { |v| fixity_check_file_version(file.id, v.uri.to_s) }.flatten
84
84
  end
@@ -1,4 +1,4 @@
1
- <div class="panel panel-default tabs">
1
+ <div class="panel panel-default tabs" id="collection-edit-controls">
2
2
  <ul class="nav nav-tabs" role="tablist">
3
3
  <li class="active">
4
4
  <a href="#description" role="tab" data-toggle="tab"><%= t('.tabs.description') %></a>
@@ -13,12 +13,17 @@
13
13
  <fieldset>
14
14
  <legend><%= t("hyrax.collection.select_form.select_heading") %></legend>
15
15
  <ul>
16
- <% user_collections.sort { |c1,c2| c2[CatalogController.uploaded_field] <=> c1[CatalogController.uploaded_field] }.each_with_index do |collection,index| %>
17
- <li>
18
- <% selected = (collection.id == @add_works_to_collection) || (@add_works_to_collection.blank? && index == 0) %>
19
- <%= radio_button_tag(:id, collection.id, selected, class: "collection-selector") %>
20
- <%= label_tag(:collection, collection.title_or_label, for: "id_#{collection.id}") %>
21
- </li>
16
+ <% if @add_works_to_collection.present? %>
17
+ <%= text_field_tag 'member_of_collection_label', @add_works_to_collection_label, disabled: true %>
18
+ <%= hidden_field_tag 'member_of_collection_ids', @add_works_to_collection %>
19
+ <% else %>
20
+ <%= text_field_tag 'member_of_collection_ids', nil,
21
+ prompt: :translate,
22
+ data: {
23
+ placeholder: t('simple_form.placeholders.defaults.member_of_collection_ids'),
24
+ autocomplete: 'collection',
25
+ 'autocomplete-url' => Rails.application.routes.url_helpers.qa_path + '/search/collections?access=deposit'
26
+ } %>
22
27
  <% end %>
23
28
  </ul>
24
29
  </fieldset>
@@ -0,0 +1,14 @@
1
+ <div class="modal fade" id="parent-collection-to-remove-deny-modal" tabindex="-1" role="dialog" aria-labelledby="remove-parent-collection-label">
2
+ <div class="modal-dialog" role="document">
3
+ <div class="modal-content">
4
+ <form class="delete-collection-form">
5
+ <div class="modal-body">
6
+ <p><%= t('hyrax.dashboard.collections.form_relationships.modals.remove_parent_collection_deny') %></p>
7
+ </div>
8
+ <div class="modal-footer">
9
+ <button type="button" class="btn btn-primary" data-dismiss="modal"><%= t('helpers.action.close') %></button>
10
+ </div>
11
+ </form>
12
+ </div>
13
+ </div>
14
+ </div>
@@ -16,7 +16,7 @@
16
16
  </div>
17
17
  <div>
18
18
  <%= link_to t('hyrax.collection.actions.add_existing_works.label'),
19
- hyrax.my_works_path(add_works_to_collection: presenter.id),
19
+ hyrax.my_works_path(add_works_to_collection: presenter.id, add_works_to_collection_label: presenter.title),
20
20
  title: t('hyrax.collection.actions.add_existing_works.desc'),
21
21
  class: 'btn btn-link side-arrows',
22
22
  data: { turbolinks: false } %>
@@ -6,6 +6,16 @@
6
6
  <div class="collections-list-title">
7
7
  <%= link_to document, [hyrax, :dashboard, document], id: "src_copy_link_#{document.id}" %>
8
8
  </div>
9
- <button class="btn btn-xs btn-danger remove-from-collection-button" <%= "disabled" unless can? :edit, document.id %>><%= t('hyrax.collections.show.buttons.remove_from_collection') %></button>
9
+ <% if can? :edit, id %>
10
+ <% if can? :edit, document.id %>
11
+ <button class="btn btn-xs btn-danger remove-from-collection-button"><%= t('hyrax.collections.show.buttons.remove_from_collection') %></button>
12
+ <% else %>
13
+ <%= link_to "#",
14
+ class: 'btn btn-xs btn-danger remove-parent-from-collection-deny-button',
15
+ title: t('hyrax.collections.show.buttons.remove_from_collection') do %>
16
+ <%= t('hyrax.collections.show.buttons.remove_from_collection') %>
17
+ <% end %>
18
+ <% end %>
19
+ <% end %>
10
20
  </div>
11
21
  </li>
@@ -96,6 +96,7 @@
96
96
  <% if @presenter.collection_type_is_nestable? && !has_collection_search_parameters? %>
97
97
  <%= render 'hyrax/my/collections/modal_add_to_collection', source: 'show' %>
98
98
  <%= render 'hyrax/my/collections/modal_add_subcollection', id: @presenter.id, source: 'show' %>
99
+ <%= render 'hyrax/dashboard/collections/modal_parent_collection_remove_deny', source: 'show' %>
99
100
  <% end %>
100
101
 
101
102
  <% unless has_collection_search_parameters? %>