add response(temp)
This commit is contained in:
parent
da40c2b669
commit
cc7a4ffb6d
|
@ -26,18 +26,19 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
@ask_question = AskQuestion.find(params[:ask_question_id])
|
||||||
@ask_reply = AskReply.find(params[:id])
|
@ask_reply = AskReply.find(params[:id])
|
||||||
@ask_reply.update_attributes(params[:ask_reply])
|
@ask_reply.update_attributes(params[:ask_reply])
|
||||||
if @ask_reply.send_email?
|
if @ask_reply.send_email?
|
||||||
Resque.enqueue(SendAskReplyMail, @ask_reply.ask_question.id)
|
Resque.enqueue(SendAskReplyMail, @ask_reply.ask_question.id)
|
||||||
end
|
end
|
||||||
##
|
##
|
||||||
send_request
|
send_request(@ask_question)
|
||||||
##
|
##
|
||||||
redirect_to panel_ask_back_end_ask_questions_path # , notice: t('ask.reply_success')
|
redirect_to panel_ask_back_end_ask_questions_path # , notice: t('ask.reply_success')
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_request
|
def send_request(current_question)
|
||||||
require 'net/http'
|
require 'net/http'
|
||||||
require 'uri'
|
require 'uri'
|
||||||
require 'json'
|
require 'json'
|
||||||
|
@ -52,11 +53,20 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
|
||||||
http = Net::HTTP.new(uri.host, uri.port)
|
http = Net::HTTP.new(uri.host, uri.port)
|
||||||
request = Net::HTTP::Post.new(uri.request_uri)
|
request = Net::HTTP::Post.new(uri.request_uri)
|
||||||
request.set_form_data(body)
|
request.set_form_data(body)
|
||||||
|
|
||||||
response = http.request(request)
|
response = http.request(request)
|
||||||
|
# puts "Response #{response.code} #{response.message}: #{response.body}"
|
||||||
puts "Response #{response.code} #{response.message}: #{response.body}"
|
if response.code == "200"
|
||||||
flash[:notice] = response.body
|
uri = URI.parse("http://localhost:4000/panel/ask/back_end/ask_requests/transfer_request")
|
||||||
|
http = Net::HTTP.new(uri.host, uri.port)
|
||||||
|
request = Net::HTTP::Post.new(uri.request_uri)
|
||||||
|
body = {
|
||||||
|
'title' => current_question.title
|
||||||
|
}
|
||||||
|
request.set_form_data(body)
|
||||||
|
response = http.request(request)
|
||||||
|
flash[:notice] = response.body
|
||||||
|
end
|
||||||
|
# flash[:notice] = response.body
|
||||||
# flash[:notice] = "Response #{response.code} #{response.message}: #{response.body}"
|
# flash[:notice] = "Response #{response.code} #{response.message}: #{response.body}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,17 @@ class Panel::Ask::BackEnd::AskRequestsController < OrbitBackendController
|
||||||
include OrbitControllerLib::DivisionForDisable
|
include OrbitControllerLib::DivisionForDisable
|
||||||
|
|
||||||
def auth_request
|
def auth_request
|
||||||
params.merge!({'c' => '789'})
|
params={'c' => '456' }
|
||||||
render :json => "#{params}"
|
render :json => "#{params}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def transfer_request
|
||||||
|
# @ask_question = AskQuestion.all
|
||||||
|
# x = @ask_question.count
|
||||||
|
# params={'d' => x }
|
||||||
|
@transfered_question=AskQuestion.new(:title=>params[:title])
|
||||||
|
@transfered_question.save
|
||||||
|
render :json => "#{params}"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -15,8 +15,9 @@ Rails.application.routes.draw do
|
||||||
resources :ask_categories
|
resources :ask_categories
|
||||||
resources :ask_acknowledgements
|
resources :ask_acknowledgements
|
||||||
resources :ask_admins
|
resources :ask_admins
|
||||||
|
|
||||||
match "ask_requests/auth_request" => "ask_requests#auth_request", :as => 'auth_request'
|
match "ask_requests/auth_request" => "ask_requests#auth_request", :as => 'auth_request'
|
||||||
|
match "ask_requests/transfer_request" => "ask_requests#transfer_request", :as => 'transfer_request'
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :front_end do
|
namespace :front_end do
|
||||||
|
|
Loading…
Reference in New Issue