2019-05-28 15:54:32 +00:00
|
|
|
Rails.application.routes.draw do
|
2022-12-02 03:47:34 +00:00
|
|
|
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
|
2019-05-28 15:54:32 +00:00
|
|
|
locales = Site.first.in_use_locales rescue I18n.available_locales
|
2024-11-15 10:20:00 +00:00
|
|
|
|
2019-05-28 15:54:32 +00:00
|
|
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
|
|
|
namespace :admin do
|
|
|
|
resources :e_paper_criterias do
|
|
|
|
member do
|
|
|
|
get "send_test_email"
|
2019-07-01 12:06:33 +00:00
|
|
|
get "send_newsletter"
|
2020-08-28 12:49:47 +00:00
|
|
|
get "get_failed_emails"
|
|
|
|
get "get_invalid_emails"
|
2019-05-28 15:54:32 +00:00
|
|
|
end
|
|
|
|
end
|
2024-11-15 10:20:00 +00:00
|
|
|
resources :e_paper_images
|
2022-05-23 14:20:09 +00:00
|
|
|
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'
|
2019-05-28 15:54:32 +00:00
|
|
|
resources :e_paper_subscribers
|
|
|
|
resources :e_papers do
|
2024-11-15 10:20:00 +00:00
|
|
|
member do
|
2019-05-28 15:54:32 +00:00
|
|
|
get :send_email_to_subscribers
|
|
|
|
delete "delete_subscriber"
|
|
|
|
get "send_test_email"
|
|
|
|
end
|
|
|
|
collection do
|
|
|
|
get "instructions"
|
|
|
|
get "subscribers"
|
2024-11-15 10:20:00 +00:00
|
|
|
end
|
2019-05-28 15:54:32 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
get "/xhr/epaper/subscribeuser", to: "e_papers#subscribeuser"
|
|
|
|
get "/xhr/epaper/unsubscribeuser", to: "e_papers#unsubscribeuser"
|
|
|
|
end
|
|
|
|
end
|