app/controllers/collections_controller.rb
# TODO - review these. There are too many and as a result there's some redundancy in, for example, checking whether the user is logged in on unpublished
# collections
review these. There are too many and as a result there's some redundancy in, for example, checking whether the user is logged in on unpublished
collections
review these . There are too many and as a result there ' s some redundancy in for example checking whether the user is logged in on unpublished collections
def create_collection_from_existing
    source = Collection.find(params[:source_collection_id])
    if source.nil?
      @collection.destroy
      flash[:notice] = nil 
      flash[:error] = I18n.t(:could_not_find_collection_error)
      return redirect_to collection_path(@collection)
    end
    if params[:for] == 'copy'
      auto_collect(@collection)
      EOL::GlobalStatistics.increment('collections')
      log_activity(activity: Activity.create)
      return copy_items_and_redirect(source, [@collection])
    elsif params[:for] == 'move'
      auto_collect(@collection)
      EOL::GlobalStatistics.increment('collections')
      log_activity(activity: Activity.create)
      return copy_items_and_redirect(source, [@collection], move: true)
    else
      @collection.destroy
      flash[:notice] = nil 
      flash[:error] = I18n.t(:collection_not_created_error, collection_name: @collection.name)
      return redirect_to collection_path(@collection)
    end
  end
def create_collection_from_existing source = Collection . find ( params [ :source_collection_id ] ) if source . nil? @collection . destroy flash [ :notice ] = nil flash [ :error ] = I18n . t ( :could_not_find_collection_error ) return redirect_to collection_path ( @collection ) end if params [ :for ] == 'copy' auto_collect ( @collection ) EOL :: GlobalStatistics . increment ( 'collections' ) log_activity ( activity : Activity . create ) return copy_items_and_redirect ( source , [ @collection ] ) elsif params [ :for ] == 'move' auto_collect ( @collection ) EOL :: GlobalStatistics . increment ( 'collections' ) log_activity ( activity : Activity . create ) return copy_items_and_redirect ( source , [ @collection ] , move : true ) else @collection . destroy flash [ :notice ] = nil flash [ :error ] = I18n . t ( :collection_not_created_error , collection_name : @collection . name ) return redirect_to collection_path ( @collection ) end end
TODO - review these.
TODO - review these .
# We're undoing the create. # We're undoing the create.