diff --git a/Gemfile b/Gemfile index ceece7b65..111711aea 100644 --- a/Gemfile +++ b/Gemfile @@ -18,6 +18,7 @@ gem 'kaminari' gem 'time_difference' gem "acts_as_unvlogable" gem 'youtube_it' +gem 'gotcha' # gem "memcached", "~> 1.4.3" # gem "memcache-client" 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 3092ec573..3c9454229 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 @@ -9,27 +9,33 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController def index @ask_question = AskQuestion.new + @categories = @module_app.categories.enabled end 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 + def thank_you @acknowledgement = AskAcknowledgement.last @item = Page.find(params[:page_id]) rescue nil diff --git a/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/index.html.erb b/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/index.html.erb index e38c86be6..ebd2a1d01 100644 --- a/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/index.html.erb +++ b/vendor/built_in_modules/ask/app/views/panel/ask/front_end/ask_questions/index.html.erb @@ -35,7 +35,7 @@ $(document).ready(function(){
<%= f.label :ask_category_id, class: 'control-label required' %>
- <%= f.collection_select :ask_category_id, AskCategory.all, :id, :name %> + <%= f.select :category_id, @categories.collect{|t| [ t.title, t.id ]} %>
diff --git a/vendor/built_in_modules/ask/config/routes.rb b/vendor/built_in_modules/ask/config/routes.rb index 0c4894874..df2ffe95f 100644 --- a/vendor/built_in_modules/ask/config/routes.rb +++ b/vendor/built_in_modules/ask/config/routes.rb @@ -19,8 +19,10 @@ 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 end