diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index b60e9ba5c..4def99075 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -139,13 +139,14 @@ class SoftapplicationsController < ApplicationController #new changed created function 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.user = User.current #@softapplication.deposit_project = 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]) - respond_to do |format| if @softapplication.save ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 324571771..f6b684e5f 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -60,6 +60,21 @@ $("#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" + } + } + <%= render_flash_messages %> @@ -115,9 +130,13 @@ <%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %> - <%= 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;" %> +

diff --git a/db/migrate/20140721074353_insert_works_categories.rb b/db/migrate/20140721074353_insert_works_categories.rb new file mode 100644 index 000000000..111d48678 --- /dev/null +++ b/db/migrate/20140721074353_insert_works_categories.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 01b42f8a3..fc169552e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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| t.integer "act_id", :null => false