增加、修改作业时提交项目增加空值选择,即不选定任何关联项目

This commit is contained in:
sw 2014-06-20 13:52:17 +08:00
parent d2376eb0b1
commit 18762e2da7
2 changed files with 5 additions and 1 deletions

View File

@ -59,7 +59,11 @@ module HomeworkAttachHelper
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
memberships = User.current.memberships.all(:conditions => cond)
projects = memberships.map(&:project)
not_have_project = []
not_have_project << "<<NULL>>"
not_have_project << 0
type = []
type << not_have_project
projects.each do |project|
if project != nil
option = []

View File

@ -28,7 +28,7 @@
</p>
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
<strong>提交项目:</strong>
<%= f.select :project_id, options_for_select(user_projects_option),:name => "project_id", :required => true%>
<%= f.select :project_id, options_for_select(user_projects_option),:name => "project_id", :required => true, :style => "width:490px;"%>
<%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target => '_blank' %>
<p class="font_lighter" style="padding-left:120px;clear:left;">提交项目可以为空</p>
</p>