Class: Optimacms::Admin::MediafilesController

Inherits:
AdminBaseController show all
Defined in:
app/controllers/optimacms/admin/mediafiles_controller.rb

Instance Method Summary collapse

Methods inherited from AdminBaseController

#after_sign_in_path_for, #redirect_to_res, #set_layout_modal_old

Methods inherited from Optimacms::ApplicationController

#current_lang, #not_found

Methods included from Optimacms::ApplicationHelper

#block, #block_with_edit, #eval_meta_string, #fix_quotes, #meta_tags, #method_missing, #msg, #tinymce_editor_insert_block, #url_for

Dynamic Method Handling

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

Instance Method Details

#elfinderObject



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
38
39
# File 'app/controllers/optimacms/admin/mediafiles_controller.rb', line 13

def elfinder
  dirpath = Optimacms.config.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

layout ‘optimacms/admin/layouts/basic’ layout ‘optimacms/admin/layouts/elfinder’



9
10
11
# File 'app/controllers/optimacms/admin/mediafiles_controller.rb', line 9

def index
  #render :layout => false
end