Class: Lcms::Engine::DownloadsController

Inherits:
ApplicationController show all
Includes:
AnalyticsTracking
Defined in:
app/controllers/lcms/engine/downloads_controller.rb

Constant Summary

Constants included from AnalyticsTracking

AnalyticsTracking::GA_DEBUG_MODE

Instance Method Summary collapse

Instance Method Details

#pdf_proxyObject



22
23
24
25
26
27
28
# File 'app/controllers/lcms/engine/downloads_controller.rb', line 22

def pdf_proxy
  uri = URI.parse attachment_url
  send_data uri.open.read,
            disposition: :inline,
            file_name: attachment_url.split('/').last,
            type: 'application/pdf'
end

#previewObject



14
15
16
17
18
19
20
# File 'app/controllers/lcms/engine/downloads_controller.rb', line 14

def preview
  ga_track('preview')
  @resource = resource_download.resource
  RestClient.head(attachment_url)
rescue RestClient::ExceptionWithResponse => e
  render text: e.response, status: '404'
end

#showObject



10
11
12
# File 'app/controllers/lcms/engine/downloads_controller.rb', line 10

def show
  redirect_to attachment_url
end