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 show
    return copy_items_and_redirect(@collection, [current_user.watch_collection]) if params[:commit_collect]
    @collection_job = CollectionJob.new(collection: @collection)
    if @collection_results && @collection_results.is_a?(WillPaginate::Collection)
      set_canonical_urls(for: @collection, paginated: @collection_results, url_method: :collection_url)
      reindex_items_if_necessary(@collection_results)
    else
      @rel_canonical_href = collection_url(@collection)
    end
    respond_to do |format|
      format.html {}
      format.json { render json: @collection.as_json().merge(collection_items: @collection_items.map {|i|
          i.collected_item.as_json.merge(type: i.class.name)} ) }
    end
  end
def show return copy_items_and_redirect ( @collection , [ current_user . watch_collection ] ) if params [ :commit_collect ] @collection_job = CollectionJob . new ( collection : @collection ) if @collection_results && @collection_results . is_a? ( WillPaginate :: Collection ) set_canonical_urls ( for : @collection , paginated : @collection_results , url_method : :collection_url ) reindex_items_if_necessary ( @collection_results ) else @rel_canonical_href = collection_url ( @collection ) end respond_to do | format | format . html { } format . json { render json : @collection . as_json ( ) . merge ( collection_items : @collection_items . map { | i | i . collected_item . as_json . merge ( type : i . class . name ) } ) } end end
TODO - review these.
TODO - review these .
# TODO - this line should be somewhere else: # TODO - this is... expensive, yeah?  Should we REALLY be doing this every time we show a page of a collection?!