|
|
|
@ -35,7 +35,7 @@ class HomeworkAttachController < ApplicationController
|
|
|
|
|
|
|
|
|
|
#作业添加成员(参与人员)
|
|
|
|
|
def add_homework_users
|
|
|
|
|
if User.current.admin? || User.current == @homework.user
|
|
|
|
|
if User.current.admin? || User.current.member_of?(@homework.bid.courses.first)
|
|
|
|
|
#@homework = HomeworkAttach.find(params[:id])
|
|
|
|
|
if params[:membership]
|
|
|
|
|
if params[:membership][:user_ids]
|
|
|
|
@ -59,7 +59,7 @@ class HomeworkAttachController < ApplicationController
|
|
|
|
|
#作业删除成员(参与人员)
|
|
|
|
|
def destory_homework_users
|
|
|
|
|
#@homework = HomeworkAttach.find(params[:id])
|
|
|
|
|
if User.current.admin? || User.current == @homework.user
|
|
|
|
|
if User.current.admin? || User.current.member_of?(@homework.bid.courses.first)
|
|
|
|
|
homework_user = @homework.homework_users.where("user_id = #{params[:user_id]}").first
|
|
|
|
|
homework_user.destroy
|
|
|
|
|
get_homework_member @homework
|
|
|
|
@ -196,7 +196,7 @@ class HomeworkAttachController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
|
#@homework = HomeworkAttach.find(params[:id])
|
|
|
|
|
if User.current.admin? || User.current.member_of?(@homework.bid.courses.first)
|
|
|
|
|
if User.current.admin? || User.current == @homework
|
|
|
|
|
if @homework.destroy
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.html { redirect_to project_for_bid_path @homework.bid }
|
|
|
|
|