Class: FlyAdmin::UploadsController

Inherits:
ApplicationController show all
Includes:
SettingsHelper, VideoModule
Defined in:
app/controllers/fly_admin/uploads_controller.rb

Instance Method Summary collapse

Methods included from SettingsHelper

#custom_checkbox_tag, #daemon_enabled?

Methods inherited from ApplicationController

#authenticate_admin!

Instance Method Details

#filesObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/fly_admin/uploads_controller.rb', line 24

def files
  @path = SiteConfig["torrents_path"]
  
  if params[:li_attr]
    url = params[:li_attr][:url].shellescape 
  else
    url = ""
  end
  
  url = params[:id] == '#' ? @path : @path + url
  nodes = Dir["#{url}/*"].map {|p| p.split(@path).last }
  nodes = tree_js_format(nodes)
  render status: 404, text: 'Нет файлов!' and return if nodes.empty?
  render json: nodes
end

#indexObject



8
9
10
# File 'app/controllers/fly_admin/uploads_controller.rb', line 8

def index
  @categories = Category.all.each {|c| c.json_name = JSON.parse(c.name)["ru"]}
end

#uploadObject



12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/fly_admin/uploads_controller.rb', line 12

def upload
  redirect_to upload_path, alert: "Пожалуйста укажите сезон " and return unless params["season_id"].present? 
  redirect_to upload_path, alert: "Пожалуйста укажите файлы для загрузки" and return if params["nodes"] == "[]"
  group_files_for_uploading
  if daemon_enabled?
    flash[:notice] = "Конвертация запущена!"
  else
    flash[:alert] = "Конвертация запущена, но у вас выключен демон в настройках!( после запуска демона конвертация начнется автоматически )"
  end
  redirect_to videos_path(season_id: params["season_id"], after_upload: 'yes')
end