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
Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id)
end
else
# @captcha.error will explain what went wrong
flash[:notice] = "Please refill human verification"
render :action => 'index'
end
#respond_to do |format|
# format.js
#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
private
def setup_negative_captcha
@captcha = NegativeCaptcha.new(
# A secret key entered in environment.rb. 'rake secret' will give you a good one.
secret: "8a056b337dcc34741626c0b2a14dc3a05794abc11a83407f1d8ed1a1c48afec01dcae1ec2f90348981564ee1d05a537253881cf86bf9644ec4695ab797317738",
spinner: request.remote_ip,
# Whatever fields are in your form
fields: [:name, :email, :content],
params: params
)
def thank_you
@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
>>>>>>> a4fa967... Fix mailing redirect
end
end

View File

@ -1,11 +1,12 @@
<% if @ask_question.errors.empty? %>
$('html,body').scrollTop(0);
$('#acknowledgement')
.html('<%= j simple_format(@ask_acknowledgement.content) %>')
.fadeIn(600)
.delay(3000)
.fadeOut(600);
<% else %>
alert('<%= @ask_question.errors.full_messages.join('\n') %>');
Recaptcha.reload()
<% end %>
<% #if @ask_question.errors.empty? %>
//$('html,body').scrollTop(0);
//$('#acknowledgement')
// .html('<%= j simple_format(@ask_acknowledgement.content) %>')
// .fadeIn(600)
// .delay(3000)
// .fadeOut(600);
<% #else %>
//alert('<%= @ask_question.errors.full_messages.join('\n') %>');
//Recaptcha.reload()
<% #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' />
<div id="new-ask-question" class="ask-question">
<div id="acknowledgement"></div>
<%= form_for @ask_question, url: panel_ask_front_end_ask_questions_path(standalone: true), remote: true,
html: {class: 'form-horizontal'} do |f| %>
<%= form_for @ask_question, url: panel_ask_front_end_ask_questions_path(standalone: true), html: {class: 'form-horizontal'} do |f| %>
<div class="control-group">
<%= f.label :ask_category_id, class: 'control-label required' %>
<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
namespace :front_end do
match "ask_questions/thank_you" => "ask_questions#thank_you", :as => 'thank_you'
resources :ask_questions
end
end