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 remove_items(options)
    collection_items = options[:items] || collection_items_with_scope(options.merge(allow_all: true))
    all_items = params[:scope] == 'all_items'
    count = 0
    raise EOL::Exceptions::NoItemsSelected if collection_items.blank?
    if all_items
      @collection.clear
      log_activity(activity: Activity.remove_all)
    else
      collection_items.each do |item|
        item = CollectionItem.find(item) 
        if item.update_attributes(collection_id: nil) 
          item.remove_from_solr 
          count += 1
          log_activity(activity: Activity.remove, collection_item: item)
        end
      end
      @collection_items.delete_if { |ci| collection_items.include?(ci.id.to_s) } if @collection_items
    end
    options[:from].set_relevance if options[:from]
    return count
  end
def remove_items ( options ) collection_items = options [ :items ] || collection_items_with_scope ( options . merge ( allow_all : true ) ) all_items = params [ :scope ] == 'all_items' count = 0 raise EOL :: Exceptions :: NoItemsSelected if collection_items . blank? if all_items @collection . clear log_activity ( activity : Activity . remove_all ) else collection_items . each do | item | item = CollectionItem . find ( item ) if item . update_attributes ( collection_id : nil ) item . remove_from_solr count += 1 log_activity ( activity : Activity . remove , collection_item : item ) end end @collection_items . delete_if { | ci | collection_items . include? ( ci . id . to_s ) } if @collection_items end options [ :from ] . set_relevance if options [ :from ] return count end
TODO - review these.
TODO - review these .
# Sometimes, this is just an id. # Not actually destroyed, so that we can talk about it in feeds. # TODO - needed?  Or does the #after_save method handle this?
options
<not_specific>