Module: HydraDjatokaHelper

Defined in:
vendor/plugins/hydra_repository/app/helpers/hydra_djatoka_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) hydra_djatoka_url_for(document, opts = {})



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'vendor/plugins/hydra_repository/app/helpers/hydra_djatoka_helper.rb', line 3

def hydra_djatoka_url_for(document, opts={})
  
  if document.kind_of?(SolrDocument)
    pid = document.id
  elsif document.kind_of?(Mash) 
    pid = document[:id]
  elsif document.respond_to?(:pid)
      pid = document.pid
  end
  
  if !pid.nil?
    if opts[:scale]
      result = url_for(:controller=>:get,:action=>"show",:id=>pid, :format=>"jp2", "image_server[scale]"=>opts[:scale])
    else
      result = url_for(:controller=>:get,:action=>"show",:id=>pid, :format=>"jp2", "image_server"=>true)
    end
  end
    
end