adbanner-test/config/routes.rb

25 lines
844 B
Ruby
Raw Normal View History

2014-04-11 07:47:33 +00:00
Rails.application.routes.draw do
2022-01-05 07:52:40 +00:00
require 'fileutils'
2014-04-11 07:47:33 +00:00
get 'ad_banners/widget'
2022-01-05 07:52:40 +00:00
Thread.new do
ad_images = AdImage.where(:video_file.ne=>nil,:video_snapshot=>nil).to_a
ad_images.each do |ad_image|
ad_image[:video_snapshot] = File.basename(ad_image.video_file.file.path).split(/\.[^.]+$/)[0] + ".jpg"
FileUtils.mkdir_p(File.dirname(ad_image.video_snapshot.file.path))
system("tmp/ffmpeg/ffmpeg -i #{ad_image.video_file.file.path} -vframes 1 #{ad_image.video_snapshot.file.path}")
ad_image.save
end
end
2014-04-11 07:47:33 +00:00
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
namespace :admin do
2016-02-16 12:21:14 +00:00
post "/ad_banner/save_image_order", to: "ad_banners#save_image_order"
2014-04-11 07:47:33 +00:00
resources :ad_banners
resources :ad_images
end
end
end