Class: AttachmentPresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/attachment_presenter.rb

Overview

Present an Attachment

Instance Attribute Summary

Attributes inherited from BasePresenter

object

Instance Method Summary (collapse)

Methods inherited from BasePresenter

#initialize

Constructor Details

This class inherits a constructor from BasePresenter

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BasePresenter

Instance Method Details

render the image with a link to open a larger view in a popup-div if content_type is image otherwise render a link to download the file.



9
10
11
12
13
14
15
# File 'app/presenters/attachment_presenter.rb', line 9

def image_or_link
  if attachment.file.content_type =~ /image/
    link_to_function( h.image_tag( w3c_url(attachment.file.url(:icon)) ), "image_popup('#{attachment.file.url(:popup)}')")
  else
    link_button attachment.file.original_filename, "button download small", attachment.file.url()
  end
end