参赛作品页面编辑功能中添加修改托管项目列表完成

This commit is contained in:
wanglinchun 2014-05-20 15:58:34 +08:00
parent 10b34341c7
commit 77b7da81fd
3 changed files with 36 additions and 1 deletions

View File

@ -101,6 +101,21 @@ class SoftapplicationsController < ApplicationController
# GET /softapplications/1/edit
def edit
@softapplication = Softapplication.find(params[:id])
@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
@option = []
# @contesting_project_count = @contesting_project_all.count
# @contesting_project_pages = Paginator.new @contesting_project_count, per_page_option, params['page']
@membership.each do |membership|
unless(membership.project.project_type==1)
membership.member_roles.each{|role|
if(role.role_id == 3)
@option << membership.project
end
}
end
end
end
# POST /softapplications
@ -156,6 +171,7 @@ class SoftapplicationsController < ApplicationController
# @softapplication = Softapplication.find(params[:id])
@softapplication.attachments.map{|attach| attach.destroy }
@softapplication.save_attachments(params[:attachments])
@softapplication.deposit_project = params[:project]
respond_to do |format|
if @softapplication.update_attributes(params[:softapplication])
format.html { redirect_to @softapplication, notice: 'Softapplication was successfully updated.' }

View File

@ -13,6 +13,15 @@ module SoftapplicationsHelper
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs")
end
def select_option_helper option
tmp = Hash.new
option.each do |project|
tmp[project.name] = project.identifier
end
tmp
end
end

View File

@ -54,6 +54,16 @@
<br />
<br />
<tr style="width:800px;">
<span><%= l(:label_work_deposit_project) %></span>
<span style="padding-left: 4px"><%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2' %></span>
<span><%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target=>'_blank'%></span>
</tr><br/>
<br />
<br />
<fieldset style="width: 500px">
<legend>上传作品软件包和作品截图</legend>
<%= render_flash_messages %>