You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/config/routes.rb

721 lines
20 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Rails.application.routes.draw do
require 'sidekiq/web'
require 'admin_constraint'
mount Sidekiq::Web => '/sidekiq', :constraints => AdminConstraint.new
get 'attachments/download/:id', to: 'attachments#show'
resources :edu_settings
scope '/api' do
get 'home/index'
get 'home/search'
get 'search', to: 'searchs#index'
post 'praise_tread/like', to: 'praise_tread#like'
delete 'praise_tread/unlike', to: 'praise_tread#unlike'
put 'commons/hidden', to: 'commons#hidden'
put 'commons/unhidden', to: 'commons#unhidden'
delete 'commons/delete', to: 'commons#delete'
resources :memos
resources :tem_tests
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
#
#
resources :accounts do
collection do
post :login
post :register
post :reset_password
get :logout
get :get_verification_code
get :valid_email_and_phone
end
end
resources :users do
member do
get :homepage_info
end
scope module: :users do
resources :courses, only: [:index]
resources :shixuns, only: [:index]
resources :projects, only: [:index]
resources :subjects, only: [:index]
resources :question_banks, only: [:index]
resource :experience_records, only: [:show]
resource :grade_records, only: [:show]
resource :watch, only: [:create, :destroy]
resources :project_packages, only: [:index]
# 私信
resources :private_messages, only: [:index, :create, :destroy]
resources :recent_contacts, only: [:index]
resource :private_message_details, only: [:show]
resource :unread_message_info, only: [:show]
end
collection do
post :following
post :unfollow
get :get_user_info
get :attachment_show
get :html_show
get :get_navigation_info
post :reply_message
get :search_user_projects
post :brief_introduction
post :attendance
get :system_update
resource :trial_apply, only: [:create]
resources :projects, module: :users, only: [] do
get :search, on: :collection
end
resources :tidings, only: [:index]
scope module: :users do
resource :interest, only: [:create]
resources :accounts, only: [:show, :update] do
resource :phone_bind, only: [:create]
resource :email_bind, only: [:create]
resource :password, only: [:update]
resource :avatar, only: [:update]
resource :auth_attachment, only: [:create]
resource :authentication_apply, only: [:create]
resource :professional_auth_apply, only: [:create]
end
end
end
end
resources :users_for_private_messages, only: [:index]
resources :myshixuns, param: :identifier, shallow: true do
member do
post :repository
post :commits
post :file_content
post :update_file
get :reset_my_game
post :html_content
get :open_webssh
get :challenges
end
collection do
get :sigle_mul_test
match :training_task_status, :via => [:get, :post]
match :code_runinng_message, :via => [:get, :post]
end
resources :games
end
resources :games, path: :tasks, param: :identifier do
member do
get :star
get :git_entries
get :answer
get :answer_grade
get :rep_content
get :reset_original_code
get :reset_passed_code
post :file_update
post :choose_build
get :game_build
get :game_status
post :plus_or_cancel_praise
get :cost_time
get :system_update
get :sync_modify_time
get :picture_display
get :sync_codes
get :close_webssh
get :get_answer_info
get :unlock_answer
get :check_test_sets
get :unlock_choose_answer
get :get_choose_answer
end
collection do
get :challenges
end
end
resources :shixuns, param: :identifier do
collection do
get :menus
get :get_recommend_shixuns
get :departments
get :get_mirror_script
post :apply_shixun_mirror
get :download_file
end
member do
post :copy
get :propaedeutics
get :show_right
get :operation
get :ranking_list
get :discusses
get :tasks
get :collaborators
get :settings
get :get_script_contents
get :get_custom_script
post :repository
post :commits
post :file_content
post :update_file
post :close
get :fork_list
post :update_propaedeutics
get :add_collaborators
post :shixun_members_added
match :change_manager, :via => [:get, :post]
get :search_user_courses
post :send_to_course
delete :collaborators_delete
get :cancel_publish
get :publish
get :shixun_exec
end
resources :challenges do
member do
get 'index_up'
get 'index_down'
post 'create_choose_question'
get 'show_choose_question'
match 'choose_type_show', :via => [:get, :post]
match 'edit_choose_question', :via => [:get, :post]
match 'update_choose_question', :via => [:get, :post]
delete 'destroy_challenge_choose'
post :crud_answer
get :answer
end
end
resources :repositories do
collection do
post :add_project
post :fork_project
post :file_tree # 目录树
post :update_file # 文件更新
post :file_content # 文件内容
post :commits # 提交记录
end
end
end
resources :discusses do
collection do
get :new_message
end
member do
post :reply
post :hidden
post :reward_code
post :plus
end
end
resources :subjects, path: :paths do
member do
get 'choose_subject_shixun'
get 'publish'
get 'cancel_publish'
get 'cancel_has_publish'
get 'statistics'
get 'shixun_report'
get 'school_report'
post 'update_attr'
post :search_members
post 'add_subject_members'
delete 'delete_member'
get :choose_course
post 'send_to_course'
delete :delete_member
post :up_member_position
post :down_member_position
end
collection do
get 'create_subject'
get 'new_subject'
post 'append_to_stage'
get 'search'
end
end
resources :stages do
member do
get 'down_position'
get 'up_position'
end
end
resources :files, only: [:index, :show, :update] do
collection do
delete :bulk_delete
put :bulk_move
post :bulk_send
put :bulk_public
get :public_with_course_and_project
get :mine_with_course_and_project
post :import
post :upload
put :bulk_publish
end
member do
get :histories
end
end
resources :courses do
member do
get 'settings', :action => 'settings', :as => 'settings'
post 'set_invite_code_halt'
post 'set_public_or_private'
post 'search_teacher_candidate'
post 'add_teacher'
post 'create_graduation_group'
post 'join_graduation_group'
post 'set_course_group'
post 'change_course_admin'
post 'change_course_teacher'
post 'delete_course_teacher'
post 'teacher_application_review'
post 'transfer_to_course_group'
post 'delete_from_course'
post 'add_students_by_search'
post 'create_group_by_importing_file'
post 'duplicate_course'
post 'visits_plus_one'
get 'get_historical_courses'
get 'get_historical_course_students'
get 'course_group_list'
get 'add_teacher_popup'
get 'teachers'
get 'apply_teachers'
get 'graduation_group_list'
get 'top_banner'
get 'left_banner'
get 'students'
get 'all_course_groups'
get 'search_users'
get 'base_info'
get 'attahcment_category_list'
get 'export_member_scores_excel' #导出课堂信息
post 'switch_to_teacher'
post 'switch_to_assistant'
post 'switch_to_student'
post 'exit_course'
end
collection do
post 'apply_to_join_course'
post 'search_course_list'
get 'board_list'
get 'mine'
get 'search_slim'
end
resources :polls, only:[:index,:new,:create] do
collection do
post :publish # 立即发布
post :end_poll # 立即截止
post :destroys # 多个删除
post :set_public # 设置公开
post :join_poll_banks # 加入习题集
get :my_polls #我的问卷题库
get :public_polls # 公共问卷题库
get :publish_modal # 立即发布弹窗内容
get :end_poll_modal # 立即截止弹窗内容
end
end
resources :homework_commons, shallow: true do
member do
get :group_list
post :homework_code_repeat
get :code_review_results
get :code_review_detail
post :update_explanation
get :show_comment
get :settings
post :update_settings
match 'works_list', :via => [:get, :post]
# post :works_list
get :reference_answer
get :publish_groups
get :end_groups
post :alter_name
get :update_score
get :update_student_score
end
collection do
post 'create_shixun_homework'
match 'shixuns', via: [:get, :post]
match 'subjects', via: [:get, :post]
post 'create_subject_homework'
post 'publish_homework'
post 'end_homework'
post 'set_public'
post 'move_to_category'
get 'choose_category'
post 'multi_destroy'
post 'add_to_homework_bank'
end
resources :student_works do
member do
get :shixun_work
get :shixun_work_report
post :adjust_review_score
get :commit_des
post :update_des
post :adjust_score
post :add_score
post :add_score_reply
delete :destroy_score
delete :destroy_score_reply
get :comment_list
get :supply_attachments
post :revise_attachment
delete :destroy_score
post :appeal_anonymous_score
post :deal_appeal_score
post :cancel_appeal
get :export_shixun_work_report
end
collection do
get :search_member_list
get :check_project
get :cancel_relate_project
post :relate_project
end
end
end
resources :boards, shallow: true do
resources :messages do
collection do
delete :bulk_delete
put :bulk_move
post :bulk_send
put :bulk_public
end
member do
get :reply_list
put :sticky_top
post :reply
end
end
member do
post 'move_category'
end
end
resources :exercises ,only:[:index,:new,:create] do
collection do
get :my_exercises #我的试卷题库
get :public_exercises # 公共试卷题库
get :publish_modal # 立即发布弹窗内容
get :end_modal # 立即截止弹窗内容
post :destroys
post :set_public # 设置公开
post :join_exercise_banks # 加入习题集
post :publish # 立即发布
post :end_exercise # 立即截止
end
end
resources :course_groups, shallow: true do
member do
post 'rename_group'
post 'move_category'
end
collection do
end
end
resources :graduation_topics do
member do
post :refuse_student_topic
post :accept_student_topic
post :student_select_topic
post :student_cancel_topic
get :show_detail
get :show_comment
end
collection do
delete :destroys
post :set_public
get :export
post :add_to_bank
end
end
resources :graduation_tasks, shallow: true do
resources :graduation_works do
collection do
post 'search_member_list'
get 'check_project'
post 'relate_project'
get 'cancel_relate_project'
post 'revise_attachment'
end
member do
get 'comment_list'
post 'add_score'
post 'adjust_score'
delete 'delete_score'
get 'supply_attachments'
post 'revise_attachment'
post :assign_teacher
end
end
member do
get 'settings'
post 'update_settings'
get 'tasks_list'
get :show_comment
end
collection do
post 'set_public'
delete 'multi_destroy'
post 'publish_task'
post 'end_task'
post 'add_to_bank'
end
end
end
resources :polls,except:[:index,:new,:create] do
member do
get :poll_setting
post :commit_setting
get :start_answer
post :commit_poll
get :commit_result
get :poll_lists # 问卷的答题列表
post :cancel_publish #撤销发布
get :cancel_publish_modal #撤销发布的弹窗
get :common_header
end
resources :poll_questions,only:[:new,:create]
end
resources :poll_questions,except:[:new,:create,:index] do
member do
post :delete_answer
post :up_down
post :commit_answer
end
resource :poll_votes,only:[:create,:destroy]
end
resources :question_banks do
collection do
get :bank_list
post :save_banks
end
end
resources :exercises do
member do
get :choose_shixun
get :commit_shixun
get :exercise_setting
post :commit_setting
get :start_answer
post :commit_exercise
get :redo_modal #打回重做弹窗内容
post :redo_exercise
get :review_exercise
get :exercise_lists
# get :blank_exercise #摒弃仅作为测试html页面才会使用
get :export_exercise
get :common_header
get :exercise_result
post :cancel_exercise
get :begin_commit #提交前的弹窗
end
resources :exercise_questions,only:[:new,:create,:index]
end
resources :exercise_questions,except:[:new,:create,:index] do
member do
post :up_down
post :delete_answer
post :adjust_score
end
resource :exercise_answers,only:[:create,:destroy]
end
resources :course_modules, shallow: true do
member do
get 'sticky_module'
get 'hidden_module'
post 'rename_module'
post 'add_second_category'
end
collection do
post 'unhidden_modules'
end
end
resources :course_second_categories, shallow: true do
member do
post 'rename_category'
post 'move_category'
end
collection do
end
end
resources :attachments
resources :schools do
member do
resources :departments, only: [] do
get :for_option, on: :collection
end
end
collection do
get :school_list
get :for_option
end
scope module: :ecs do
get :detail, to: 'homes#index'
resources :ec_majors, only: [:index]
resources :ec_major_schools, only: [:index, :create, :destroy]
end
end
resources :add_school_applies, only: [:create]
resources :add_department_applies, only: [:create]
# 为避免url过长以及层级过深路由定义和controller继承都做了处理
scope module: :ecs do
resources :ec_major_schools, only: [] do
resources :major_managers, only: [:create, :destroy]
resources :ec_years, only: [:index, :create, :destroy]
end
resources :ec_years, only: [] do
resource :ec_training_objectives, only: [:show, :create]
resources :ec_graduation_requirements, only: [:index, :create]
resource :requirement_support_objectives, only: [:show, :create, :destroy]
resource :subitem_support_standards, only: [:show, :create, :destroy]
resource :students, only: [:show, :destroy] do
post :import, on: :collection
end
resources :ec_courses, only: [:index, :create, :destroy] do
post :link_course, on: :member
collection do
post :import
get :search
end
end
resource :graduation_course_supports, only: [:show, :create]
resource :reach_evaluation, only: [:show, :create]
resource :reach_criteria, only: [:create]
end
resources :ec_courses, only: [] do
resource :evaluation, only: [:show, :create]
resources :course_managers, only: [:create, :destroy]
resources :course_targets, only: [:index, :create] do
get :with_achievement_methods, on: :collection
resource :course_achievement_methods, only: [:create]
end
resources :course_evaluations, only: [:index, :create, :update, :destroy] do
member do
get :average_score_import_template
get :detail_score_import_template
get :import_student_achievement
end
get :slimmer, on: :collection
end
resource :score_levels, only: [:show, :create]
end
end
resource :zip, only: [] do
collection do
get :shixun_report
get :export_exercises
end
end
resources :repertoires, only: [:index]
scope module: :competitions do
resources :competitions, only: [:index, :show] do
resources :competition_modules, only: [:index, :show, :update]
resource :competition_staff
resources :competition_teams, only: [:index, :show] do
post :join, on: :collection
post :leave, on: :member
end
resources :teachers, only: [:index]
resources :students, only: [:index]
end
end
resources :project_package_categories, only: [:index]
resources :project_packages, only: [:index, :show, :create, :update, :destroy] do
resources :bidding_users, only: [:create] do
post :win, on: :collection
end
end
resources :libraries, only: [:index, :show, :create, :update, :destroy]
scope module: :projects do
resources :applied_projects, only: [:create]
end
end
#git 认证回调
match 'gitauth/*url', to: 'gits#auth', via: :all
get 'oauth/get_code', to: 'oauth#get_code'
get 'oauth/get_token_callback', to: 'oauth#get_token_callback'
root 'main#index'
## react用
get '*path', to: 'main#index', constraints: ReactConstraint.new
end