From 63fab74a25284ee2986d577626fc6e45a64ea007 Mon Sep 17 00:00:00 2001 From: Bernie Chiu Date: Fri, 4 Oct 2013 15:57:14 +0800 Subject: [PATCH] Post form without ajax --- .../ask/front_end/ask_questions_controller.rb | 10 ++-------- .../ask/front_end/ask_questions/index.html.erb | 17 ++--------------- .../built_in_modules/ask_new/config/routes.rb | 2 +- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/vendor/built_in_modules/ask_new/app/controllers/panel/ask/front_end/ask_questions_controller.rb b/vendor/built_in_modules/ask_new/app/controllers/panel/ask/front_end/ask_questions_controller.rb index e1b65fba3..0f5191a69 100644 --- a/vendor/built_in_modules/ask_new/app/controllers/panel/ask/front_end/ask_questions_controller.rb +++ b/vendor/built_in_modules/ask_new/app/controllers/panel/ask/front_end/ask_questions_controller.rb @@ -22,15 +22,9 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id) end - # Render to create.js.erb - respond_to do |format| - format.js - end + redirect_to panel_ask_front_end_thank_you_path else - # Render to index.js.erb - respond_to do |format| - format.js { render :index } - end + redirect_to panel_ask_front_end_sorry_path end end diff --git a/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/index.html.erb b/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/index.html.erb index 349da3775..fdf8faf48 100644 --- a/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/index.html.erb +++ b/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/index.html.erb @@ -14,15 +14,7 @@ }
- <%= form_for @ask_question, url: panel_ask_front_end_ask_questions_path(standalone: true), html: {class: 'form-horizontal'} do |f| %> + <%= form_for @ask_question, url: panel_ask_front_end_ask_questions_path(standalone: true), html: {class: 'form-horizontal'}, method: :post do |f| %>
<%= f.label :ask_category_id, class: 'control-label required' %>
@@ -108,10 +100,5 @@ $(document).ready(function(){ $('#new-ask-question .required').each(function() { $(this).text('*' + $(this).text()); }); - - $('#new-ask-question form') .submit(function() { - $.post($(this).attr('action'), $(this).serializeArray()); - return false; - }); }); \ No newline at end of file diff --git a/vendor/built_in_modules/ask_new/config/routes.rb b/vendor/built_in_modules/ask_new/config/routes.rb index f8a35b5c9..0e44b4693 100644 --- a/vendor/built_in_modules/ask_new/config/routes.rb +++ b/vendor/built_in_modules/ask_new/config/routes.rb @@ -21,7 +21,7 @@ Rails.application.routes.draw do end namespace :front_end do - get "ask_questions/thank_you" => "ask_questions#thank_you", :as => 'thank_you' + match "ask_questions/thank_you" => "ask_questions#thank_you", :as => 'thank_you' match "ask_questions/sorry" => "ask_questions#sorry", :as => 'sorry' resources :ask_questions end