app/controllers/concerns/hyrax/works_controller_behavior.rb
# Add uploaded_files to the parameters received by the actor.
Add uploaded_files to the parameters received by the actor.
Add uploaded_files to the parameters received by the actor .
def attributes_for_actor
      raw_params = params[hash_key_for_curation_concern]
      attributes = if raw_params
                     work_form_service.form_class(curation_concern).model_attributes(raw_params)
                   else
                     {}
                   end
      uploaded_files = params.fetch(:uploaded_files, [])
      selected_files = params.fetch(:selected_files, {}).values
      browse_everything_urls = uploaded_files &
          selected_files.map { |f| f[:url] }
      browse_everything_files = selected_files
                                    .select { |v| uploaded_files.include?(v[:url]) }
      attributes[:remote_files] = browse_everything_files
      attributes[:uploaded_files] = uploaded_files -
          browse_everything_urls
      attributes
    end
def attributes_for_actor raw_params = params [ hash_key_for_curation_concern ] attributes = if raw_params work_form_service . form_class ( curation_concern ) . model_attributes ( raw_params ) else { } end uploaded_files = params . fetch ( :uploaded_files , [ ] ) selected_files = params . fetch ( :selected_files , { } ) . values browse_everything_urls = uploaded_files & selected_files . map { | f | f [ :url ] } browse_everything_files = selected_files . select { | v | uploaded_files . include? ( v [ :url ] ) } attributes [ :remote_files ] = browse_everything_files attributes [ :uploaded_files ] = uploaded_files - browse_everything_urls attributes end
Add uploaded_files to the parameters received by the actor.
Add uploaded_files to the parameters received by the actor .
# If they selected a BrowseEverything file, but then clicked the # remove button, it will still show up in `selected_files`, but # it will no longer be in uploaded_files. By checking the # intersection, we get the files they added via BrowseEverything # that they have not removed from the upload widget. # we need the hash of files with url and file_name # Strip out any BrowseEverthing files from the regular uploads.