Class: Alchemy::Custom::Model::ElFinder::Volumes::AlchemyFiles

Inherits:
AlchemyFile
  • Object
show all
Defined in:
lib/alchemy/custom/model/el_finder/volumes/alchemy_files.rb

Instance Attribute Summary

Attributes inherited from Base

#id, #name, #root, #url

Instance Method Summary collapse

Methods inherited from AlchemyFile

#copy, #cwd, #duplicable?, #path_info, #pathname, #rm, #upload_max_size_in_bytes

Methods inherited from Base

#contains?, #cwd, #encode, #pathname

Methods included from TranslationScope

#acm_t

Constructor Details

#initialize(options = {root: '/files', name: 'Alchemy Library - Files', id: 'alchemy_library_files', url: '/'}) ⇒ AlchemyFiles

Returns a new instance of AlchemyFiles.



5
6
7
# File 'lib/alchemy/custom/model/el_finder/volumes/alchemy_files.rb', line 5

def initialize(options = {root: '/files', name: 'Alchemy Library - Files', id: 'alchemy_library_files', url: '/'})
  super
end

Instance Method Details

#decode(hash) ⇒ Object



13
14
15
16
17
# File 'lib/alchemy/custom/model/el_finder/volumes/alchemy_files.rb', line 13

def decode(hash)
  super do |path|
    Paths::File.new(@root, path, volume: self)
  end
end

#disabled_commandsObject



36
37
38
39
40
# File 'lib/alchemy/custom/model/el_finder/volumes/alchemy_files.rb', line 36

def disabled_commands

  super + ['rm']

end

#files(target = '.') ⇒ Object



9
10
11
# File 'lib/alchemy/custom/model/el_finder/volumes/alchemy_files.rb', line 9

def files(target = '.')
  super(root_path)
end

#search(type:, q:) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/alchemy/custom/model/el_finder/volumes/alchemy_files.rb', line 28

def search(type:, q:)

  super do
    search_query_build(klass: ::Alchemy::Attachment, type: type, q: q, mime_attribute: :file_mime_type)
  end

end

#upload(target, upload) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/alchemy/custom/model/el_finder/volumes/alchemy_files.rb', line 19

def upload(target, upload)
  super do |file|
    f = ::Alchemy::Attachment.create(
        file: file
    )
    root_path.build_file_path(f)
  end
end