56 lines
2.0 KiB
Ruby
56 lines
2.0 KiB
Ruby
Rails.application.routes.draw do
|
|
if ENV['worker_num']=='0' && File.basename($0) != 'rake' && !Rails.const_defined?('Console')
|
|
Thread.new do
|
|
s = Site.first
|
|
update_flag = s.respond_to?(:tmp_flags)
|
|
need_update = !update_flag || !(s.tmp_flags.include?('ep1'))
|
|
if need_update
|
|
EPaperSubscriber.all.to_a.each do |subscriber|
|
|
subscriber.fix_email
|
|
EPaperSubscriber.where(:id=>subscriber.id).update_all(:email=>subscriber.email)
|
|
end
|
|
if update_flag
|
|
s = OrbitHelper::SharedHash['current_site']['site'] rescue Site.first
|
|
s.tmp_flags << 'ep1'
|
|
s.save
|
|
end
|
|
end
|
|
end
|
|
end
|
|
locales = Site.first.in_use_locales rescue I18n.available_locales
|
|
|
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
|
namespace :admin do
|
|
resources :e_paper_criterias do
|
|
member do
|
|
get "send_test_email"
|
|
get "send_newsletter"
|
|
get "get_failed_emails"
|
|
get "get_invalid_emails"
|
|
end
|
|
end
|
|
get 'e_paper_subscribers/export_excel', to: 'e_paper_subscribers#export_excel'
|
|
get 'e_paper_subscribers/download_excel_format', to: 'e_paper_subscribers#download_excel_format'
|
|
post 'e_paper_subscribers/import_from_excel', to: 'e_paper_subscribers#import_from_excel'
|
|
get 'e_paper_subscribers/get_subscribers_modal', to: 'e_paper_subscribers#get_subscribers_modal'
|
|
get 'e_paper_subscribers/batch_delete_subscribers', to: 'e_paper_subscribers#batch_delete_subscribers'
|
|
post 'e_paper_subscribers/delete_subscribers', to: 'e_paper_subscribers#delete_subscribers'
|
|
resources :e_paper_subscribers
|
|
resources :e_papers do
|
|
member do
|
|
get :send_email_to_subscribers
|
|
delete "delete_subscriber"
|
|
get "send_test_email"
|
|
end
|
|
collection do
|
|
get "instructions"
|
|
get "subscribers"
|
|
end
|
|
end
|
|
end
|
|
|
|
get "/xhr/epaper/subscribeuser", to: "e_papers#subscribeuser"
|
|
get "/xhr/epaper/unsubscribeuser", to: "e_papers#unsubscribeuser"
|
|
end
|
|
end
|