Fix mailing redirect

Conflicts:
	vendor/built_in_modules/ask/init.rb
	vendor/built_in_modules/ask_new/app/controllers/panel/ask/front_end/ask_questions_controller.rb
	vendor/built_in_modules/ask_new/app/views/panel/ask/front_end/ask_questions/thank_you.html.erb
	vendor/built_in_modules/ask_new/config/routes.rb
This commit is contained in:
saurabhbhatia 2013-08-19 12:52:39 +08:00
parent fde9fd7ffe
commit 33f256bd16
6 changed files with 83 additions and 32 deletions

50
vendor/built_in_modules/ask/init.rb vendored Normal file
View File

@ -0,0 +1,50 @@
module Ask
OrbitApp.registration "Ask",:type=> 'ModuleApp' do
module_label 'ask.ask'
base_url File.expand_path File.dirname(__FILE__)
# personal_plugin :enable => true,:path=>"panel/faq/plugin/profile",:i18n=>'admin.faq'
version "0.1"
organization "Rulingcom"
author "RD dep"
intro "I am intro"
update_info 'some update_info'
front_end do
app_page 'ask_questions' do
frontend_i18n 'ask.ask'
end
end
widgets do
default_widget do
end
end
side_bar do
head_label_i18n 'ask.ask', icon_class: 'icons-light-bulb'
available_for [:admin,:manager,:sub_manager]
active_for_controllers({ private: ['ask_questions'] })
head_link_path "panel_ask_back_end_ask_questions_path"
context_link 'categories', link_path: 'panel_ask_back_end_ask_categories_path',
priority: 1,
active_for_action: {:ask_categories=>:index},
available_for: [:all]
context_link 'ask.acknowledgement', link_path: 'panel_ask_back_end_ask_acknowledgements_path',
priority: 1,
available_for: [:all]
context_link 'ask.admin', link_path: 'panel_ask_back_end_ask_admins_path',
priority: 1,
available_for: [:all]
context_link 'ask.export', link_path: 'export_panel_ask_back_end_ask_questions_path',
priority: 1,
available_for: [:all]
end
end
end

View File

@ -21,27 +21,26 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController
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
else # redirect_to panel_ask_front_end_thank_you_path
# @captcha.error will explain what went wrong respond_to do |format|
flash[:notice] = "Please refill human verification" format.js
render :action => 'index' # format.js { render :thank_you, notice: 'Your question has been successfully sent.' }
end end
end
#respond_to do |format|
# format.js
#end
end end
private def thank_you
def setup_negative_captcha @item = Page.find(params[:page_id]) rescue nil
@captcha = NegativeCaptcha.new( if @item
# A secret key entered in environment.rb. 'rake secret' will give you a good one. if @item.frontend_data_count
secret: "8a056b337dcc34741626c0b2a14dc3a05794abc11a83407f1d8ed1a1c48afec01dcae1ec2f90348981564ee1d05a537253881cf86bf9644ec4695ab797317738", @page_num = @item.frontend_data_count
spinner: request.remote_ip, else
# Whatever fields are in your form @page_num = 15
fields: [:name, :email, :content], end
params: params @frontend_style = @item.frontend_style
) end
@item = Page.find(params[:page_id]) rescue nil
>>>>>>> a4fa967... Fix mailing redirect
end end
end end

View File

@ -1,11 +1,12 @@
<% if @ask_question.errors.empty? %> <% #if @ask_question.errors.empty? %>
$('html,body').scrollTop(0); //$('html,body').scrollTop(0);
$('#acknowledgement') //$('#acknowledgement')
.html('<%= j simple_format(@ask_acknowledgement.content) %>') // .html('<%= j simple_format(@ask_acknowledgement.content) %>')
.fadeIn(600) // .fadeIn(600)
.delay(3000) // .delay(3000)
.fadeOut(600); // .fadeOut(600);
<% else %> <% #else %>
alert('<%= @ask_question.errors.full_messages.join('\n') %>'); //alert('<%= @ask_question.errors.full_messages.join('\n') %>');
Recaptcha.reload() //Recaptcha.reload()
<% end %> <% #end %>
window.location.href= "<%= panel_ask_front_end_thank_you_path %>"

View File

@ -1,8 +1,7 @@
<link href='/assets/ask.css' rel='stylesheet' type='text/css' /> <link href='/assets/ask.css' rel='stylesheet' type='text/css' />
<div id="new-ask-question" class="ask-question"> <div id="new-ask-question" class="ask-question">
<div id="acknowledgement"></div> <div id="acknowledgement"></div>
<%= form_for @ask_question, url: panel_ask_front_end_ask_questions_path(standalone: true), remote: true, <%= form_for @ask_question, url: panel_ask_front_end_ask_questions_path(standalone: true), html: {class: 'form-horizontal'} do |f| %>
html: {class: 'form-horizontal'} do |f| %>
<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">

View File

@ -0,0 +1 @@
<h3>Thank you for your email, we will get back to you soon.</h3>

View File

@ -18,6 +18,7 @@ Rails.application.routes.draw do
end end
namespace :front_end do namespace :front_end do
match "ask_questions/thank_you" => "ask_questions#thank_you", :as => 'thank_you'
resources :ask_questions resources :ask_questions
end end
end end