2021-07-21 07:37:06 +00:00
|
|
|
Rails.application.routes.draw do
|
|
|
|
locales = Site.first.in_use_locales rescue I18n.available_locales
|
2021-07-22 08:44:58 +00:00
|
|
|
begin
|
|
|
|
s = Site.first
|
|
|
|
save_flag = false
|
|
|
|
if !s.orbit_bar_extra_render_files_inside.include?("ruling_timers/timer_button")
|
|
|
|
s.orbit_bar_extra_render_files_inside << "ruling_timers/timer_button"
|
|
|
|
save_flag = true
|
|
|
|
end
|
|
|
|
if !s.orbit_bar_extra_render_files_outside.include?("ruling_timers/timer_window")
|
|
|
|
s.orbit_bar_extra_render_files_outside << "ruling_timers/timer_window"
|
|
|
|
save_flag = true
|
|
|
|
end
|
|
|
|
s.save if save_flag
|
2022-04-18 01:01:57 +00:00
|
|
|
@module_app = ModuleApp.where(:key=>"ruling_timer").first
|
2022-04-18 13:45:34 +00:00
|
|
|
if @module_app.nil?
|
|
|
|
@module_app = OrbitMemberModule.where(:key=>"ruling_timer").first
|
|
|
|
else
|
|
|
|
@new_module_app = OrbitMemberModule.where(:key=>"ruling_timer").first
|
|
|
|
@module_app.categories.each do |c|
|
|
|
|
c.module_app = nil
|
|
|
|
c.orbit_member_module = @new_module_app
|
|
|
|
c.save
|
|
|
|
end
|
|
|
|
@module_app.tags.each do |c|
|
|
|
|
c.module_app = []
|
|
|
|
c.orbit_member_module = [@new_module_app]
|
|
|
|
c.save
|
|
|
|
end
|
|
|
|
@module_app.destroy
|
|
|
|
@module_app = @new_module_app
|
|
|
|
end
|
2022-04-18 01:01:57 +00:00
|
|
|
if @module_app.categories.count == 0
|
|
|
|
category = @module_app.categories.new
|
|
|
|
category.title_translations = I18n.available_locales.map{|l| [l.to_s,I18n.with_locale(l){I18n.t("ruling_timer.personal_project")}]}.to_h
|
|
|
|
category.save
|
|
|
|
setting = RulingTimerSetting.first
|
|
|
|
setting = RulingTimerSetting.create if setting.nil?
|
|
|
|
setting.personal_category_id = category.id
|
|
|
|
setting.save
|
|
|
|
else
|
|
|
|
setting = RulingTimerSetting.first
|
|
|
|
setting = RulingTimerSetting.create if setting.nil?
|
|
|
|
if setting.personal_category_id.nil?
|
|
|
|
category = @module_app.categories.first
|
|
|
|
setting.personal_category_id = category.id
|
|
|
|
setting.save
|
|
|
|
else
|
|
|
|
category = Category.find(setting.personal_category_id)
|
|
|
|
end
|
|
|
|
category.title_translations = I18n.available_locales.map{|l| [l.to_s,I18n.with_locale(l){I18n.t("ruling_timer.personal_project")}]}.to_h
|
|
|
|
category.save
|
|
|
|
end
|
2021-07-22 08:44:58 +00:00
|
|
|
rescue => e
|
|
|
|
puts e.to_s
|
|
|
|
end
|
2021-07-21 07:37:06 +00:00
|
|
|
namespace :admin do
|
|
|
|
resources :ruling_timers do
|
|
|
|
member do
|
|
|
|
post "delete_history"
|
|
|
|
get "add_history"
|
|
|
|
get "work_history"
|
|
|
|
get "edit_timer"
|
|
|
|
get "edit_temp_timer"
|
|
|
|
patch "update_timer"
|
|
|
|
patch "update_task"
|
|
|
|
get "edit_task"
|
|
|
|
post "delete_task"
|
|
|
|
get "view_task"
|
2022-04-18 01:01:57 +00:00
|
|
|
patch "update_project"
|
|
|
|
get "edit_project"
|
|
|
|
post "delete_project"
|
|
|
|
get "view_project"
|
|
|
|
get "section_management"
|
|
|
|
get "edit_section"
|
|
|
|
patch "update_section"
|
|
|
|
post "delete_section"
|
|
|
|
get "add_section"
|
2021-07-21 07:37:06 +00:00
|
|
|
end
|
|
|
|
collection do
|
|
|
|
post "create_history"
|
|
|
|
patch "create_history"
|
|
|
|
get "timer_management"
|
|
|
|
get "task_management"
|
|
|
|
get "add_task"
|
|
|
|
post "create_task"
|
|
|
|
patch "create_task"
|
2022-04-18 01:01:57 +00:00
|
|
|
get "settings"
|
|
|
|
post "update_setting"
|
|
|
|
patch "update_setting"
|
|
|
|
get "project_management"
|
|
|
|
get "add_project"
|
|
|
|
post "create_project"
|
|
|
|
patch "create_project"
|
|
|
|
post "create_section"
|
|
|
|
patch "create_section"
|
|
|
|
post "save_comment"
|
|
|
|
post "delete_comment"
|
2021-07-21 07:37:06 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
|
|
|
post "/xhr/ruling_timer/start" => "ruling_timers#start"
|
|
|
|
post "/xhr/ruling_timer/stop" => "ruling_timers#stop"
|
|
|
|
post "/xhr/ruling_timer/rest" => "ruling_timers#rest"
|
|
|
|
post "/xhr/ruling_timer/set_summary" => "ruling_timers#set_summary"
|
|
|
|
post "/xhr/ruling_timer/add_task" => "ruling_timers#add_task"
|
|
|
|
post "/xhr/ruling_timer/add_task_from_list" => "ruling_timers#add_task_from_list"
|
|
|
|
post "/xhr/ruling_timer/remove_task" => "ruling_timers#remove_task"
|
|
|
|
post "/xhr/ruling_timer/set_task_status" => "ruling_timers#set_task_status"
|
|
|
|
post "/xhr/ruling_timer/start_task" => "ruling_timers#start_task"
|
|
|
|
post "/xhr/ruling_timer/stop_task" => "ruling_timers#stop_task"
|
|
|
|
post "/xhr/ruling_timer/add_event" => "ruling_timers#add_event"
|
|
|
|
post "/xhr/ruling_timer/delete_event" => "ruling_timers#delete_event"
|
|
|
|
post "/xhr/ruling_timer/get_work_times" => "ruling_timers#get_work_times"
|
|
|
|
post "/xhr/ruling_timer/save_work_times" => "ruling_timers#save_work_times"
|
|
|
|
end
|
|
|
|
end
|