boston-library / ark-manager

Archival Resource Key (ARK) Manager for BPL Digital Repository applications.
3 stars 0 forks source link

add IIIF manifest related actions/routes #2

Closed ebenenglish closed 3 years ago

ebenenglish commented 4 years ago

To support 'permalink' behavior for IIIF manifests, the app needs to support actions/routes for manifests, canvases, annotations, collections, and search URLs.

These were previously defined like so:

def iiif_manifest
    @ark = Ark.where(:noid=>params[:noid])
    redirect_to "#{redirect_base}/manifest"
  end

  def iiif_canvas
    @ark = Ark.where(:noid=>params[:noid])
    @canvas_object = Ark.where(:noid=>params[:canvas_object_id])
    redirect_to redirect_base + "/canvas/" + @canvas_object[0].namespace_id + ":" + @canvas_object[0].noid
  end

  def iiif_annotation
    @ark = Ark.where(:noid=>params[:noid])
    @annotation_object = Ark.where(:noid=>params[:annotation_object_id])
    redirect_to redirect_base + "/annotation/" + @annotation_object[0].namespace_id + ":" + @annotation_object[0].noid
  end

  def iiif_collection
    @ark = Ark.where(:noid=>params[:noid])
    redirect_to redirect_base + "/iiif_collection"
  end

  def iiif_search
    @ark = Ark.where(:noid=>params[:noid])
    iiif_query_params = request.query_parameters.to_query
    redirect_path = if iiif_query_params.empty?
                      redirect_base + "/iiif_search"
                    else
                      redirect_base + "/iiif_search?" + iiif_query_params
                    end
    redirect_to redirect_path
  end

Add these back in and refactor to match new code patterns established in version_2 refactor.