Orbit/vendor/built_in_modules/ask_new/app/controllers/panel/ask/back_end/ask_replies_controller.rb

30 lines
895 B
Ruby

class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
def initialize
super
@app_title = 'ask_replies'
end
def create
@ask_question = AskQuestion.find(params[:ask_question_id])
@ask_question.ask_reply = AskReply.new(params[:ask_reply])
@ask_question.save
if @ask_question.ask_reply.send_email?
Resque.enqueue(SendAskReplyMail, @ask_reply.ask_question.id)
end
redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success')
end
def update
@ask_reply = AskReply.find(params[:id])
@ask_reply.update_attributes(params[:ask_reply])
if @ask_reply.send_email?
Resque.enqueue(SendAskReplyMail, @ask_reply.ask_question.id)
end
redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success')
end
end