Fix naming error

This commit is contained in:
Bernie Chiu 2013-09-17 12:02:35 +08:00
parent 0c29701f9b
commit e89615a6f3
4 changed files with 19 additions and 37 deletions

View File

@ -1,24 +0,0 @@
defaults: &defaults
host: localhost
# slaves:
# - host: slave1.local
port: 27017
# - host: slave2.local
# port: 27019
development:
<<: *defaults
database: test_site
test:
<<: *defaults
database: test_site
# set these environment variables on your prod server
production:
# host: <%= ENV['MONGOID_HOST'] %>
# port: <%= ENV['MONGOID_PORT'] %>
# username: <%= ENV['MONGOID_USERNAME'] %>
# password: <%= ENV['MONGOID_PASSWORD'] %>
# database: <%= ENV['MONGOID_DATABASE'] %>
<<: *defaults
database: test_site

View File

@ -44,7 +44,7 @@ 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)
body = { body = {
# 'auth_token' => '3kjlfksjDFJ', # 'auth_token' => '3kjlfksjDFJ',
'name' => current_question.name, 'name' => current_question.name,
'title' => current_question.title, 'title' => current_question.title,
'identity' => current_question.identity, 'identity' => current_question.identity,
@ -53,6 +53,7 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
'tax' => current_question.tax, 'tax' => current_question.tax,
'content' => current_question.content, 'content' => current_question.content,
} }
request.set_form_data(body) request.set_form_data(body)
request.add_field 'X-Auth-Token', '3kjlfksjDFJ' request.add_field 'X-Auth-Token', '3kjlfksjDFJ'
response = http.request(request) response = http.request(request)
@ -61,7 +62,7 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
new_status = "轉介其他單位" + "(" + response.code + ")" new_status = "轉介其他單位" + "(" + response.code + ")"
current_reply.update_attributes(status: new_status) current_reply.update_attributes(status: new_status)
else else
new_status = "轉介其他單位" + "(" + "success!" + ")" new_status = "轉介其他單位" + "(" + " Success!" + ")"
current_reply.update_attributes(status: new_status) current_reply.update_attributes(status: new_status)
end end

View File

@ -7,23 +7,28 @@ class Panel::Ask::BackEnd::AskRequestsController < OrbitBackendController
def transfer_request def transfer_request
if request.headers["HTTP_X_AUTH_TOKEN"] == '3kjlfksjDFJ' if request.headers["HTTP_X_AUTH_TOKEN"] == '3kjlfksjDFJ'
if !AskCategory.where(key: "transfered_question").any? if !AskCategory.where(key: "transferred_question").any?
@ask_category = AskCategory.new(name: "transfered_question", key: "transfered_question") @ask_category = AskCategory.new(key: "transferred_question")
@ask_category.name_translations = { "zh_tw" => "轉介的問題", "en" => "Transferred Question" }
@ask_category.save! @ask_category.save!
end end
category = AskCategory.where(key: "transfered_question")
category = AskCategory.where(key: "transferred_question")
@transfered_question = AskQuestion.new( @transfered_question = AskQuestion.new(
name: params['name'], name: params['name'],
identity: params['identity'], identity: params['identity'],
email: params['email'], email: params['email'],
phone: params['phone'], phone: params['phone'],
tax: params['tax'], tax: params['tax'],
title: params['title'], title: params['title'],
content: params['content'], content: params['content'],
ask_category_id: category.first.id) ask_category_id: category.first.id)
@transfered_question.ask_reply = AskReply.new @transfered_question.ask_reply = AskReply.new
@transfered_question.ask_reply.update_attributes(status: "待處理(轉)") @transfered_question.ask_reply.update_attributes(status: "待處理 (轉)")
@transfered_question.save @transfered_question.save
render :nothing => true render :nothing => true
else else
render :status => 500 render :status => 500

View File

@ -1,7 +1,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
if ($("#ask_reply_status").val() == '轉介其他單位') { $('.dept_options').show(); } // if ($("#ask_reply_status").val() == '轉介其他單位') { $('.dept_options').show(); }
$("#ask_reply_status").change(function() { $("#ask_reply_status").change(function() {