Module: Cul::Hydra::Controllers::Helpers::HydraUploaderHelperBehavior

Defined in:
lib/cul_hydra/controllers/helpers/hydra_uploader_helper_behavior.rb

Instance Method Summary collapse

Instance Method Details

#asset_idObject



14
15
16
17
18
19
20
# File 'lib/cul_hydra/controllers/helpers/hydra_uploader_helper_behavior.rb', line 14

def asset_id
  if !params[:asset_id].nil?
    return params[:asset_id]
  else
    return params[:id]
  end
end

#container_idObject

The id of the container that uploads should be posted into If params is not set, it uses params (assumes that you’re uploading items into the current object)



24
25
26
27
28
29
30
31
32
# File 'lib/cul_hydra/controllers/helpers/hydra_uploader_helper_behavior.rb', line 24

def container_id
  if !params[:container_id].nil?
    return params[:container_id]
  elsif !params[:asset_id].nil?
    return params[:asset_id]
  else
    return params[:id]
  end
end

#upload_url(in_place = false) ⇒ Object

Generate the appropriate url for posting uploads to Uses the container_id method to figure out what container uploads should go into



6
7
8
9
10
11
12
# File 'lib/cul_hydra/controllers/helpers/hydra_uploader_helper_behavior.rb', line 6

def upload_url(in_place=false)
  if in_place
    upload_url = asset_datastream_path(:asset_id=>container_id, :id=>'CONTENT')
  else
    upload_url = asset_resources_path(:container_id=>container_id)
  end
end