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 destroy
    if @collection.special? || @collection.communities.count == 1
      flash[:error] = @collection.watch_collection? ?
        I18n.t(:watch_collections_cannot_be_destroyed) :
        I18n.t(:special_collections_cannot_be_destroyed)
      return redirect_to collection_url(@collection)
    else
      back = @collection.communities.first ?
        collection_url(@collection.communities.first) :
        user_collections_url(current_user)
      if @collection.unpublish
        flash[:notice] = I18n.t(:collection_destroyed)
      else
        flash[:error] = I18n.t(:collection_not_destroyed_error)
      end
      respond_to do |format|
        format.html { redirect_to(back, status: :moved_permanently) }
        format.xml  { head :ok }
      end
    end
  end
def destroy if @collection . special? || @collection . communities . count == 1 flash [ :error ] = @collection . watch_collection? ? I18n . t ( :watch_collections_cannot_be_destroyed ) : I18n . t ( :special_collections_cannot_be_destroyed ) return redirect_to collection_url ( @collection ) else back = @collection . communities . first ? collection_url ( @collection . communities . first ) : user_collections_url ( current_user ) if @collection . unpublish flash [ :notice ] = I18n . t ( :collection_destroyed ) else flash [ :error ] = I18n . t ( :collection_not_destroyed_error ) end respond_to do | format | format . html { redirect_to ( back , status : :moved_permanently ) } format . xml { head :ok } end end end
TODO - review these.
TODO - review these .