diff --git a/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_questions_controller.rb b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_questions_controller.rb index bb6b273ff..9d31ab732 100644 --- a/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_questions_controller.rb +++ b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_questions_controller.rb @@ -21,11 +21,14 @@ class Panel::Ask::BackEnd::AskQuestionsController < OrbitBackendController def edit @ask_question = AskQuestion.find(params[:id]) - if @ask_question.ask_reply + @ask_reply = @ask_question.ask_reply + if @ask_reply @url = panel_ask_back_end_ask_question_ask_reply_path(@ask_question, @ask_question.ask_reply) + @method = 'put' else - @ask_question.ask_reply = AskReply.new + @ask_reply = AskReply.new @url = panel_ask_back_end_ask_question_ask_replies_path(@ask_question) + @method = 'post' end end diff --git a/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_replies_controller.rb b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_replies_controller.rb index 2498669c6..7804bbb61 100644 --- a/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_replies_controller.rb +++ b/vendor/built_in_modules/ask/app/controllers/panel/ask/back_end/ask_replies_controller.rb @@ -10,7 +10,8 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController def create @ask_question = AskQuestion.find(params[:ask_question_id]) - @ask_question.ask_reply.create(params[:ask_reply]) + @ask_question.ask_reply = AskReply.new(params[:ask_reply]) + @ask_question.save if @ask_question.ask_reply.send_email? ::AskMailer.reply(@ask_question).deliver end diff --git a/vendor/built_in_modules/ask/app/controllers/panel/ask/front_end/ask_questions_controller.rb b/vendor/built_in_modules/ask/app/controllers/panel/ask/front_end/ask_questions_controller.rb index 5b985a8da..8687522cc 100644 --- a/vendor/built_in_modules/ask/app/controllers/panel/ask/front_end/ask_questions_controller.rb +++ b/vendor/built_in_modules/ask/app/controllers/panel/ask/front_end/ask_questions_controller.rb @@ -14,7 +14,7 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController def create @ask_question = AskQuestion.new(params[:ask_question]) if verify_recaptcha model: @ask_question, private_key: '6Lfl7OESAAAAAD4rl5S16-zjt5yiKNYJ6jsqdwmL' - @ask_acknowledgement = AskAcknowledgement.first + @ask_acknowledgement = AskAcknowledgement.first_or_create @ask_question.save AskAdmin.all.each do |ask_admin| Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id) diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/edit.html.erb b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/edit.html.erb index cf4fa408f..7225f69a1 100644 --- a/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/edit.html.erb +++ b/vendor/built_in_modules/ask/app/views/panel/ask/back_end/ask_questions/edit.html.erb @@ -1,5 +1,5 @@
<%= AskQuestion.human_attribute_name(:name) %>:<%= @ask_question.name %> | @@ -34,12 +34,12 @@||||
- <%= f.label :send_email %><%= f.radio_button :send_email, 1, checked: @ask_question.ask_reply.send_email? %><%= t('ask.yes') %> + <%= f.label :send_email %><%= f.radio_button :send_email, 1, checked: @ask_reply.send_email? %><%= t('ask.yes') %> - <%= f.radio_button :send_email, 0, checked: !@ask_question.ask_reply.send_email? %><%= t('ask.no') %> + <%= f.radio_button :send_email, 0, checked: !@ask_reply.send_email? %><%= t('ask.no') %> | ||||