Module: Pageflow::UploadableFile
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary
collapse
#cache_key, #file_name, #file_type, #nested_files, #original_url, #parent_allows_type_for_nesting, #parent_belongs_to_same_entry, #retry!
Instance Method Details
#attachment ⇒ Object
41
42
43
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 41
def attachment
attachment_on_s3
end
|
#attachment=(value) ⇒ Object
45
46
47
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 45
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)
56
57
58
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 56
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)
63
64
65
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 63
def attachment_styles(_attachment)
{}
end
|
#attachments_for_export ⇒ Object
69
70
71
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 69
def attachments_for_export
[attachment]
end
|
#basename ⇒ Object
79
80
81
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 79
def basename
File.basename(attachment.original_filename, '.*')
end
|
#can_upload? ⇒ Boolean
83
84
85
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 83
def can_upload?
uploading?
end
|
#direct_upload_config ⇒ Object
#failed? ⇒ Boolean
95
96
97
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 95
def failed?
uploading_failed?
end
|
#publish! ⇒ Object
99
100
101
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 99
def publish!
file_uploaded!
end
|
#ready? ⇒ Boolean
91
92
93
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 91
def ready?
attachment.present?
end
|
#retryable? ⇒ Boolean
87
88
89
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 87
def retryable?
false
end
|
#url ⇒ Object
73
74
75
76
77
|
# File 'app/models/concerns/pageflow/uploadable_file.rb', line 73
def url
if attachment.present?
attachment.url
end
end
|