class ElFinder2::Command::Tree

Public Instance Methods

execute() click to toggle source
# File lib/el_finder2/command/tree.rb, line 4
def execute
  children = @folder.children.where(type: 'ElFinder2::Folder')

  render json: {
    tree: ActiveModel::ArraySerializer.new(children).as_json
  }
end

Private Instance Methods

parse_params!(params) click to toggle source
# File lib/el_finder2/command/tree.rb, line 12
        def parse_params!(params)
  target = params[:target]

  fail ElFinder2::Error.new(%w(errCmdParams tree)) unless target

  path = to_path(target)

  @folder = ElFinder2::Folder.find_by_path(path)

  fail ElFinder2::Error.new('errFolderNotFound') unless @folder
end