diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 7904ec5a6..3591360a8 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -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.' } diff --git a/app/helpers/softapplications_helper.rb b/app/helpers/softapplications_helper.rb index fe78e9875..67ab93180 100644 --- a/app/helpers/softapplications_helper.rb +++ b/app/helpers/softapplications_helper.rb @@ -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 diff --git a/app/views/softapplications/_form.html.erb b/app/views/softapplications/_form.html.erb index d74c049cd..9b24f86db 100644 --- a/app/views/softapplications/_form.html.erb +++ b/app/views/softapplications/_form.html.erb @@ -52,7 +52,17 @@
-
+
+ + + <%= l(:label_work_deposit_project) %>: + <%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2' %> + <%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target=>'_blank'%> +
+
+
+ +
上传作品软件包和作品截图