parent
890bc7459d
commit
c8aaa2776c
|
@ -139,13 +139,14 @@ class SoftapplicationsController < ApplicationController
|
||||||
|
|
||||||
#new changed created function
|
#new changed created function
|
||||||
def create
|
def create
|
||||||
|
#options = params[:softapplication]
|
||||||
|
#options[:app_type_name] = params[:other_input] if options[:app_type_name] == "其他" && params[:other_input]
|
||||||
@softapplication = Softapplication.new(params[:softapplication])
|
@softapplication = Softapplication.new(params[:softapplication])
|
||||||
@softapplication.user = User.current
|
@softapplication.user = User.current
|
||||||
#@softapplication.deposit_project = params[:project]
|
#@softapplication.deposit_project = params[:project]
|
||||||
@softapplication.project = Project.find_by_id(params[:project])
|
@softapplication.project = Project.find_by_id(params[:project])
|
||||||
|
@softapplication.app_type_name = params[:other_input] if params[:other_input] != ""
|
||||||
@softapplication.save_attachments(params[:attachments])
|
@softapplication.save_attachments(params[:attachments])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @softapplication.save
|
if @softapplication.save
|
||||||
ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id)
|
ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id)
|
||||||
|
|
|
@ -60,6 +60,21 @@
|
||||||
$("#put-project-form").hide();
|
$("#put-project-form").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectChange(obj)
|
||||||
|
{
|
||||||
|
if(obj.value=="其他")
|
||||||
|
{
|
||||||
|
//document.getElementById("a").style.display = ""
|
||||||
|
$("#other_span").show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#other_span").hide();
|
||||||
|
$("#other_input").val("");
|
||||||
|
//document.getElementById("a").style.display = "none"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<%= render_flash_messages %>
|
<%= render_flash_messages %>
|
||||||
<!--参赛步骤-->
|
<!--参赛步骤-->
|
||||||
|
@ -115,9 +130,13 @@
|
||||||
<span>
|
<span>
|
||||||
<%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %>
|
<%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %>
|
||||||
</span>
|
</span>
|
||||||
<%= f.select :app_type_name,work_type_opttion, {},{:style => "width:358px;"} %>
|
<%= f.select :app_type_name,work_type_opttion, {},{:style => "width:358px;",:onchange => "selectChange(this)"} %>
|
||||||
<%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %>
|
<%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %>
|
||||||
</td>
|
</td>
|
||||||
|
<span style="font-size: 10px;display: none" id="other_span">
|
||||||
|
<%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
|
||||||
|
<input type="text" style="width: 100px;" id="other_input" name = "other_input"/>
|
||||||
|
</span>
|
||||||
</tr>
|
</tr>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# -*coding:utf-8 -*-
|
||||||
|
class InsertWorksCategories < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
workscategory = WorksCategory.new
|
||||||
|
workscategory.category = "其他"
|
||||||
|
workscategory.save
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
workscategory = WorksCategory.find_by_category("其他")
|
||||||
|
workscategory.destroy
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20140719080032) do
|
ActiveRecord::Schema.define(:version => 20140721074353) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
|
Loading…
Reference in New Issue