diff --git a/app/controllers/departments_controller.rb b/app/controllers/departments_controller.rb index b6ebcb2ef..5e82b2c51 100644 --- a/app/controllers/departments_controller.rb +++ b/app/controllers/departments_controller.rb @@ -1,6 +1,6 @@ class DepartmentsController < ApplicationController def for_option - render_ok(departments: current_school.departments.select(:id, :name).as_json) + render_ok(departments: current_school.departments.without_deleted.select(:id, :name).as_json) end private diff --git a/app/models/department.rb b/app/models/department.rb index 15a8a7c1b..9c4a0908b 100644 --- a/app/models/department.rb +++ b/app/models/department.rb @@ -2,4 +2,6 @@ class Department < ApplicationRecord belongs_to :school has_many :department_members, dependent: :destroy + + scope :without_deleted, -> { where(is_delete: false) } end diff --git a/config/routes.rb b/config/routes.rb index bb5bc49cc..6024201a4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,6 +4,8 @@ Rails.application.routes.draw do 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' diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index e382625b0..a54f5a6e2 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -218,6 +218,20 @@ class Testpapersettinghomepage extends Component{ // DownloadMessageval:undefined // }) // } + goback=()=>{ + // let {datalist}=this.state; + // let courseId=this.props.match.params.coursesId; + // let category_id=this.props.match.params.category_id; + // + // window.location.href="/courses/"+courseId+"/graduation_tasks/"+datalist.graduation_id; + let courseId=this.props.match.params.coursesId; + if(courseId===undefined){ + this.props.history.push("/courses"); + }else{ + this.props.history.push(this.props.current_user.first_category_url); + } + + } render(){ let {tab,visible,Commonheadofthetestpaper}=this.state; const isAdmin =this.props.isAdmin(); @@ -251,7 +265,7 @@ class Testpapersettinghomepage extends Component{
-
- {datalist&&datalist.course_name} + {datalist&&datalist.course_name} > {datalist&&datalist.graduation_name} > diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index 0099c8615..cbcdd1533 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -108,6 +108,16 @@ class PollDetailIndex extends Component{ DownloadMessageval:undefined }) } + goback=()=>{ + + let courseId=this.props.match.params.coursesId; + if(courseId===undefined){ + this.props.history.push("/courses"); + }else{ + this.props.history.push(this.props.current_user.first_category_url); + } + + } render(){ let {tab,pollDetail,user_permission}=this.state; @@ -123,7 +133,7 @@ class PollDetailIndex extends Component{ />
-
-