从题库发送的题,与从题库选用的题,不应该再有“加入题库”选项
This commit is contained in:
parent
66d6eab161
commit
0544cd2746
|
@ -1009,14 +1009,15 @@ class UsersController < ApplicationController
|
|||
new_homework.anonymous_comment = 1
|
||||
new_homework.quotes = 0
|
||||
new_homework.is_open = 0
|
||||
# homework.attachments.each do |attachment|
|
||||
# att = attachment.copy
|
||||
# att.container_id = nil
|
||||
# att.container_type = nil
|
||||
# att.copy_from = attachment.id
|
||||
# att.save
|
||||
# new_homework.attachments << att
|
||||
# end
|
||||
new_homework.homework_bank_id = homework.id
|
||||
homework.attachments.each do |attachment|
|
||||
att = attachment.copy
|
||||
att.container_id = nil
|
||||
att.container_type = nil
|
||||
att.copy_from = attachment.id
|
||||
att.save
|
||||
new_homework.attachments << att
|
||||
end
|
||||
#homework_detail_manual = homework.homework_detail_manual
|
||||
#homework_detail_programing = homework.homework_detail_programing
|
||||
#homework_detail_group = homework.homework_detail_group
|
||||
|
@ -1494,6 +1495,7 @@ class UsersController < ApplicationController
|
|||
if params[:quotes] && !params[:quotes].blank?
|
||||
quotes_homework = HomeworkBank.find params[:quotes].to_i
|
||||
quotes_homework.update_column(:quotes, quotes_homework.quotes+1)
|
||||
homework.update_attributes(:homework_bank_id => quotes_homework.id)
|
||||
end
|
||||
|
||||
if params[:add_to_bank]
|
||||
|
|
|
@ -2,6 +2,7 @@ class HomeworkBank < ActiveRecord::Base
|
|||
# attr_accessible :title, :body
|
||||
belongs_to :user
|
||||
has_many :homework_bank_tests
|
||||
acts_as_attachable
|
||||
|
||||
def language_name
|
||||
%W(C C++ Python Java).at(self.language.to_i - 1)
|
||||
|
|
|
@ -10,6 +10,7 @@ class HomeworkCommon < ActiveRecord::Base
|
|||
|
||||
belongs_to :course
|
||||
belongs_to :user
|
||||
belongs_to :homework_bank
|
||||
has_one :homework_detail_manual, :dependent => :destroy
|
||||
has_one :homework_detail_programing, :dependent => :destroy
|
||||
has_one :homework_detail_group, :dependent => :destroy
|
||||
|
|
|
@ -128,9 +128,11 @@
|
|||
<%= link_to("加入题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 1),:class => "wpostOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% elsif activity.is_update %>
|
||||
<li>
|
||||
<%= link_to("同步到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 2),:class => "wpostOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% if activity.user == activity.homework_bank.user %>
|
||||
<li>
|
||||
<%= link_to("同步到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 2),:class => "wpostOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to("另存到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 3),:class => "wpostOptionLink", :remote => true)%>
|
||||
</li>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div id="sy_popup_box" style="width:380px;">
|
||||
<div class="sy_popup_top sy_popup_top_tishi">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">提示</h3>
|
||||
<a href="javascript:void(0);" class="sy_icons_close02 fr" onclick="hideModal()"></a>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="hideModal()"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="sy_popup_con02" >
|
||||
|
|
|
@ -329,7 +329,7 @@
|
|||
</label>
|
||||
</li>
|
||||
<% if !edit_mode %>
|
||||
<li class="f14 ml10 mb5" style="">
|
||||
<li class="f14 ml10 mb5" style="" id="join_bank_li">
|
||||
<input type="checkbox" value="1" name="add_to_bank" id="join_bank"/>
|
||||
<label for="join_bank" class="f14 c_grey">加入题库(同时将该作业保存到您的题库,可以随时复用)</label>
|
||||
</li>
|
||||
|
|
|
@ -21,3 +21,5 @@ homework_description_editor.html("<%= escape_javascript(@homework.description.ht
|
|||
document.getElementById("homework_type_option").options[<%=@homework.homework_type %>].selected = true;
|
||||
$("#select_type_nitice").hide();
|
||||
$("#homework_editor").show();
|
||||
$("#join_bank").attr("checked",false);
|
||||
$("#join_bank_li").hide();
|
Loading…
Reference in New Issue