Post form without ajax
This commit is contained in:
parent
48969b70b5
commit
63fab74a25
|
@ -22,15 +22,9 @@ class Panel::Ask::FrontEnd::AskQuestionsController < OrbitWidgetController
|
||||||
Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id)
|
Resque.enqueue(SendAskNoticeMail, ask_admin.id, @ask_question.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Render to create.js.erb
|
redirect_to panel_ask_front_end_thank_you_path
|
||||||
respond_to do |format|
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
# Render to index.js.erb
|
redirect_to panel_ask_front_end_sorry_path
|
||||||
respond_to do |format|
|
|
||||||
format.js { render :index }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,7 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
|
||||||
$("#spinner").bind("ajaxSend", function() {
|
|
||||||
$(this).show();
|
|
||||||
}).bind("ajaxStop", function() {
|
|
||||||
$(this).hide();
|
|
||||||
}).bind("ajaxError", function() {
|
|
||||||
$(this).hide();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="spinner" class="spinner" style="display:none;">
|
<div id="spinner" class="spinner" style="display:none;">
|
||||||
|
@ -30,7 +22,7 @@ $(document).ready(function(){
|
||||||
</div>
|
</div>
|
||||||
<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), html: {class: 'form-horizontal'} do |f| %>
|
<%= form_for @ask_question, url: panel_ask_front_end_ask_questions_path(standalone: true), html: {class: 'form-horizontal'}, method: :post 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">
|
||||||
|
@ -108,10 +100,5 @@ $(document).ready(function(){
|
||||||
$('#new-ask-question .required').each(function() {
|
$('#new-ask-question .required').each(function() {
|
||||||
$(this).text('*' + $(this).text());
|
$(this).text('*' + $(this).text());
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#new-ask-question form') .submit(function() {
|
|
||||||
$.post($(this).attr('action'), $(this).serializeArray());
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
|
@ -21,7 +21,7 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :front_end do
|
namespace :front_end do
|
||||||
get "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'
|
match "ask_questions/sorry" => "ask_questions#sorry", :as => 'sorry'
|
||||||
resources :ask_questions
|
resources :ask_questions
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue