From c8aaa2776c87f942e3657b7bc710b30756b7b4f5 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 21 Jul 2014 16:59:00 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BD=9C=E5=93=81=E7=B1=BB=E5=88=AB=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=85=B6=E4=BB=96=E9=80=89=E9=A1=B9=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=80=89=E6=8B=A9=E5=85=B6=E4=BB=96=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=98=BE=E7=A4=BA=E4=B8=80=E7=BC=96=E8=BE=91=E6=A1=86?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E7=94=A8=E6=88=B7=E8=BE=93=E5=85=A5=E5=85=B6?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E6=89=80=E5=B1=9E=E7=B1=BB=E5=88=AB=202.?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AB=9E=E8=B5=9B=E6=94=AF=E6=8C=81=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E7=B1=BB=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../softapplications_controller.rb | 5 +++-- .../contests/show_attendingcontest.html.erb | 21 ++++++++++++++++++- .../20140721074353_insert_works_categories.rb | 13 ++++++++++++ db/schema.rb | 2 +- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20140721074353_insert_works_categories.rb 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