作业动态的重构

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

View File

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

View File

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

View File

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

View File

@ -2689,15 +2689,15 @@ module ApplicationHelper
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")
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评"
elsif homework.student_works.has_committed.count >= 2 && homework.homework_detail_manual#作业份数大于2
case homework.homework_detail_manual.comment_status
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
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
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
end

View File

@ -57,12 +57,12 @@ module HomeworkCommonHelper
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 = ""
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
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
link
end

View File

@ -60,7 +60,7 @@
<% act = activity.course_act %>
<% case activity.course_act_type.to_s %>
<% 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' %>
<%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id} %>
<% when 'Message' %>

View File

@ -26,7 +26,7 @@
}
}
</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%>
<% 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"%>

View File

@ -1,5 +1,5 @@
<% 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 %>
$("#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 %>

View File

@ -32,7 +32,7 @@
</p>
<% end %>
<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;定
</a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">

View File

@ -22,7 +22,7 @@
</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 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;定
</a>
<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;">
<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">
<%= 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>
<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');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +

View File

@ -1,5 +1,5 @@
<script type="text/javascript">
<% if @is_in_course.to_i == 1 || @course_activity == 1 %>
<% if @hw_status != 1 %>
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
@ -23,18 +23,16 @@
window.location.href='<%=manage_or_receive_homeworks_user_path(User.current.id) %>';
<% elsif @is_manage.to_i == 2 %>
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) %>';
<% elsif @is_in_course.to_i == 0 %>
window.location.href='<%=user_homeworks_user_path(User.current.id) %>';
<% elsif @is_in_course.to_i == -1 && @course_activity == 0 %>
<% elsif @hw_status == 1 %>
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) %>';
<% end %>
}
</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>
<div class="cl"></div>
@ -56,8 +54,7 @@
<% end %>
<%= form_for @homework do |f| %>
<input type="text" name="is_in_course" class="none" value="<%= @is_in_course%>"/>
<input type="text" name="course_activity" class="none" value="<%= @course_activity%>"/>
<input type="text" name="hw_status" class="none" value="<%= @hw_status%>"/>
<input type="text" name="is_manage" class="none" value="<%= @is_manage%>"/>
<div id="HomeWorkCon">
<%= 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 %>
$("#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}) %>");
$("#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}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% 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');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +

View File

@ -1,8 +1,7 @@
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,:course_activity=>@courae_activity}) %>");
$("#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}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% 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%>");
<% end %>

View File

@ -1,13 +1,11 @@
<% if @statue == 1%>
alert('启动成功');
<% if @user_activity_id == -1 %>
$("#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_<%=@homework.id %>").html("匿评开启时间:<%=format_time(Time.now) %>");
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}) %>");
$("#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}) %>");
$("#evaluation_start_time_<%=@user_activity_id %>").html("匿评开启时间:<%=format_time(Time.now) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% 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")%>');*/
<% 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};
showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove();

View File

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

View File

@ -63,7 +63,7 @@
<% if act.container_type == 'Course' %>
<% case act.org_act_type.to_s %>
<% 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' %>
<%= render :partial => 'users/course_news', :locals => {:activity => News.find(act.org_act_id),:user_activity_id =>act.id} %>
<% when 'Message'%>

View File

@ -5,7 +5,7 @@
禁用匿评后学生将不能对作品进行互评,且匿评不能再开启,是否确定禁用匿评?
</p>
<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;定
</a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">

View File

@ -1,7 +1,7 @@
<div id="popbox02" style="">
<span class="f16 fontBlue">关联项目</span>
<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" />
<div class="cl"></div>
<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}%>
<% end%>
<% 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}%>
<% 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,:course_activity => @course_activity}) %>");
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%");
<% 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%");
$("#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}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>

View File

@ -1,7 +1,6 @@
<% if @user_activity_id == -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}) %>");
$("#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}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>

View File

@ -1,8 +1,7 @@
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,:course_activity=>@courae_activity}) %>");
$("#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}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% 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%>");
<% end %>

View File

@ -1,8 +1,7 @@
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,:course_activity => @course_activity}) %>");
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%");
<% 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%");
$("#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}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>

View File

@ -11,12 +11,20 @@
TO <!--+"(课程名称)" -->
<%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<% 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 class="homepagePostTitle hidden fl m_w505"> <!--+"(作业名称)"-->
<% 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>
<%=get_hw_status(activity).html_safe %>
<div class="cl"></div>
@ -31,12 +39,12 @@
<% works = cur_user_works_for_homework activity %>
<% if works.nil? && projects.nil? %>
<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=> '请各组长关联作业项目' %>
<%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
<%=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) %>
</div>
<% elsif works.nil? %>
<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>
<% end %>
<% end %>
@ -76,6 +84,11 @@
<% 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>
<% 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>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
@ -227,35 +240,35 @@
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<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>
<%= 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>
<%= 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>
<% if activity.anonymous_comment == 0 %>
<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>
<%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %>
<%= homework_anonymous_comment activity,hw_status,user_activity_id %>
</li>
<% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
<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)%>
</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)%>
<%= 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>
<% 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)%>
<%= 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>
<% end %>
</ul>
@ -269,12 +282,12 @@
<% count=activity.journals_for_messages.count %>
<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) %>
<% if count > 0 %>
<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>
<% end %>
@ -285,7 +298,7 @@
<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|%>
<%= 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>
<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>

View File

@ -36,14 +36,14 @@
<span style="position: relative" class="fr mr20">
<%= link_to(
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,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% 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)) %>
<% end %>
<% elsif type == 'News' %>

View File

@ -10,12 +10,8 @@
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<%if count>3 %>
<div class="homepagePostReplyBannerMore">
<% if activity.class.to_s == 'HomeworkCommon' && is_in_course == -1 %>
<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>
<% 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" >
<% 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',<%=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 == 'Message' %>

View File

@ -5,9 +5,8 @@
<div nhname='new_message_<%= reply.id%>'>
<% if @type == 'HomeworkCommon' %>
<%= 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="course_activity" value=<%=@course_activity %>>
<input type="hidden" name="reply[subject]" id="reply_subject">
<div nhname='toolbar_container_<%= reply.id%>'></div>
<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") %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% 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 %>
<% when 'News' %>

View File

@ -26,15 +26,10 @@
}
}
</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%>
<% if homework_commons.count == 10%>
<% if is_in_course == 1%>
<!-- 在课程内 -->
<%#= 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%>
<%#= link_to "点击展开更多",homework_common_index_path(:course => course_id,:page => page),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
<% end%>
</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' %>
$('#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' %>
$('#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' %>

View File

@ -31,12 +31,11 @@
<% elsif @user && @jours_count%>
$('#jour_count').html("<%= @jours_count %>");
<% elsif @homework%>
<% if @user_activity_id == -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%");
$("#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}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% 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%");
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>
<% end %>
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,:course_activity => @course_activity}) %>");
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% elsif @homework_common_id && @is_in_course %>
$("#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%", "HomeworkCommon");
$("#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}) %>");
<% if @user_activity_id != @homework_common.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework_common.id%>,"","100%", "<%=@homework_common.class.to_s%>");
<% 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,:course_activity => @course_activity}) %>");
$("#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}) %>");
<% if @user_activity_id != @homework_common.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% 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%", "HomeworkCommon");
sd_create_editor_from_data(<%= @homework_common.id%>,"","100%", "<%=@homework_common.class.to_s%>");
<% 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 btn = $(btnid);
if (btn.data('init') == '0') {
@ -1470,8 +1470,7 @@ function expand_reply_homework(container, btnid, id, type, div_id, is_in_course,
type: type,
id: id,
div_id: div_id,
is_in_course: is_in_course,
course_activity: course_activity,
hw_status: hw_status,
user_activity_id: user_activity_id
},
function(data) {