作业动态的重构

This commit is contained in:
cxt 2016-09-19 17:14:14 +08:00
parent 6809085215
commit ba4a1c64d9
41 changed files with 149 additions and 235 deletions

View File

@ -58,10 +58,9 @@ class HomeworkCommonController < ApplicationController
def edit def edit
@user = User.current @user = User.current
@is_in_course = params[:is_in_course] @hw_status = params[:hw_status].to_i
@is_manage = params[:is_manage] @is_manage = params[:is_manage]
@course_activity = params[:course_activity].to_i if @hw_status != 1
if @is_in_course.to_i == 1 || @course_activity == 1
@left_nav_type = 3 @left_nav_type = 3
respond_to do |format| respond_to do |format|
format.html{render :layout => 'base_courses'} format.html{render :layout => 'base_courses'}
@ -160,18 +159,17 @@ class HomeworkCommonController < ApplicationController
create_works_list @homework create_works_list @homework
end end
@hw_status = params[:hw_status].to_i
if params[:is_manage] == "1" if params[:is_manage] == "1"
redirect_to manage_or_receive_homeworks_user_path(User.current.id) redirect_to manage_or_receive_homeworks_user_path(User.current.id)
elsif params[:is_manage] == "2" elsif params[:is_manage] == "2"
redirect_to my_homeworks_user_path(User.current.id) redirect_to my_homeworks_user_path(User.current.id)
elsif params[:is_in_course] == "1" elsif @hw_status == 1
redirect_to homework_common_index_path(:course => @course.id)
elsif params[:is_in_course] == "0"
redirect_to user_homeworks_user_path(User.current.id)
elsif params[:is_in_course] == "-1" && params[:course_activity] == "0"
redirect_to user_path(User.current.id) redirect_to user_path(User.current.id)
elsif params[:is_in_course] == "-1" && params[:course_activity] == "1" elsif @hw_status == 2
redirect_to course_path(@course.id) redirect_to course_path(@course.id)
else
redirect_to homework_common_index_path(:course => @course.id)
end end
end end
end end
@ -181,14 +179,13 @@ class HomeworkCommonController < ApplicationController
if @homework.destroy if @homework.destroy
respond_to do |format| respond_to do |format|
format.html { format.html {
if params[:is_in_course] == "1" @hw_status = params[:hw_status].to_i
redirect_to homework_common_index_path(:course => @course.id) if @hw_status == 1
elsif params[:is_in_course] == "0" redirect_to user_path(User.current.id)
redirect_to user_homeworks_user_path(User.current.id) elsif @hw_status == 2
elsif params[:is_in_course] == "-1" && params[:course_activity] == "0" redirect_to course_path(@course.id)
redirect_to user_path(User.current.id) else
elsif params[:is_in_course] == "-1" && params[:course_activity] == "1" redirect_to homework_common_index_path(:course => @course.id)
redirect_to course_path(@course.id)
end end
} }
end end
@ -246,8 +243,7 @@ class HomeworkCommonController < ApplicationController
@statue = 3 @statue = 3
end end
@user_activity_id = params[:user_activity_id].to_i @user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
end end
#关闭匿评 #关闭匿评
@ -265,8 +261,7 @@ class HomeworkCommonController < ApplicationController
send_message_anonymous_comment(@homework, m_status = 3) send_message_anonymous_comment(@homework, m_status = 3)
Mailer.send_mail_anonymous_comment_close(@homework).deliver Mailer.send_mail_anonymous_comment_close(@homework).deliver
@user_activity_id = params[:user_activity_id].to_i @user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -294,8 +289,7 @@ class HomeworkCommonController < ApplicationController
end end
@percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100) @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
@user_activity_id = params[:user_activity_id].to_i @user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -307,8 +301,7 @@ class HomeworkCommonController < ApplicationController
else else
@user_activity_id = -1 @user_activity_id = -1
end end
@is_in_course = params[:is_in_course] if params[:is_in_course] @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity] if params[:course_Activity]
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -321,8 +314,7 @@ class HomeworkCommonController < ApplicationController
@homework.update_column('is_open', 0) @homework.update_column('is_open', 0)
end end
@user_activity_id = params[:user_activity_id] @user_activity_id = params[:user_activity_id]
@is_in_course = params[:is_in_course] if params[:is_in_course] @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity] if params[:course_Activity]
end end
def alert_open_student_works def alert_open_student_works
@ -331,8 +323,7 @@ class HomeworkCommonController < ApplicationController
else else
@user_activity_id = -1 @user_activity_id = -1
end end
@is_in_course = params[:is_in_course] if params[:is_in_course] @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity] if params[:course_Activity]
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -363,8 +354,7 @@ class HomeworkCommonController < ApplicationController
else else
@user_activity_id = -1 @user_activity_id = -1
end end
@is_in_course = params[:is_in_course] @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
end end
#设置匿评参数 #设置匿评参数
@ -381,8 +371,7 @@ class HomeworkCommonController < ApplicationController
@homework_detail_manual.evaluation_num = params[:evaluation_num] @homework_detail_manual.evaluation_num = params[:evaluation_num]
@homework_detail_manual.save @homework_detail_manual.save
@user_activity_id = params[:user_activity_id].to_i @user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
end end
end end
@ -393,8 +382,7 @@ class HomeworkCommonController < ApplicationController
else else
@user_activity_id = -1 @user_activity_id = -1
end end
@is_in_course = params[:is_in_course] @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
end end
private private

View File

@ -1012,8 +1012,7 @@ class StudentWorkController < ApplicationController
redirect_to student_work_index_url(:homework => @homework.id) redirect_to student_work_index_url(:homework => @homework.id)
else else
@user_activity_id = params[:user_activity_id].to_i @user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -1035,8 +1034,7 @@ class StudentWorkController < ApplicationController
student_work.save student_work.save
end end
@user_activity_id = params[:user_activity_id].to_i @user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
end end
def revise_attachment def revise_attachment
@ -1058,8 +1056,7 @@ class StudentWorkController < ApplicationController
def new_student_work_project def new_student_work_project
@user_activity_id = params[:user_activity_id].to_i @user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -1078,8 +1075,7 @@ class StudentWorkController < ApplicationController
@project.is_leader = 1 @project.is_leader = 1
if @project.save if @project.save
@user_activity_id = params[:user_activity_id].to_i @user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -1129,8 +1125,7 @@ class StudentWorkController < ApplicationController
relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first
if relate_pro.destroy if relate_pro.destroy
@user_activity_id = params[:user_activity_id].to_i @user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
respond_to do |format| respond_to do |format|
format.js format.js
end end

View File

@ -115,8 +115,7 @@ class UsersController < ApplicationController
else else
@user_activity_id = -1 @user_activity_id = -1
end end
@is_in_course = params[:is_in_course].to_i @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
when 'JournalsForMessage' when 'JournalsForMessage'
@reply = JournalsForMessage.find params[:reply_id] @reply = JournalsForMessage.find params[:reply_id]
@user_activity_id = params[:user_activity_id] @user_activity_id = params[:user_activity_id]
@ -1123,11 +1122,8 @@ class UsersController < ApplicationController
quotes_homework = HomeworkCommon.find params[:quotes].to_i quotes_homework = HomeworkCommon.find params[:quotes].to_i
quotes_homework.update_column(:quotes, quotes_homework.quotes+1) quotes_homework.update_column(:quotes, quotes_homework.quotes+1)
end end
if params[:is_in_course] == "1"
redirect_to homework_common_index_path(:course => homework.course_id) redirect_to homework_common_index_path(:course => homework.course_id)
else
redirect_to user_homeworks_user_path(User.current.id)
end
end end
end end
else else
@ -3573,8 +3569,7 @@ class UsersController < ApplicationController
obj = HomeworkCommon.where('id = ?', params[:id].to_i).first obj = HomeworkCommon.where('id = ?', params[:id].to_i).first
@type = 'HomeworkCommon' @type = 'HomeworkCommon'
@journals = obj.journals_for_messages.reorder("created_on desc") @journals = obj.journals_for_messages.reorder("created_on desc")
@is_in_course = params[:is_in_course].to_i if params[:is_in_course] @hw_status = params[:hw_status].to_i if params[:hw_status]
@course_activity = params[:course_activity].to_i if params[:course_activity]
@is_teacher = User.current.allowed_to?(:as_teacher,obj.course) @is_teacher = User.current.allowed_to?(:as_teacher,obj.course)
@user_activity_id = params[:user_activity_id].to_i if params[:user_activity_id] @user_activity_id = params[:user_activity_id].to_i if params[:user_activity_id]
end end

View File

@ -110,8 +110,7 @@ class WordsController < ApplicationController
else else
@user_activity_id = -1 @user_activity_id = -1
end end
@is_in_course = params[:is_in_course].to_i @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
elsif @journal_destroyed.jour_type == 'Syllabus' elsif @journal_destroyed.jour_type == 'Syllabus'
@syllabus = Syllabus.find @journal_destroyed.jour_id @syllabus = Syllabus.find @journal_destroyed.jour_id
@count = @syllabus.journals_for_messages.count @count = @syllabus.journals_for_messages.count
@ -308,9 +307,8 @@ class WordsController < ApplicationController
update_org_activity(@homework_common.class,@homework_common.id) update_org_activity(@homework_common.class,@homework_common.id)
respond_to do |format| respond_to do |format|
format.js{ format.js{
@user_activity_id = params[:user_activity_id] @user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course] @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity]
@homework_common_id = params[:homework_common_id] @homework_common_id = params[:homework_common_id]
} }
end end
@ -344,8 +342,7 @@ class WordsController < ApplicationController
respond_to do |format| respond_to do |format|
format.js{ format.js{
@user_activity_id = params[:user_activity_id].to_i @user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i @hw_status = params[:hw_status].to_i
@course_activity = params[:course_activity].to_i
} }
end end
else else

View File

@ -2689,15 +2689,15 @@ module ApplicationHelper
end end
#获取匿评相关连接代码 #获取匿评相关连接代码
def homework_anonymous_comment (homework, is_in_course, user_activity_id = -1, course_activity = -1) def homework_anonymous_comment (homework, hw_status, user_activity_id = -1)
if homework.homework_detail_manual.comment_status == 0 ||Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") if homework.homework_detail_manual.comment_status == 0 ||Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评" link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评"
elsif homework.student_works.has_committed.count >= 2 && homework.homework_detail_manual#作业份数大于2 elsif homework.student_works.has_committed.count >= 2 && homework.homework_detail_manual#作业份数大于2
case homework.homework_detail_manual.comment_status case homework.homework_detail_manual.comment_status
when 1 when 1
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink' link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
when 2 when 2
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink' link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
when 3 when 3
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束" # link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
end end

View File

@ -57,12 +57,12 @@ module HomeworkCommonHelper
end end
#根据传入作业确定跳转到开启匿评还是关闭匿评功能 #根据传入作业确定跳转到开启匿评还是关闭匿评功能
def alert_anonyoms_path homework,homework_detail_manual,user_activity_id,is_in_course,course_activity def alert_anonyoms_path homework,homework_detail_manual,user_activity_id,hw_status
link = "" link = ""
if homework_detail_manual.comment_status == 1 if homework_detail_manual.comment_status == 1
link = start_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity link = start_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:hw_status=>hw_status
elsif homework_detail_manual.comment_status == 2 elsif homework_detail_manual.comment_status == 2
link = stop_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity link = stop_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:hw_status=>hw_status
end end
link link
end end

View File

@ -60,7 +60,7 @@
<% act = activity.course_act %> <% act = activity.course_act %>
<% case activity.course_act_type.to_s %> <% case activity.course_act_type.to_s %>
<% when 'HomeworkCommon' %> <% when 'HomeworkCommon' %>
<%= render :partial => 'users/course_homework', :locals => {:activity => act, :user_activity_id => activity.id, :course_activity => 1} %> <%= render :partial => 'users/course_homework', :locals => {:activity => act, :user_activity_id => activity.id, :hw_status => 2} %>
<% when 'News' %> <% when 'News' %>
<%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id} %> <%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id} %>
<% when 'Message' %> <% when 'Message' %>

View File

@ -26,7 +26,7 @@
} }
} }
</script> </script>
<%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %> <%= render :partial => 'users/course_homework', :locals => {:activity => homework_common,:user_activity_id => homework_common.id, :hw_status => 3} %>
<% end%> <% end%>
<% if homework_commons.count == 10%> <% if homework_commons.count == 10%>
<%= link_to "点击展开更多",homework_search_course_path(course_id,:page => page,:search=>search),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%> <%= link_to "点击展开更多",homework_search_course_path(course_id,:page => page,:search=>search),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>

View File

@ -1,5 +1,5 @@
<% if @page == 0 %> <% if @page == 0 %>
$("#user_homework_list").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>"); $("#user_homework_list").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :course_id => @course.id,:search=>@search} )%>");
<% else %> <% else %>
$("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>"); $("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :course_id => @course.id,:search=>@search} )%>");
<% end %> <% end %>

View File

@ -32,7 +32,7 @@
</p> </p>
<% end %> <% end %>
<div class="ni_btn"> <div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="clickOK('<%= alert_anonyoms_path @homework,@homework_detail_manual,@user_activity_id,@is_in_course,@course_activity%>');" style="margin-bottom: 20px;" > <a href="javascript:" class="tijiao" onclick="clickOK('<%= alert_anonyoms_path @homework,@homework_detail_manual,@user_activity_id,@hw_status%>');" style="margin-bottom: 20px;" >
确&nbsp;&nbsp;定 确&nbsp;&nbsp;定
</a> </a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;"> <a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">

View File

@ -22,7 +22,7 @@
</p> </p>
<% end %> <% end %>
<div class="ni_btn"> <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 href="javascript:" class="tijiao" onclick="clickOK('<%= open_student_works_homework_common_path(@homework, :user_activity_id => @user_activity_id,:hw_status=>@hw_status)%>');" style="margin-bottom: 20px;" >
确&nbsp;&nbsp;定 确&nbsp;&nbsp;定
</a> </a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;"> <a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">

View File

@ -1,4 +1,4 @@
<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => homework_commons,:page => 0,:is_in_course => 1,:course_id => course_id} %> <%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => homework_commons,:page => 0,:course_id => course_id} %>
<div style="width:210px; text-align:center; margin:0 auto;"> <div style="width:210px; text-align:center; margin:0 auto;">
<ul class="wlist" style=" border:none; display:inline-block; float:none; margin-top:10px;"> <ul class="wlist" style=" border:none; display:inline-block; float:none; margin-top:10px;">

View File

@ -1,5 +1,5 @@
<div class="markPopup" id="popbox02"> <div class="markPopup" id="popbox02">
<%= form_for('new_form',:url => {:controller => 'homework_common',:action => 'set_evaluation_attr',:homework => @homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity},:method => "post",:remote => true) do |f|%> <%= form_for('new_form',:url => {:controller => 'homework_common',:action => 'set_evaluation_attr',:homework => @homework.id,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post",:remote => true) do |f|%>
<span class="uploadText">匿评设置</span> <span class="uploadText">匿评设置</span>
<div class="cl"></div> <div class="cl"></div>

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity => @course_activity}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>');
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +

View File

@ -1,5 +1,5 @@
<script type="text/javascript"> <script type="text/javascript">
<% if @is_in_course.to_i == 1 || @course_activity == 1 %> <% if @hw_status != 1 %>
$(function(){ $(function(){
$("#RSide").removeAttr("id"); $("#RSide").removeAttr("id");
$("#Container").css("width","1000px"); $("#Container").css("width","1000px");
@ -23,18 +23,16 @@
window.location.href='<%=manage_or_receive_homeworks_user_path(User.current.id) %>'; window.location.href='<%=manage_or_receive_homeworks_user_path(User.current.id) %>';
<% elsif @is_manage.to_i == 2 %> <% elsif @is_manage.to_i == 2 %>
window.location.href='<%=my_homeworks_user_path(User.current.id) %>'; window.location.href='<%=my_homeworks_user_path(User.current.id) %>';
<% elsif @is_in_course.to_i == 1 %> <% elsif @hw_status == 3 %>
window.location.href='<%=homework_common_index_path(:course => @course.id) %>'; window.location.href='<%=homework_common_index_path(:course => @course.id) %>';
<% elsif @is_in_course.to_i == 0 %> <% elsif @hw_status == 1 %>
window.location.href='<%=user_homeworks_user_path(User.current.id) %>';
<% elsif @is_in_course.to_i == -1 && @course_activity == 0 %>
window.location.href='<%=user_path(User.current.id) %>'; window.location.href='<%=user_path(User.current.id) %>';
<% elsif @is_in_course.to_i == -1 && @course_activity == 1 %> <% elsif @hw_status == 2 %>
window.location.href='<%=course_path(@course.id) %>'; window.location.href='<%=course_path(@course.id) %>';
<% end %> <% end %>
} }
</script> </script>
<div class="homepageRightBanner mb10 <%= (@is_in_course == 1 || @course_activity == 1) ? 'ml10' : '' %>"> <div class="homepageRightBanner mb10 <%= (@hw_status == 2 || @hw_status == 3 || @hw_status == 5) ? 'ml10' : '' %>">
<div class="NewsBannerName">编辑作业</div> <div class="NewsBannerName">编辑作业</div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
@ -56,8 +54,7 @@
<% end %> <% end %>
<%= form_for @homework do |f| %> <%= form_for @homework do |f| %>
<input type="text" name="is_in_course" class="none" value="<%= @is_in_course%>"/> <input type="text" name="hw_status" class="none" value="<%= @hw_status%>"/>
<input type="text" name="course_activity" class="none" value="<%= @course_activity%>"/>
<input type="text" name="is_manage" class="none" value="<%= @is_manage%>"/> <input type="text" name="is_manage" class="none" value="<%= @is_manage%>"/>
<div id="HomeWorkCon"> <div id="HomeWorkCon">
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> <%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>

View File

@ -1,7 +1,6 @@
<% if @user_activity_id.to_i == -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); <% if @user_activity_id != @homework.id %>
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"); sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %> <% end %>

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity =>@course_activity,:remote=>true}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>');
showModal('ajax-modal', '350px'); showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +

View File

@ -1,8 +1,7 @@
clickCanel(); clickCanel();
<% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>"); <% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %> <% else %>
$("#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%>"); sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %> <% end %>

View File

@ -1,13 +1,11 @@
<% if @statue == 1%> <% if @statue == 1%>
alert('启动成功'); alert('启动成功');
<% if @user_activity_id == -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); $("#evaluation_start_time_<%=@user_activity_id %>").html("匿评开启时间:<%=format_time(Time.now) %>");
$("#evaluation_start_time_<%=@homework.id %>").html("匿评开启时间:<%=format_time(Time.now) %>"); <% if @user_activity_id != @homework.id %>
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}) %>");
$("#evaluation_start_time_<%=@user_activity_id %>").html("匿评开启时间:<%=format_time(Time.now) %>");
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %> <% end %>
/*$("#<%#= @homework.id %>_start_anonymous_comment").replaceWith('<%#= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>');*/ /*$("#<%#= @homework.id %>_start_anonymous_comment").replaceWith('<%#= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>');*/
<% elsif @statue == 2 %> <% elsif @statue == 2 %>

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity =>@course_activity,:remote=>true}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>');
var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
showModal('ajax-modal', '350px'); showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();

View File

@ -1,12 +1,10 @@
alert('关闭成功'); alert('关闭成功');
<% if @user_activity_id == -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
$("#evaluation_end_time_<%=@homework.id %>").html("匿评关闭时间:<%=format_time(Time.now) %>"); $("#evaluation_end_time_<%=@homework.id %>").html("匿评关闭时间:<%=format_time(Time.now) %>");
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>"); <% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %> <% 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(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
$("#evaluation_end_time_<%=@user_activity_id %>").html("匿评关闭时间:<%=format_time(Time.now) %>");
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity');
<% end %> <% end %>
/* /*
$("#<%#= @homework.id %>_stop_anonymous_comment").replaceWith('');*/ $("#<%#= @homework.id %>_stop_anonymous_comment").replaceWith('');*/

View File

@ -63,7 +63,7 @@
<% if act.container_type == 'Course' %> <% if act.container_type == 'Course' %>
<% case act.org_act_type.to_s %> <% case act.org_act_type.to_s %>
<% when 'HomeworkCommon' %> <% when 'HomeworkCommon' %>
<%= render :partial => 'users/course_homework', :locals => {:activity => HomeworkCommon.find(act.org_act_id),:user_activity_id =>act.id,:course_activity => 0} %> <%= render :partial => 'users/course_homework', :locals => {:activity => HomeworkCommon.find(act.org_act_id),:user_activity_id =>act.id, :hw_status => 4} %>
<% when 'News' %> <% when 'News' %>
<%= render :partial => 'users/course_news', :locals => {:activity => News.find(act.org_act_id),:user_activity_id =>act.id} %> <%= render :partial => 'users/course_news', :locals => {:activity => News.find(act.org_act_id),:user_activity_id =>act.id} %>
<% when 'Message'%> <% when 'Message'%>

View File

@ -5,7 +5,7 @@
禁用匿评后学生将不能对作品进行互评,且匿评不能再开启,是否确定禁用匿评? 禁用匿评后学生将不能对作品进行互评,且匿评不能再开启,是否确定禁用匿评?
</p> </p>
<div class="ni_btn"> <div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="clickOK('<%= forbidden_anonymous_comment_student_work_path(:homework=>@homework, :user_activity_id => user_activity_id, :course_activity => course_activity)%>');" style="margin-bottom: 20px;" > <a href="javascript:" class="tijiao" onclick="clickOK('<%= forbidden_anonymous_comment_student_work_path(:homework=>@homework, :user_activity_id => user_activity_id, :hw_status => hw_status)%>');" style="margin-bottom: 20px;" >
确&nbsp;&nbsp;定 确&nbsp;&nbsp;定
</a> </a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;"> <a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">

View File

@ -1,7 +1,7 @@
<div id="popbox02" style=""> <div id="popbox02" style="">
<span class="f16 fontBlue">关联项目</span> <span class="f16 fontBlue">关联项目</span>
<a href="javascript:void(0);" class="popClose" onclick="clickCanel();"></a> <a href="javascript:void(0);" class="popClose" onclick="clickCanel();"></a>
<%=form_tag url_for(:controller=>'student_work',:action=>'student_work_project',:homework=>@homework.id,:user_activity_id=>@user_activity_id,:is_in_course=>@is_in_course,:course_activity =>@course_activity),:id =>'student_work_relate_project',:class=>'resourcesSearchBox',:remote => true do %> <%=form_tag url_for(:controller=>'student_work',:action=>'student_work_project',:homework=>@homework.id,:user_activity_id=>@user_activity_id,:hw_status =>@hw_status),:id =>'student_work_relate_project',:class=>'resourcesSearchBox',:remote => true do %>
<input type="text" name="project" placeholder="输入项目名称进行搜索" class="searchResourcePopup mb10" /> <input type="text" name="project" placeholder="输入项目名称进行搜索" class="searchResourcePopup mb10" />
<div class="cl"></div> <div class="cl"></div>
<p id="no_search_result" class="c_red" style="width:220px;display: none">您当前尚未创建任何项目,请先创建项目再关联。</p> <p id="no_search_result" class="c_red" style="width:220px;display: none">您当前尚未创建任何项目,请先创建项目再关联。</p>

View File

@ -3,7 +3,7 @@
<% render :partial => 'student_work/set_score_rule_detail', :locals => {:homework => homework, :f => f}%> <% render :partial => 'student_work/set_score_rule_detail', :locals => {:homework => homework, :f => f}%>
<% end%> <% end%>
<% else %> <% else %>
<%= form_for('new_form',:url => {:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity},:method => "post",:remote => true) do |f|%> <%= form_for('new_form',:url => {:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post",:remote => true) do |f|%>
<% render :partial => 'student_work/set_score_rule_detail', :locals => {:homework => homework, :f => f}%> <% render :partial => 'student_work/set_score_rule_detail', :locals => {:homework => homework, :f => f}%>
<% end%> <% end%>
<% end %> <% end %>

View File

@ -1,7 +1,6 @@
<% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
$("#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}) %>"); <% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%"); sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else%> <% else %>
$("#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%>");
sd_create_editor_from_data(<%= @homework.id%>,"","100%");
<% end %> <% end %>

View File

@ -1,7 +1,6 @@
<% if @user_activity_id == -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); <% if @user_activity_id != @homework.id %>
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"); sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %> <% end %>

View File

@ -1,8 +1,7 @@
clickCanel(); clickCanel();
<% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>"); <% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %> <% else %>
$("#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%>"); sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %> <% end %>

View File

@ -1,8 +1,7 @@
hideModal("#popbox02"); hideModal("#popbox02");
<% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
$("#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}) %>"); <% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%"); sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else%> <% else %>
$("#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%>");
sd_create_editor_from_data(<%= @homework.id%>,"","100%");
<% end %> <% end %>

View File

@ -11,12 +11,20 @@
TO <!--+"(课程名称)" --> TO <!--+"(课程名称)" -->
<%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %> <%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span> <span class="fb" style="color: #269ac9"> • </span>
<%= link_to activity.course.name.to_s+" | 班级作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue"%> <% if hw_status == 3 || hw_status == 5 %>
<%= link_to activity.course.name, course_path(activity.course_id), :class => "newsBlue"%>
<% else %>
<%= link_to activity.course.name.to_s+" | 班级作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue"%>
<% end %>
</div> </div>
<div class="homepagePostTitle hidden fl m_w505"> <!--+"(作业名称)"--> <div class="homepagePostTitle hidden fl m_w505"> <!--+"(作业名称)"-->
<%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%> <% if hw_status == 3 || hw_status == 5 %>
<% index = get_hw_index(activity, is_teacher) %>
<%= link_to "<span class='fontBlue2'>作业#{index+1}</span>".html_safe+activity.name,student_work_index_path(:homework => activity.id),:class => "postGrey"%>
<% else %>
<%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%>
<% end %>
</div> </div>
<%=get_hw_status(activity).html_safe %> <%=get_hw_status(activity).html_safe %>
<div class="cl"></div> <div class="cl"></div>
@ -31,12 +39,12 @@
<% works = cur_user_works_for_homework activity %> <% works = cur_user_works_for_homework activity %>
<% if works.nil? && projects.nil? %> <% if works.nil? && projects.nil? %>
<div class="homepagePostSubmit"> <div class="homepagePostSubmit">
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %> <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
<%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %> <%#= relate_project(activity,is_teacher,-1,user_activity_id) %>
</div> </div>
<% elsif works.nil? %> <% elsif works.nil? %>
<div class="homepagePostSubmit"> <div class="homepagePostSubmit">
<%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %> <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
@ -76,6 +84,11 @@
<% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 && activity.anonymous_comment == 0%> <% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 && activity.anonymous_comment == 0%>
<div class="homepagePostDeadline">匿评截止时间:<%= activity.homework_detail_manual.evaluation_end.to_s %>&nbsp;23:59</div> <div class="homepagePostDeadline">匿评截止时间:<%= activity.homework_detail_manual.evaluation_end.to_s %>&nbsp;23:59</div>
<% end %> <% end %>
<% if activity.homework_detail_manual.comment_status == 0 && !activity.publish_time.nil? %>
<div class="homepagePostDeadline ml15">
<%= l(:label_publish_time)%><%= activity.publish_time%>&nbsp;00:00
</div>
<% end %>
</div> </div>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
@ -227,35 +240,35 @@
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText"> <ul class="homepagePostSettiongText">
<li> <li>
<%= link_to l(:button_edit),edit_homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity), :class => "postOptionLink"%> <%= link_to l(:button_edit),edit_homework_common_path(activity, :hw_status => hw_status), :class => "postOptionLink"%>
</li> </li>
<li> <li>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %> <%= link_to(l(:label_bid_respond_delete), homework_common_path(activity, :hw_status => hw_status),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
</li> </li>
<li> <li>
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true) %> <%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true) %>
</li> </li>
<% if activity.anonymous_comment == 0 %> <% if activity.anonymous_comment == 0 %>
<li> <li>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%> <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
</li> </li>
<li> <li>
<%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %> <%= homework_anonymous_comment activity,hw_status,user_activity_id %>
</li> </li>
<% end %> <% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%> <% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
<li> <li>
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink", <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "postOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%> :title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
</li> </li>
<% end %> <% end %>
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %> <% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
<li> <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)%> <%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true)%>
</li> </li>
<% elsif activity.is_open == 1 %> <% elsif activity.is_open == 1 %>
<li> <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)%> <%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true)%>
</li> </li>
<% end %> <% end %>
</ul> </ul>
@ -269,12 +282,12 @@
<% count=activity.journals_for_messages.count %> <% count=activity.journals_for_messages.count %>
<div class="homepagePostReply"> <div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity} %> <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status} %>
<% comments = activity.journals_for_messages.reorder("created_on desc").limit(3) %> <% comments = activity.journals_for_messages.reorder("created_on desc").limit(3) %>
<% if count > 0 %> <% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>"> <div class="" id="reply_div_<%= user_activity_id %>">
<%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'HomeworkCommon', :is_in_course => -1,:course_activity=>course_activity, :is_teacher => is_teacher, :user_activity_id => user_activity_id, :activity_id => activity.id} %> <%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'HomeworkCommon', :hw_status => hw_status, :is_teacher => is_teacher, :user_activity_id => user_activity_id, :activity_id => activity.id} %>
</div> </div>
<% end %> <% end %>
@ -285,7 +298,7 @@
<div nhname='new_message_<%= user_activity_id%>' style="display:none;"> <div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%> <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%>
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
<%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %> <%= hidden_field_tag 'hw_status',params[:hw_status],:value =>hw_status %>
<div nhname='toolbar_container_<%= user_activity_id%>'></div> <div nhname='toolbar_container_<%= user_activity_id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="homework_message"></textarea> <textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="homework_message"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a> <a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>

View File

@ -36,14 +36,14 @@
<span style="position: relative" class="fr mr20"> <span style="position: relative" class="fr mr20">
<%= link_to( <%= link_to(
l(:button_reply), l(:button_reply),
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :is_in_course => is_in_course, :user_activity_id => user_activity_id, :course_activity => course_activity}, {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :hw_status => hw_status, :user_activity_id => user_activity_id},
:remote => true, :remote => true,
:method => 'get', :method => 'get',
:title => l(:button_reply)) %> :title => l(:button_reply)) %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span> <span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span> </span>
<% if User.current.admin? ||is_teacher || comment.user == User.current%> <% if User.current.admin? ||is_teacher || comment.user == User.current%>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => is_in_course, :user_activity_id => user_activity_id, :course_activity => course_activity}, <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:hw_status => hw_status, :user_activity_id => user_activity_id},
:id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) %> :id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) %>
<% end %> <% end %>
<% elsif type == 'News' %> <% elsif type == 'News' %>

View File

@ -10,12 +10,8 @@
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div> <div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<%if count>3 %> <%if count>3 %>
<div class="homepagePostReplyBannerMore"> <div class="homepagePostReplyBannerMore">
<% if activity.class.to_s == 'HomeworkCommon' && is_in_course == -1 %> <% if activity.class.to_s == 'HomeworkCommon' %>
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'HomeworkCommon',<%=user_activity_id %>,-1,<%=course_activity %>,<%=user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" > <a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'HomeworkCommon',<%=activity.id %>,<%=hw_status %>,<%=user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
</a>
<% elsif activity.class.to_s == 'HomeworkCommon' %>
<a id="reply_btn_<%=activity.id%>" onclick="expand_reply_homework('#reply_div_<%= activity.id %> li','#reply_btn_<%=activity.id%>',<%= activity.id %>,'HomeworkCommon',<%=activity.id %>,<%=is_in_course %>,-1, -1)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多 展开更多
</a> </a>
<% elsif activity.class.to_s == 'Message' %> <% elsif activity.class.to_s == 'Message' %>

View File

@ -5,9 +5,8 @@
<div nhname='new_message_<%= reply.id%>'> <div nhname='new_message_<%= reply.id%>'>
<% if @type == 'HomeworkCommon' %> <% if @type == 'HomeworkCommon' %>
<%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_homework', :id => reply.id},:method => "post", :remote => true) do |f| %> <%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_homework', :id => reply.id},:method => "post", :remote => true) do |f| %>
<input type="hidden" name="is_in_course" value=<%=@is_in_course %>> <input type="hidden" name="hw_status" value=<%=@hw_status %>>
<input type="hidden" name="user_activity_id" value=<%=@user_activity_id %>> <input type="hidden" name="user_activity_id" value=<%=@user_activity_id %>>
<input type="hidden" name="course_activity" value=<%=@course_activity %>>
<input type="hidden" name="reply[subject]" id="reply_subject"> <input type="hidden" name="reply[subject]" id="reply_subject">
<div nhname='toolbar_container_<%= reply.id%>'></div> <div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply_message"></textarea> <textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply_message"></textarea>

View File

@ -51,7 +51,7 @@
<% hidden_courses = Setting.find_by_name("hidden_courses") %> <% hidden_courses = Setting.find_by_name("hidden_courses") %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%> <% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %> <% if !unvisiable %>
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %> <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:hw_status => 1} %>
<% end %> <% end %>
<%# end %> <%# end %>
<% when 'News' %> <% when 'News' %>

View File

@ -26,15 +26,10 @@
} }
} }
</script> </script>
<%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %> <%= render :partial => 'users/course_homework', :locals => {:activity => homework_common, :user_activity_id =>homework_common.id, :hw_status => 3} %>
<% end%> <% end%>
<% if homework_commons.count == 10%> <% if homework_commons.count == 10%>
<% if is_in_course == 1%> <!-- 在课程内 -->
<!-- 在课程内 --> <%#= link_to "点击展开更多",homework_common_index_path(:course => course_id,:page => page),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
<%#= link_to "点击展开更多",homework_common_index_path(:course => course_id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
<% else%>
<!-- 在个人主页 -->
<%= link_to "点击展开更多",student_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
<% end%>
<% end%> <% end%>
</div> </div>

View File

@ -1,47 +0,0 @@
<script type="text/javascript">
function reset_homework(){
$("#homework_name").val("");
$("#homework_publish_time").val("");
$("#homework_end_time").val("");
$("#course_id").val($("#option_select").val());
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true })%>");
//homework_description_editor.html("");
$("#homework_name_span").text("");
$("#homework_end_time_span").text("");
$("#homework_end_time_span").text("");
$("#homework_course_id_span").text("");
$("#homework_editor").toggle();
}
// 点击 checkbox选中引用的资源的时候保存该资源的id到session里去
function store_seleted_resource(dom){
if(dom.attr('checked') == 'checked' ){
$.get(
'<%= store_selected_resource_user_path %>'+'?save=y&res_id='+dom.val()
)
}else {
$.get(
'<%= store_selected_resource_user_path %>'+'?save=n&res_id='+dom.val()
)
}
}
</script>
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">作业</div>
</div>
<div class="cl"></div>
<% if @is_teacher%>
<!-- 老师身份才可以发布作业 -->
<div class="HomeWork mb10" nhname='homework_common_form'>
<% homework = HomeworkCommon.new %>
<% homework.homework_detail_manual = HomeworkDetailManual.new%>
<%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
<div id="HomeWorkCon">
<%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
</div>
<% end%>
</div><!----HomeWork end-->
<% end%>
<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0,:is_in_course => 0} %>

View File

@ -1,5 +1,5 @@
<% if params[:type] == 'HomeworkCommon' %> <% if params[:type] == 'HomeworkCommon' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :type => @type, :is_in_course =>@is_in_course,:course_activity=>@course_activity, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id, :activity_id => params[:id].to_i}) %>'); $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :type => @type, :hw_status =>@hw_status, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id, :activity_id => params[:id].to_i}) %>');
<% elsif params[:type] == 'JournalsForMessage' %> <% elsif params[:type] == 'JournalsForMessage' %>
$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id =>params[:id].to_i}) %>'); $('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id =>params[:id].to_i}) %>');
<% elsif params[:type] == 'Message' %> <% elsif params[:type] == 'Message' %>

View File

@ -31,12 +31,11 @@
<% elsif @user && @jours_count%> <% elsif @user && @jours_count%>
$('#jour_count').html("<%= @jours_count %>"); $('#jour_count').html("<%= @jours_count %>");
<% elsif @homework%> <% elsif @homework%>
<% if @user_activity_id == -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); <% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%"); sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %> <% 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(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%");
<% end %> <% end %>
<% end %> <% end %>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>') var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')

View File

@ -1,7 +1,6 @@
<% if @user_activity_id %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>"); <% if @user_activity_id != @homework_common.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% elsif @homework_common_id && @is_in_course %> <% else %>
$("#homework_common_<%= @homework_common_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework_common,:is_in_course => @is_in_course}) %>"); sd_create_editor_from_data(<%= @homework_common.id%>,"","100%", "<%=@homework_common.class.to_s%>");
sd_create_editor_from_data(<%= @homework_common_id%>,"","100%", "HomeworkCommon"); <% end %>
<% end %>

View File

@ -1,7 +1,6 @@
<% if @user_activity_id != -1 %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>"); <% if @user_activity_id != @homework_common.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %> <% else %>
$("#homework_common_<%= @homework_common.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework_common,:is_in_course => @is_in_course}) %>"); sd_create_editor_from_data(<%= @homework_common.id%>,"","100%", "<%=@homework_common.class.to_s%>");
sd_create_editor_from_data(<%= @homework_common.id%>,"","100%", "HomeworkCommon");
<% end %> <% end %>

View File

@ -1459,7 +1459,7 @@ function expand_blog_comment_reply(container, btnid, id, type, div_id, homepage)
} }
} }
function expand_reply_homework(container, btnid, id, type, div_id, is_in_course, course_activity, user_activity_id) { function expand_reply_homework(container, btnid, id, type, div_id, hw_status, user_activity_id) {
var target = $(container); var target = $(container);
var btn = $(btnid); var btn = $(btnid);
if (btn.data('init') == '0') { if (btn.data('init') == '0') {
@ -1470,8 +1470,7 @@ function expand_reply_homework(container, btnid, id, type, div_id, is_in_course,
type: type, type: type,
id: id, id: id,
div_id: div_id, div_id: div_id,
is_in_course: is_in_course, hw_status: hw_status,
course_activity: course_activity,
user_activity_id: user_activity_id user_activity_id: user_activity_id
}, },
function(data) { function(data) {