将关联功能整合到新建参赛作品中,可以直接关联到竞赛中
This commit is contained in:
parent
cf18b94326
commit
fc2f35f247
|
@ -100,14 +100,34 @@ class SoftapplicationsController < ApplicationController
|
|||
|
||||
# POST /softapplications
|
||||
# POST /softapplications.json
|
||||
# def create
|
||||
# @softapplication = Softapplication.new(params[:softapplication])
|
||||
# @softapplication.user = User.current
|
||||
# @softapplication.save_attachments(params[:attachments])
|
||||
# respond_to do |format|
|
||||
# if @softapplication.save
|
||||
# format.js
|
||||
# format.html { redirect_to @softapplication, notice: 'Softapplication was successfully created.' }
|
||||
# # format.json { render json: @softapplication, status: :created, location: @softapplication }
|
||||
# else
|
||||
# format.js { render status: 406 }
|
||||
# format.html { render action: "new" }
|
||||
# # format.json { render json: @softapplication.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
#new changed created function
|
||||
def create
|
||||
@softapplication = Softapplication.new(params[:softapplication])
|
||||
@softapplication.user = User.current
|
||||
@softapplication.save_attachments(params[:attachments])
|
||||
respond_to do |format|
|
||||
if @softapplication.save
|
||||
ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id)
|
||||
format.js
|
||||
format.html { redirect_to @softapplication, notice: 'Softapplication was successfully created.' }
|
||||
format.html { redirect_to show_attendingcontest_contest_path(:id => params[:contest_id]) }
|
||||
# format.json { render json: @softapplication, status: :created, location: @softapplication }
|
||||
else
|
||||
format.js { render status: 406 }
|
||||
|
@ -115,8 +135,13 @@ class SoftapplicationsController < ApplicationController
|
|||
# format.json { render json: @softapplication.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
#关联新建的参赛作品
|
||||
|
||||
# @contesting_softapplication = paginateHelper @contest.contesting_softapplications
|
||||
|
||||
|
||||
|
||||
end
|
||||
# PUT /softapplications/1
|
||||
# PUT /softapplications/1.json
|
||||
def update
|
||||
|
|
|
@ -12,4 +12,9 @@ class ContestingSoftapplication < ActiveRecord::Base
|
|||
:softapplication_id => softapplication_id, :description => description)
|
||||
end
|
||||
|
||||
def self.create_work_contesting(contest_id, softapplication_id)
|
||||
self.create(:user_id => User.current.id, :contest_id => contest_id,
|
||||
:softapplication_id => softapplication_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -76,17 +76,14 @@
|
|||
<span><%= link_to '新建参赛作品', "javascript:void(0);", onclick: "$('#put-project-form').toggle();" %></span>
|
||||
<span style="font-size: 12px; color: grey">(先点击“新建参赛作品”,然后刷新页面,再继续步骤2。)</span>
|
||||
</div>
|
||||
<div style="padding-left: 82px; ">
|
||||
<span style="padding-top: 50px">步骤2:</span>
|
||||
<span><%= link_to '关联参赛作品', "javascript:void(0);", onclick: "$('#put-bid-form').toggle();" %></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--点击新建参赛作品弹出框-->
|
||||
<!--点击新建参赛作品弹出框新建参赛作品并关联到竞赛中-->
|
||||
<div id="put-project-form" style="display: none; padding-left: 83px; width: 70%">
|
||||
<%= form_for Softapplication.new, :remote=>true, :url => softapplications_path, :complete => '$("#put-bid-form").hide();' do |f| %>
|
||||
<%= form_for Softapplication.new, :url => softapplications_path do |f| %>
|
||||
<fieldset class="contes-new-box", style="padding-left: 36px">
|
||||
|
||||
<%= hidden_field_tag 'contest_id', @contest.id %>
|
||||
<tr style="width:700px; margin-left: -10px">
|
||||
<span><%= l(:label_work_name) %></span>
|
||||
<span class="contest-star"> * </span>: <td ><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td>
|
||||
|
@ -147,35 +144,14 @@
|
|||
</fieldset>
|
||||
</fieldset></br>
|
||||
<div class="align-center", style="padding-top: -3px; padding-bottom: 8px">
|
||||
<%= submit_tag l(:button_create), :onclick => "cancel();" %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
|
||||
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--点击关联参赛作品后弹出关联框-->
|
||||
<div id="put-bid-form" style="display: none; padding-left: 83px; width: 70%">
|
||||
<%= form_for "contest_for_save", :remote=>true, :url => {:controller => 'contests', :action => 'add_softapplication'}, :update => "contesting_softapplication_list", :complete => '$("#put-bid-form").hide();' do |f| %>
|
||||
<table id="contesting_table" border="0" width="102%" style="margin-left: -3px;">
|
||||
<!--该table为点击关联参赛作品后弹出的-->
|
||||
<tr style="padding-left: 50px">
|
||||
<%= select_tag 'contest', options_for_select(select_option_app_helper(@softapplication)), :name => 'contest', :class => 'grayline' %>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><%= f.text_area :contest_message, :id => "contest_message", :required => true, :rows => 2, :cols => 40, :placeholder => l(:label_bid_reason), :style => "resize: none;", :class => 'noline'%></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"> <%= submit_tag l(:button_add), :name => nil , :class => "enterprise",
|
||||
:onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||
:onmouseover => "this.style.backgroundPosition = 'left -30px'"%>
|
||||
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
|
||||
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
|
Loading…
Reference in New Issue