Class: Alchemy::Custom::Model::ElFinder::Paths::ComponentFile
Constant Summary
ActiveRecordReference::URI_SPACER
Instance Attribute Summary
Attributes inherited from Base
#path, #root, #volume
Instance Method Summary
collapse
#active_record_instance, #active_record_instance=, #directory?, #file?, file_to_uri, #fisical_path, #mtime
Methods inherited from Base
#absolute?, #basename, #basename_sans_extension, #child_directories, #children, #cleanpath, #directory?, #dirname, #duplicate, #extname, #file?, #fisical_path, #fullpath, #global_id, #initialize, #is_root?, #mime_type, #mtime, #name, #outside_of_root?, #realpath, #relative?, #relative_to, #rename, #to_s, #unique, #with_sub_dirs?
Instance Method Details
#active_record_class ⇒ Object
5
6
7
|
# File 'lib/alchemy/custom/model/el_finder/paths/component_file.rb', line 5
def active_record_class
self.volume.attribute_class
end
|
#alchemy_record ⇒ Object
9
10
11
12
13
14
|
# File 'lib/alchemy/custom/model/el_finder/paths/component_file.rb', line 9
def alchemy_record
return @_alch_record_cache if @_alch_record_cache
base = active_record_instance
self.volume.file_link_ref.split('.').each {|m| base = base.try(m)}
@_alch_record_cache = base
end
|
#file ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'lib/alchemy/custom/model/el_finder/paths/component_file.rb', line 16
def file
case alchemy_record
when ::Alchemy::Attachment
alchemy_record.file
when ::Alchemy::Picture
alchemy_record.image_file
end
end
|
#file=(val) ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/alchemy/custom/model/el_finder/paths/component_file.rb', line 26
def file=(val)
case alchemy_record
when ::Alchemy::Attachment
alchemy_record.file = val
when ::Alchemy::Picture
alchemy_record.image_file = val
end
end
|
#full_fill_paylod(payload) ⇒ Object
37
38
39
40
|
# File 'lib/alchemy/custom/model/el_finder/paths/component_file.rb', line 37
def full_fill_paylod(payload)
payload[:tmb] = self.tmb
payload
end
|
#is_image? ⇒ Boolean
53
54
55
|
# File 'lib/alchemy/custom/model/el_finder/paths/component_file.rb', line 53
def is_image?
alchemy_record.is_a? ::Alchemy::Picture
end
|
#tmb ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/alchemy/custom/model/el_finder/paths/component_file.rb', line 43
def tmb
case alchemy_record
when ::Alchemy::Attachment
''
when ::Alchemy::Picture
file.thumb('100x100#').url
end
end
|