Class: Optimacms::ElfinderController

Inherits:
ApplicationController show all
Defined in:
app/controllers/optimacms/elfinder_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_lang, #not_found

Methods included from ApplicationHelper

#block, #meta_tags, #method_missing, #site_page_path, #tinymce_editor_insert_block

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Optimacms::ApplicationHelper

Instance Method Details

#elfinderObject



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
# File 'app/controllers/optimacms/elfinder_controller.rb', line 11

def elfinder
  dirpath = Optimacms.files_dir_path
  rootpath = File.join(Rails.public_path, dirpath)
  rooturl = '/'+dirpath

  h, r = ElFinder::Connector.new(
    :root => rootpath,
    :url => rooturl,
    :perms => {
       #/^(Welcome|README)$/ => {:read => true, :write => false, :rm => false},

       '.' => {:read => true, :write => true, :rm => true}, # '.' is the proper way to specify the home/root directory.

       #/^test$/ => {:read => true, :write => true, :rm => false},

       #'logo.png' => {:read => true},

       #/\.png$/ => {:read => false} # This will cause 'logo.png' to be unreadable.

       # Permissions err on the safe side. Once false, always false.

    },
    :thumbs => true
  ).run(params)

  headers.merge!(h)

  if r.empty?
    (render :nothing => true) and return
  end

  render :json => r, :layout => false
end

#indexObject



7
8
9
# File 'app/controllers/optimacms/elfinder_controller.rb', line 7

def index
   render :layout => false
end