参赛作品页面编辑功能中添加修改托管项目列表完成
This commit is contained in:
parent
10b34341c7
commit
77b7da81fd
|
@ -101,6 +101,21 @@ class SoftapplicationsController < ApplicationController
|
||||||
# GET /softapplications/1/edit
|
# GET /softapplications/1/edit
|
||||||
def edit
|
def edit
|
||||||
@softapplication = Softapplication.find(params[:id])
|
@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
|
end
|
||||||
|
|
||||||
# POST /softapplications
|
# POST /softapplications
|
||||||
|
@ -156,6 +171,7 @@ class SoftapplicationsController < ApplicationController
|
||||||
# @softapplication = Softapplication.find(params[:id])
|
# @softapplication = Softapplication.find(params[:id])
|
||||||
@softapplication.attachments.map{|attach| attach.destroy }
|
@softapplication.attachments.map{|attach| attach.destroy }
|
||||||
@softapplication.save_attachments(params[:attachments])
|
@softapplication.save_attachments(params[:attachments])
|
||||||
|
@softapplication.deposit_project = params[:project]
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @softapplication.update_attributes(params[:softapplication])
|
if @softapplication.update_attributes(params[:softapplication])
|
||||||
format.html { redirect_to @softapplication, notice: 'Softapplication was successfully updated.' }
|
format.html { redirect_to @softapplication, notice: 'Softapplication was successfully updated.' }
|
||||||
|
|
|
@ -13,6 +13,15 @@ module SoftapplicationsHelper
|
||||||
content = content_tag('ul', content)
|
content = content_tag('ul', content)
|
||||||
content_tag('div', content, :class => "tabs")
|
content_tag('div', content, :class => "tabs")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def select_option_helper option
|
||||||
|
tmp = Hash.new
|
||||||
|
option.each do |project|
|
||||||
|
tmp[project.name] = project.identifier
|
||||||
|
end
|
||||||
|
tmp
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,17 @@
|
||||||
|
|
||||||
</tr></ br>
|
</tr></ br>
|
||||||
<br />
|
<br />
|
||||||
<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">
|
<fieldset style="width: 500px">
|
||||||
<legend>上传作品软件包和作品截图</legend>
|
<legend>上传作品软件包和作品截图</legend>
|
||||||
|
|
Loading…
Reference in New Issue