作业动态添加子菜单:公开作品/取消公开
This commit is contained in:
parent
5d5fcda475
commit
c93b4d109a
|
@ -6,8 +6,8 @@ class HomeworkCommonController < ApplicationController
|
|||
|
||||
include StudentWorkHelper
|
||||
before_filter :find_course, :only => [:index,:new,:create]
|
||||
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment]
|
||||
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment]
|
||||
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
|
||||
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
|
||||
before_filter :member_of_course, :only => [:index]
|
||||
|
||||
def index
|
||||
|
@ -261,6 +261,30 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def open_student_works
|
||||
if @homework.is_open == 0
|
||||
@homework.update_attribute(:is_open, 1)
|
||||
else
|
||||
@homework.update_attribute(:is_open, 0)
|
||||
end
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@is_in_course = params[:is_in_course] if params[:is_in_course]
|
||||
@course_activity = params[:course_activity] if params[:course_Activity]
|
||||
end
|
||||
|
||||
def alert_open_student_works
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@is_in_course = params[:is_in_course] if params[:is_in_course]
|
||||
@course_activity = params[:course_activity] if params[:course_Activity]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def programing_test
|
||||
test = {language:params[:language],src:Base64.encode64(params[:src]),input:[params[:input]],output:[params[:output]]}
|
||||
@index = params[:index]
|
||||
|
|
|
@ -6,9 +6,10 @@ class StudentWorkController < ApplicationController
|
|||
require "base64"
|
||||
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students]
|
||||
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment]
|
||||
before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
|
||||
before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work]
|
||||
before_filter :author_of_work, :only => [:edit, :update, :destroy]
|
||||
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment]
|
||||
before_filter :is_logged, :only => [:index]
|
||||
|
||||
###
|
||||
def program_test
|
||||
|
@ -91,101 +92,119 @@ class StudentWorkController < ApplicationController
|
|||
student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')'
|
||||
end
|
||||
#老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
|
||||
if @is_teacher || @homework.homework_detail_manual.nil? ||
|
||||
(@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
|
||||
if @homework.is_open == 1
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
end
|
||||
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
||||
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
elsif @homework.is_open == 0 && User.current.member_of_course?(@course) || User.current.admin?
|
||||
if @is_teacher || @homework.homework_detail_manual.nil? ||
|
||||
(@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
end
|
||||
else
|
||||
@stundet_works = []
|
||||
end
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
|
||||
else
|
||||
if @is_teacher || @homework.homework_detail_manual.nil? || (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) #老师 || 超级管理员 显示所有列表
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
end
|
||||
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
||||
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
end
|
||||
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
||||
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
end
|
||||
else
|
||||
@stundet_works = []
|
||||
render_403
|
||||
return
|
||||
end
|
||||
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
|
||||
else
|
||||
if @homework.is_open == 1
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
elsif @homework.is_open == 0 && User.current.member_of_course?(@course) || User.current.admin?
|
||||
if @is_teacher || @homework.homework_detail_manual.nil? || (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) #老师 || 超级管理员 显示所有列表
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
end
|
||||
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
||||
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
end
|
||||
else
|
||||
@stundet_works = []
|
||||
end
|
||||
else
|
||||
render_403
|
||||
return
|
||||
end
|
||||
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name).count
|
||||
end
|
||||
|
||||
|
@ -802,6 +821,10 @@ class StudentWorkController < ApplicationController
|
|||
render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
end
|
||||
|
||||
def is_logged
|
||||
redirect_to signin_path unless User.current.logged?
|
||||
end
|
||||
|
||||
#根据条件过滤作业结果
|
||||
def search_homework_member homeworks,name
|
||||
if name == ""
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<div id="popbox02">
|
||||
<div class="ni_con">
|
||||
<% if @homework.is_open == 0 %>
|
||||
<h2>公开作品</h2>
|
||||
<p>
|
||||
本次作业的所有作品将对Trustie平台所有注册用户开放,请问是否确定公开作品?
|
||||
</p>
|
||||
<% else %>
|
||||
<h2>取消公开作品</h2>
|
||||
<p>
|
||||
您将取消“公开作品”的功能,本次作业的作品将不对Trustie平台其他未加入本课程的用户开放,请问是否确定?
|
||||
</p>
|
||||
<% end %>
|
||||
<div class="ni_btn">
|
||||
<a href="javascript:" class="tijiao" onclick="clickOK('<%= open_student_works_homework_common_path(@homework, :user_activity_id => @user_activity_id,:is_in_course=>@is_in_course, :course_activity => @course_activity)%>');" style="margin-bottom: 20px;" >
|
||||
确 定
|
||||
</a>
|
||||
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">
|
||||
取 消
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,6 @@
|
|||
$("#ajax-modal").html("<%=escape_javascript(render :partial => 'alert_open_student_works') %>");
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9");
|
|
@ -0,0 +1,7 @@
|
|||
<% if @user_activity_id.to_i == -1 %>
|
||||
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
|
||||
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
|
||||
<% else %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
|
||||
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
|
||||
<% end %>
|
|
@ -240,6 +240,15 @@
|
|||
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
|
||||
<li>
|
||||
<%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% elsif activity.is_open == 1 %>
|
||||
<li>
|
||||
<%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -4,15 +4,16 @@
|
|||
<font class="f12 c_red">
|
||||
(<%= @student_work_count%>人已交)
|
||||
</font>
|
||||
<% if !@is_teacher && @stundet_works.empty?%>
|
||||
<% my_work = @homework.student_works.where("user_id = #{User.current.id}").first %>
|
||||
<% if !@is_teacher && my_work.nil? && User.current.member_of_course?(@course) %>
|
||||
<span class="f12 c_red">您尚未提交作品</span>
|
||||
<% elsif !@is_teacher &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<span class="f12 c_red">您已提交且不可再修改,因为截止日期已过</span>
|
||||
<% elsif !@is_teacher &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<span class="f12 c_red">您已提交,您还可以修改</span>
|
||||
<% end %>
|
||||
</span>
|
||||
<%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%>
|
||||
<%if @is_teacher || @homework.homework_detail_manual.comment_status == 3 || @homework.is_open == 1%>
|
||||
<div class="hworkSearchBox">
|
||||
<input type="text" id="course_student_name" value="<%= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%= student_work_index_path(:homework => @homework.id)%>',event);"/>
|
||||
<a class="hworkSearchIcon" id="search_in_student_work" onclick="SearchByName_1('<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)"></a>
|
||||
|
|
|
@ -239,6 +239,15 @@
|
|||
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
|
||||
<li>
|
||||
<%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% elsif activity.is_open == 1 %>
|
||||
<li>
|
||||
<%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -243,6 +243,15 @@
|
|||
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if (homework_common.anonymous_comment == 1 && homework_common.is_open == 0) || (homework_common.anonymous_comment == 0 && comment_status == 3 && homework_common.is_open == 0) %>
|
||||
<li>
|
||||
<%= link_to("公开作品", alert_open_student_works_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=> -1),:class => "postOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% elsif homework_common.is_open == 1 %>
|
||||
<li>
|
||||
<%= link_to("取消公开", alert_open_student_works_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=> -1),:class => "postOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -238,6 +238,8 @@ RedmineApp::Application.routes.draw do
|
|||
get 'stop_anonymous_comment'
|
||||
get 'alert_anonymous_comment'
|
||||
get 'alert_forbidden_anonymous_comment'
|
||||
get 'alert_open_student_works'
|
||||
get 'open_student_works'
|
||||
get 'start_evaluation_set'
|
||||
get 'score_rule_set'
|
||||
post 'set_evaluation_attr'
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddIsOpenToHomewrokCommon < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :homework_commons, :is_open, :integer, :default => 0
|
||||
end
|
||||
end
|
15
db/schema.rb
15
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160224074034) do
|
||||
ActiveRecord::Schema.define(:version => 20160225024759) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -99,8 +99,6 @@ ActiveRecord::Schema.define(:version => 20160224074034) do
|
|||
t.integer "quotes"
|
||||
t.integer "version"
|
||||
t.integer "attachment_id"
|
||||
t.integer "is_publish", :default => 1
|
||||
t.date "publish_time"
|
||||
end
|
||||
|
||||
create_table "attachments", :force => true do |t|
|
||||
|
@ -751,6 +749,14 @@ ActiveRecord::Schema.define(:version => 20160224074034) do
|
|||
t.integer "locked"
|
||||
end
|
||||
|
||||
create_table "forwards", :force => true do |t|
|
||||
t.integer "from_id"
|
||||
t.string "from_type"
|
||||
t.integer "to_id"
|
||||
t.string "to_type"
|
||||
t.datetime "created_at"
|
||||
end
|
||||
|
||||
create_table "groups_users", :id => false, :force => true do |t|
|
||||
t.integer "group_id", :null => false
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -788,6 +794,7 @@ ActiveRecord::Schema.define(:version => 20160224074034) do
|
|||
t.integer "teacher_priority", :default => 1
|
||||
t.integer "anonymous_comment", :default => 0
|
||||
t.integer "quotes", :default => 0
|
||||
t.integer "is_open", :default => 0
|
||||
end
|
||||
|
||||
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
|
||||
|
@ -1269,6 +1276,7 @@ ActiveRecord::Schema.define(:version => 20160224074034) do
|
|||
t.text "description"
|
||||
t.integer "creator_id"
|
||||
t.integer "home_id"
|
||||
t.string "domain"
|
||||
t.boolean "is_public"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
|
@ -1376,6 +1384,7 @@ ActiveRecord::Schema.define(:version => 20160224074034) do
|
|||
t.integer "changeset_num", :default => 0
|
||||
t.integer "board_message_num", :default => 0
|
||||
t.integer "board_num", :default => 0
|
||||
t.integer "act_num", :default => 0
|
||||
t.integer "attach_num", :default => 0
|
||||
t.datetime "commit_time"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue