作品动态添加追加附件功能
This commit is contained in:
parent
7a90c0ea10
commit
9b4c275869
|
@ -355,6 +355,7 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
@is_focus = params[:is_focus] ? params[:is_focus].to_i : 0
|
||||
# 消息传过来的ID
|
||||
@message_student_work_id = params[:student_work_id]
|
||||
respond_to do |format|
|
||||
|
|
|
@ -2990,8 +2990,12 @@ def homework_common_index_url_in_org(course_id)
|
|||
Setting.protocol + "://" + Setting.host_name + "/homework_common?course=" + course_id.to_s
|
||||
end
|
||||
|
||||
def student_work_index_url_in_org(homework_id)
|
||||
def student_work_index_url_in_org(homework_id, is_focus = '')
|
||||
if is_focus != ''
|
||||
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&is_focus=" + is_focus.to_s
|
||||
else
|
||||
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s
|
||||
end
|
||||
end
|
||||
|
||||
def course_url_in_org(course_id)
|
||||
|
|
|
@ -66,11 +66,16 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="homepagePostSubmit">
|
||||
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%= user_for_homework_common activity,is_teacher %>
|
||||
</div>
|
||||
|
||||
<% work = cur_user_works_for_homework activity %>
|
||||
<% if activity.end_time < Date.today && !is_teacher && !work.nil? %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if activity.homework_type == 2 && is_teacher%>
|
||||
<div class="homepagePostSubmit">
|
||||
<%= link_to "模拟答题", Setting.protocol + "://" + Setting.host_name + "/users/new_user_commit_homework?homework_id="+activity.id.to_s + "&is_test=true", class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
|
||||
|
|
|
@ -120,6 +120,11 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
<% if defined?(is_focus) && is_focus.to_i == 1 %>
|
||||
$("#upload_revise_attachment").click();
|
||||
<% end %>
|
||||
});
|
||||
function show_upload(){
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="mb10 mt5">
|
||||
<a href="javascript:void(0);" onclick="show_upload();" class="blueCir ml5" title="请选择文件上传">上传附件</a>
|
||||
<a href="javascript:void(0);" id="upload_revise_attachment" onclick="show_upload();" class="blueCir ml5" title="请选择文件上传">上传附件</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -88,7 +88,7 @@
|
|||
</ul>
|
||||
|
||||
<div id="revise_attachment">
|
||||
<%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %>
|
||||
<%= render :partial => 'student_work/revise_attachment', :locals => {:work => work,:is_focus => is_focus} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
|
@ -107,6 +107,9 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('student_work_img_<%=work.id %>');
|
||||
<% if defined?(is_focus) && is_focus.to_i == 1 %>
|
||||
$("#upload_revise_attachment").click();
|
||||
<% end %>
|
||||
});
|
||||
function show_upload(){
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>');
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<% work= params[:show_work_id].nil? ? @homework.student_works.where("user_id = ?",User.current.id).first : StudentWork.find(params[:show_work_id]) %>
|
||||
<% unless work.nil? %>
|
||||
<% if @homework.homework_type == 2 %>
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
|
||||
|
||||
var program_name = "text/x-csrc";
|
||||
var language = <%= @homework.language %>;
|
||||
|
@ -74,11 +74,11 @@
|
|||
value: $("#work-src_<%= work.id%>").text()
|
||||
});
|
||||
<% elsif @homework.homework_type == 1 %>
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
|
||||
<% elsif @homework.homework_type == 3 %>
|
||||
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
|
||||
<% if pro && pro.student_work_id == work.id %>
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
|
||||
<% end %>
|
||||
<% end %>
|
||||
$('#score_<%= work.id%>').peSlider({range: 'min'});
|
||||
|
|
|
@ -70,7 +70,12 @@
|
|||
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
|
||||
<%= user_for_homework_common activity,is_teacher %>
|
||||
</div>
|
||||
|
||||
<% work = cur_user_works_for_homework activity %>
|
||||
<% if activity.end_time < Date.today && !is_teacher && !work.nil? %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if activity.homework_type == 2 && is_teacher%>
|
||||
<div class="homepagePostSubmit">
|
||||
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
|
||||
|
|
|
@ -70,6 +70,12 @@
|
|||
<div class="homepagePostSubmit">
|
||||
<%= user_for_homework_common homework_common,is_teacher %>
|
||||
</div>
|
||||
<% work = cur_user_works_for_homework homework_common %>
|
||||
<% if homework_common.end_time < Date.today && !is_teacher && !work.nil? %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "追加附件", student_work_index_url_in_org(homework_common.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if homework_common.homework_type == 2 && is_teacher%>
|
||||
<div class="homepagePostSubmit">
|
||||
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
|
||||
|
|
Loading…
Reference in New Issue