Sha256: 211b68c8d8d046eeb2369c15a1c929614b872a53e13da43d776bc2252e47a27c

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

module IipHelper

  # Creates the javascript tags to load all things that are required to use the IIP viewer component
  def iip_include_tags
    result = javascript_include_tag('swfobject')
  	result << javascript_include_tag('iip_flashclient')
  	result
  end

  # Inserts the IIP flash viewer into the page. This method takes an IIP data object (from which the iip request
  # url will be generated), and optionally the height, width and a css class that will be attached to the
  # div object of the viewer.
  def iip_flash_viewer(iip_data, height = 400, width = 400, klass='iipviewer')
    raise(ArgumentError, 'Must pass an iip data object here') unless(iip_data.is_a?(TaliaCore::DataTypes::IipData))
    render :partial => 'shared/iip_flash_viewer', :locals => {
      :image_path => h(iip_data.get_iip_root_file_path),
      :height => h(height.to_s),
      :width => h(width.to_s),
      :element_id => "iip_viewer_#{rand 10E16}", # Random name so that multiple instances can be used
      :div_class => klass
    }
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
muruca_widgets-0.2.6 generators/iip_viewer/templates/iip_helper.rb
muruca_widgets-0.2.4 generators/iip_viewer/templates/iip_helper.rb
muruca_widgets-0.2.3 generators/iip_viewer/templates/iip_helper.rb
muruca_widgets-0.2.2 generators/iip_viewer/templates/iip_helper.rb
muruca_widgets-0.2.1 generators/iip_viewer/templates/iip_helper.rb
muruca_widgets-0.2.0 generators/iip_viewer/templates/iip_helper.rb