diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 85fa7244a..8968f0bf4 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -376,10 +376,10 @@ class ContestsController < ApplicationController contest_message = params[:contest_for_save][:contest_message] if ContestingSoftapplication.where("softapplication_id = ? and contest_id = ?", softapplication.id, @contest.id).size == 0 if ContestingSoftapplication.create_softapplication_contesting(@contest.id, softapplication.id, contest_message) - flash.now[:notice] = l(:label_release_add_contest_succeed) + flash[:notice] = l(:label_release_add_contest_succeed) end else - flash.now[:error] = l(:label_add_contest_succeed_fail) + flash[:error] = l(:label_add_contest_succeed_fail) end @contesting_softapplication = paginateHelper @contest.contesting_softapplications diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 3aba819e0..9ede52489 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -106,11 +106,13 @@ class SoftapplicationsController < ApplicationController @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 } + # 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 } + # format.json { render json: @softapplication.errors, status: :unprocessable_entity } end end end diff --git a/app/views/softapplications/create.js.erb b/app/views/softapplications/create.js.erb new file mode 100644 index 000000000..7f4ac2284 --- /dev/null +++ b/app/views/softapplications/create.js.erb @@ -0,0 +1 @@ +alert('新建参赛作品成功!');