fix new ui ask module frontend
This commit is contained in:
parent
96c3be68f7
commit
b9fbba2962
1
Gemfile
1
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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -35,7 +35,7 @@ $(document).ready(function(){
|
|||
<div class="control-group">
|
||||
<%= f.label :ask_category_id, class: 'control-label required' %>
|
||||
<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 class="control-group">
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Reference in New Issue