fix new ui ask module frontend

This commit is contained in:
Spen 2013-10-15 16:51:16 +08:00 committed by saurabhbhatia
parent 96c3be68f7
commit b9fbba2962
4 changed files with 15 additions and 6 deletions

View File

@ -18,6 +18,7 @@ gem 'kaminari'
gem 'time_difference' gem 'time_difference'
gem "acts_as_unvlogable" gem "acts_as_unvlogable"
gem 'youtube_it' gem 'youtube_it'
gem 'gotcha'
# gem "memcached", "~> 1.4.3" # gem "memcached", "~> 1.4.3"
# gem "memcache-client" # gem "memcache-client"

View File

@ -9,6 +9,7 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController
def index def index
@ask_question = AskQuestion.new @ask_question = AskQuestion.new
@categories = @module_app.categories.enabled
end end
def create def create
@ -16,20 +17,25 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController
if gotcha_valid? && @ask_question.save if gotcha_valid? && @ask_question.save
@acknowledgement = AskAcknowledgement.last @acknowledgement = AskAcknowledgement.last
@ask_acknowledgement = AskAcknowledgement.first || AskAcknowlegement.new @ask_acknowledgement = AskAcknowledgement.first || AskAcknowlegement.new
#@ask_question.save
#redirect_to root_path
AskAdmin.all.each do |ask_admin| AskAdmin.all.each do |ask_admin|
AskMailer.notice(ask_admin, @ask_question).deliver AskMailer.notice(ask_admin, @ask_question).deliver
Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id) Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id)
end end
# redirect_to panel_ask_front_end_thank_you_path
# Render to create.js.erb
respond_to do |format| respond_to do |format|
format.js 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 end
end end
def thank_you def thank_you
@acknowledgement = AskAcknowledgement.last @acknowledgement = AskAcknowledgement.last
@item = Page.find(params[:page_id]) rescue nil @item = Page.find(params[:page_id]) rescue nil

View File

@ -35,7 +35,7 @@ $(document).ready(function(){
<div class="control-group"> <div class="control-group">
<%= f.label :ask_category_id, class: 'control-label required' %> <%= f.label :ask_category_id, class: 'control-label required' %>
<div class="controls"> <div class="controls">
<%= f.collection_select :ask_category_id, AskCategory.all, :id, :name %> <%= f.select :category_id, @categories.collect{|t| [ t.title, t.id ]} %>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">

View File

@ -19,8 +19,10 @@ Rails.application.routes.draw do
namespace :front_end do namespace :front_end do
match "ask_questions/thank_you" => "ask_questions#thank_you", :as => 'thank_you' match "ask_questions/thank_you" => "ask_questions#thank_you", :as => 'thank_you'
match "ask_questions/sorry" => "ask_questions#sorry", :as => 'sorry'
resources :ask_questions resources :ask_questions
end end
end end
end end