From f333fe9e21958d7da7a9425ac258b8296dcc63f1 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Tue, 20 Aug 2013 11:54:20 +0800 Subject: [PATCH] Added custom acknowledgement to ask --- .../panel/ask/front_end/ask_questions_controller.rb | 11 ++++++----- .../panel/ask/front_end/ask_questions/create.js.erb | 11 ----------- .../ask/front_end/ask_questions/thank_you.html.erb | 2 +- 3 files changed, 7 insertions(+), 17 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 0e80c6e1a..414ca2df7 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 @@ -14,6 +14,11 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController def create @ask_question = AskQuestion.new(params[:ask_question]) if gotcha_valid? && @ask_question.save + @acknowledgement = AskAcknowledgement.last + respond_to do |format| + format.js + # format.js { render :thank_you, notice: 'Your question has been successfully sent.' } + end @ask_acknowledgement = AskAcknowledgement.first || AskAcknowlegement.new #@ask_question.save redirect_to root_path @@ -22,10 +27,6 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id) end # redirect_to panel_ask_front_end_thank_you_path - respond_to do |format| - format.js - # format.js { render :thank_you, notice: 'Your question has been successfully sent.' } - end end end @@ -42,5 +43,5 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController @item = Page.find(params[:page_id]) rescue nil >>>>>>> a4fa967... Fix mailing redirect end - + @acknowledgement = AskAcknowledgement.last end diff --git a/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/create.js.erb b/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/create.js.erb index 6adc0c3ef..b9e03a590 100644 --- a/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/create.js.erb +++ b/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/create.js.erb @@ -1,12 +1 @@ -<% #if @ask_question.errors.empty? %> - //$('html,body').scrollTop(0); - //$('#acknowledgement') - // .html('<%= j simple_format(@ask_acknowledgement.content) %>') - // .fadeIn(600) - // .delay(3000) - // .fadeOut(600); -<% #else %> - //alert('<%= @ask_question.errors.full_messages.join('\n') %>'); - //Recaptcha.reload() -<% #end %> window.location.href= "<%= panel_ask_front_end_thank_you_path %>" diff --git a/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/thank_you.html.erb b/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/thank_you.html.erb index 4409fcf61..cdcae0b6e 100644 --- a/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/thank_you.html.erb +++ b/vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/thank_you.html.erb @@ -1 +1 @@ -

Thank you for your email, we will get back to you soon.

\ No newline at end of file +

<%= @acknowledgement.content.html_safe%>

\ No newline at end of file