blob: 8e4bf39dcc83671d2c6430afdd951bb4e56a4d6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
module AttachmentToHTML
module Adapters
class CouldNotConvert
attr_reader :attachment
# Public: Initialize a PDF converter
#
# attachment - the FoiAttachment to convert to HTML
# opts - a Hash of options (default: {}):
# No options currently accepted
def initialize(attachment, opts = {})
@attachment = attachment
end
# Public: The title to use in the <title> tag
#
# Returns a String
def title
@title ||= attachment.display_filename
end
# Public: The contents of the extracted html <body> tag
#
# Returns a String
def body
@body ||= parse_body
end
# Public: Was the document conversion successful?
# As this is a fallback option and not doing anything dynamic
# we're assuming this is successful whatever the case
#
# Returns true
def success?
true
end
private
def parse_body
"<p>Sorry, we were unable to convert this file to HTML. " \
"Please use the download link at the top right.</p>"
end
end
end
end
|