Module: Pageflow::UploadableFile
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary
collapse
#cache_key, #file_type, #nested_files, #original_url, #parent_allows_type_for_nesting, #parent_belongs_to_same_entry, #retry!
Instance Method Details
#attachment ⇒ Object
46
47
48
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 46
def attachment
attachment_on_s3
end
|
#attachment=(value) ⇒ Object
50
51
52
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 50
def attachment=(value)
self.attachment_on_s3 = value
end
|
#attachment_default_url ⇒ Object
Overwritten if a file type wants to merge its attachments default_url into Pageflow.config.paperclip_s3_default_options. (See Pageflow::ImageFile for example)
61
62
63
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 61
def attachment_default_url
''
end
|
#attachment_styles(_attachment) ⇒ Object
Overwritten if a file type wants to add additional styles to Pageflow.config.paperclip_s3_default_options. (See Pageflow::ImageFile for example)
68
69
70
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 68
def attachment_styles(_attachment)
{}
end
|
#attachments_for_export ⇒ Object
74
75
76
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 74
def attachments_for_export
[attachment]
end
|
#basename ⇒ Object
84
85
86
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 84
def basename
File.basename(attachment.original_filename, '.*')
end
|
#can_upload? ⇒ Boolean
92
93
94
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 92
def can_upload?
uploading?
end
|
#direct_upload_config ⇒ Object
#extension ⇒ Object
88
89
90
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 88
def extension
File.extname(attachment.original_filename).sub(/\A\./, '')
end
|
#failed? ⇒ Boolean
104
105
106
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 104
def failed?
uploading_failed?
end
|
#file_name ⇒ Object
42
43
44
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 42
def file_name
attachment_on_s3_file_name
end
|
#publish! ⇒ Object
108
109
110
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 108
def publish!
file_uploaded!
end
|
#ready? ⇒ Boolean
100
101
102
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 100
def ready?
attachment.present?
end
|
#retryable? ⇒ Boolean
96
97
98
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 96
def retryable?
false
end
|
#url ⇒ Object
78
79
80
81
82
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 78
def url
if attachment.present?
attachment.url
end
end
|