class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController layout false def initialize super @app_title = 'ask' end def index @ask_question = AskQuestion.new end def create @ask_question = AskQuestion.new(params[:ask_question]) if gotcha_valid? && @ask_question.save @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 respond_to do |format| format.js # format.js { render :thank_you, notice: 'Your question has been successfully sent.' } end end end def thank_you @acknowledgement = AskAcknowledgement.last @item = Page.find(params[:page_id]) rescue nil if @item if @item.frontend_data_count @page_num = @item.frontend_data_count else @page_num = 15 end @frontend_style = @item.frontend_style end @item = Page.find(params[:page_id]) rescue nil end end