调整选入课程弹框中列表的显示策略

This commit is contained in:
z9hang 2014-11-21 15:54:29 +08:00
parent 1007134ced
commit 2348e063d1
2 changed files with 3 additions and 3 deletions

View File

@ -44,10 +44,10 @@ module FilesHelper
File.new(zipfile_name,'w+')
end
def courses_check_box_tags(name,courses,current_course)
def courses_check_box_tags(name,courses,current_course,attachment)
s = ''
courses.each do |course|
if course.id != current_course.id && is_course_teacher(User.current,course)
if !(attachment.container_type && attachment.container_id == course.id) && is_course_teacher(User.current,course)
s << "<label>#{ check_box_tag name, course.id, false, :id => nil } #{h course.name}</label><br/>"
end
end

View File

@ -8,7 +8,7 @@
remote: true,
id: "relation_file_form" do %>
<%= hidden_field_tag(:file_id, file.id) %>
<%= content_tag('div', courses_check_box_tags('courses[course][]', User.current.courses,course), :id => 'courses')%>
<%= content_tag('div', courses_check_box_tags('courses[course][]', User.current.courses,course,file), :id => 'courses')%>
<a id="submit_quote" href="javascript:void(0)" class="upload_btn" onclick="submit_quote();">引&nbsp;&nbsp;用</a><a href="javascript:void(0)" class="upload_btn upload_btn_grey" onclick="closeModal();">取&nbsp;&nbsp;消</a>
<% end -%>
</div>