Add ask fail message and success redirect fix
This commit is contained in:
parent
3eeda5410c
commit
88c8ca68d0
|
@ -14,18 +14,22 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController
|
|||
def create
|
||||
@ask_question = AskQuestion.new(params[:ask_question])
|
||||
if gotcha_valid? && @ask_question.save
|
||||
@acknowledgement = AskAcknowledgement.last
|
||||
@acknowledgement = AskAcknowledgement.last
|
||||
@ask_acknowledgement = AskAcknowledgement.first || AskAcknowlegement.new
|
||||
#@ask_question.save
|
||||
redirect_to root_path
|
||||
|
||||
AskAdmin.all.each do |ask_admin|
|
||||
AskMailer.notice(ask_admin, @ask_question).deliver
|
||||
Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id)
|
||||
end
|
||||
# redirect_to panel_ask_front_end_thank_you_path
|
||||
|
||||
# Render to create.js.erb
|
||||
respond_to do |format|
|
||||
format.js
|
||||
# format.js { render :thank_you, notice: 'Your question has been successfully sent.' }
|
||||
end
|
||||
else
|
||||
# Render to index.js.erb
|
||||
respond_to do |format|
|
||||
format.js { render :index }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -43,4 +47,7 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController
|
|||
end
|
||||
@item = Page.find(params[:page_id]) rescue nil
|
||||
end
|
||||
|
||||
def sorry
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1 +1 @@
|
|||
window.location.href= "<%= panel_ask_front_end_thank_you_path %>"
|
||||
window.location.href = "<%= panel_ask_front_end_thank_you_path %>";
|
||||
|
|
|
@ -22,8 +22,7 @@ $(document).ready(function(){
|
|||
}).bind("ajaxError", function() {
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="spinner" class="spinner" style="display:none;">
|
||||
|
|
1
vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/index.js.erb
vendored
Normal file
1
vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/index.js.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
window.location.href = "<%= panel_ask_front_end_sorry_path %>";
|
1
vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/sorry.html.erb
vendored
Normal file
1
vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/sorry.html.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
<h3><%= t(:ask_fail, :scope => :ask) %> !</h3>
|
|
@ -1,5 +1,6 @@
|
|||
en:
|
||||
ask:
|
||||
ask_fail: Something went wrong
|
||||
ask: Ask
|
||||
export: Export
|
||||
reply: Reply
|
||||
|
|
|
@ -3,6 +3,7 @@ zh_tw:
|
|||
errors:
|
||||
verification_failed: 驗證碼錯誤
|
||||
ask:
|
||||
ask_fail: 寄送失敗
|
||||
ask: 發問
|
||||
export: 匯出
|
||||
reply: 回覆
|
||||
|
|
|
@ -22,6 +22,7 @@ Rails.application.routes.draw do
|
|||
|
||||
namespace :front_end do
|
||||
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
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue