Compare commits
14
Commits
0913_ntu_ga
...
mtu_ga_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c361a7a201 | ||
|
|
b7bf180df2 | ||
|
|
71dad22b04 | ||
|
|
883496ede1 | ||
|
|
0a1ebf18e3 | ||
|
|
3f9cdec426 | ||
|
|
24b9f4015b | ||
|
|
1237a111ca | ||
|
|
64e14d42e2 | ||
|
|
cc7a4ffb6d | ||
|
|
da40c2b669 | ||
|
|
bf5416095e | ||
|
|
8cd27e26e2 | ||
|
|
d98d008806 |
No files matched your search
Vendored
+57
-1
@@ -1,5 +1,5 @@
|
||||
# encoding: utf-8
|
||||
class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
|
||||
|
||||
include AdminHelper
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
|
||||
@@ -21,11 +21,67 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
|
||||
end
|
||||
|
||||
def update
|
||||
@ask_question = AskQuestion.find(params[:ask_question_id])
|
||||
@ask_reply = AskReply.find(params[:id])
|
||||
@ask_reply.update_attributes(params[:ask_reply])
|
||||
if @ask_reply.send_email?
|
||||
Resque.enqueue(SendAskReplyMail, @ask_reply.ask_question.id)
|
||||
end
|
||||
|
||||
params[:school][:depts].each do |dns|
|
||||
send_request(dns, @ask_question, @ask_reply)
|
||||
end unless params[:school].nil?
|
||||
|
||||
redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success')
|
||||
end
|
||||
|
||||
def send_request(dep_dns, current_question, current_reply)
|
||||
require 'net/http'
|
||||
require 'uri'
|
||||
require 'json'
|
||||
|
||||
uri_path = "/panel/ask/back_end/ask_requests/auth_request"
|
||||
uri = URI.parse("http://" + dep_dns + uri_path)
|
||||
|
||||
body = {
|
||||
'auth_token' => '3kjlfksjDFJ'
|
||||
}
|
||||
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
request = Net::HTTP::Post.new(uri.request_uri)
|
||||
request.set_form_data(body)
|
||||
response = http.request(request)
|
||||
puts "Response #{response.code} #{response.message}: #{response.body}"
|
||||
|
||||
if response.code == "200"
|
||||
uri_path = "/panel/ask/back_end/ask_requests/transfer_request"
|
||||
uri = URI.parse("http://" + dep_dns + uri_path)
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
request = Net::HTTP::Post.new(uri.request_uri)
|
||||
body = {
|
||||
'name' => current_question.name,
|
||||
'title' => current_question.title,
|
||||
'identity' => current_question.identity,
|
||||
'email' => current_question.email,
|
||||
'phone' => current_question.phone,
|
||||
'tax' => current_question.tax,
|
||||
'content' => current_question.content,
|
||||
}
|
||||
request.set_form_data(body)
|
||||
response = http.request(request)
|
||||
|
||||
if response.code != "200"
|
||||
new_status = "轉介其他單位" + "(" + response.code + ")"
|
||||
current_reply.update_attributes(status: new_status)
|
||||
else
|
||||
new_status = "轉介其他單位" + "(" + "success!" + ")"
|
||||
current_reply.update_attributes(status: new_status)
|
||||
end
|
||||
end
|
||||
|
||||
puts "Response #{response.code} #{response.message}: #{response.body}"
|
||||
# flash[:notice] = response.body
|
||||
# flash[:notice] = "Response #{response.code} #{response.message}: #{response.body}"
|
||||
end
|
||||
|
||||
end
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
# encoding: utf-8
|
||||
class Panel::Ask::BackEnd::AskRequestsController < OrbitBackendController
|
||||
|
||||
include AdminHelper
|
||||
include OrbitControllerLib::DivisionForDisable
|
||||
|
||||
def auth_request
|
||||
render :json => "#{params}"
|
||||
end
|
||||
|
||||
def transfer_request
|
||||
|
||||
if !AskCategory.where(key: "transfered_question").any?
|
||||
@ask_category = AskCategory.new(name: "transfered_question", key: "transfered_question")
|
||||
@ask_category.save!
|
||||
end
|
||||
category = AskCategory.where(key: "transfered_question")
|
||||
|
||||
@transfered_question = AskQuestion.new(
|
||||
name: params['name'],
|
||||
identity: params['identity'],
|
||||
email: params['email'],
|
||||
phone: params['phone'],
|
||||
tax: params['tax'],
|
||||
title: params['title'],
|
||||
content: params['content'],
|
||||
ask_category_id: category.first.id)
|
||||
@transfered_question.ask_reply = AskReply.new
|
||||
@transfered_question.ask_reply.update_attributes(status: "待處理(轉)")
|
||||
@transfered_question.save
|
||||
|
||||
render :json => "#{params}"
|
||||
end
|
||||
|
||||
end
|
||||
+52
@@ -1,3 +1,37 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
if ($("#ask_reply_status").val() == '轉介其他單位') { $('.dept_options').show(); }
|
||||
|
||||
$("#ask_reply_status").change(function() {
|
||||
|
||||
var local_host = "<%= request.host %>:<%= request.port %>";
|
||||
|
||||
$('input[type=checkbox]').each(function() {
|
||||
if ($(this).val() == local_host) {
|
||||
$(this).addClass("hide");
|
||||
$(this).next().addClass("hide");
|
||||
}
|
||||
});
|
||||
|
||||
$('.dept_options').slideUp();
|
||||
if ($(this).find('option:selected').attr('value') == '轉介其他單位') {
|
||||
$('.dept_options').slideDown();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
.dept_options {
|
||||
display: none;
|
||||
}
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="ask_question_reply">
|
||||
<%= form_for @ask_reply, url: @url, method: @method do |f| %>
|
||||
<table class="table">
|
||||
@@ -31,7 +65,25 @@
|
||||
['已處理', '已處理'],
|
||||
['轉介其他單位', '轉介其他單位']
|
||||
] %></td>
|
||||
<td id="XXX"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" class="dept_options">
|
||||
<div class="dept_options">
|
||||
<%= check_box("school", "depts", {:multiple => true}, "localhost:3000", nil) %><%= label_tag("localhost:3000", "總務長室暨總務處秘書室") %>
|
||||
<%= check_box("school", "depts", {:multiple => true}, "localhost:4000", nil) %><%= label_tag("localhost:4000", "文書組") %>
|
||||
<%= check_box("school", "depts", {:multiple => true}, "事務組", nil) %><%= label_tag(:dep3, "事務組") %>
|
||||
<%= check_box("school", "depts", {:multiple => true}, "保管組", nil) %><%= label_tag(:dep4, "保管組") %>
|
||||
<%= check_box("school", "depts", {:multiple => true}, "營繕組", nil) %><%= label_tag(:dep5, "營繕組") %>
|
||||
<%= check_box("school", "depts", {:multiple => true}, "出納組", nil) %><%= label_tag(:dep6, "出納組") %>
|
||||
<%= check_box("school", "depts", {:multiple => true}, "採購組", nil) %><%= label_tag(:dep7, "採購組") %>
|
||||
<%= check_box("school", "depts", {:multiple => true}, "經營管理組", nil) %><%= label_tag(:dep8, "經營管理組") %>
|
||||
<%= check_box("school", "depts", {:multiple => true}, "駐警隊", nil) %><%= label_tag(:dep9, "駐警隊") %>
|
||||
<%= check_box("school", "depts", {:multiple => true}, "社科院總務分處", nil) %><%= label_tag(:dep10, "社科院總務分處") %>
|
||||
<%= check_box("school", "depts", {:multiple => true}, "醫學院總務分處", nil) %><%= label_tag(:dep11, "醫學院總務分處") %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<%= f.label :send_email %><%= f.radio_button :send_email, 1, checked: @ask_reply.send_email? %><%= t('ask.yes') %>
|
||||
|
||||
File renamed without changes.
+1
-1
@@ -35,7 +35,7 @@ $(document).ready(function(){
|
||||
<div class="control-group">
|
||||
<%= f.label :ask_category_id, class: 'control-label required' %>
|
||||
<div class="controls">
|
||||
<%= f.collection_select :ask_category_id, AskCategory.all, :id, :name %>
|
||||
<%= f.collection_select :ask_category_id, AskCategory.all.select { |c| c.key != 'transfered_question' }, :id, :name %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
||||
+4
-1
@@ -11,10 +11,13 @@ Rails.application.routes.draw do
|
||||
end
|
||||
resources :ask_replies
|
||||
end
|
||||
|
||||
|
||||
resources :ask_categories
|
||||
resources :ask_acknowledgements
|
||||
resources :ask_admins
|
||||
|
||||
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
|
||||
|
||||
namespace :front_end do
|
||||
|
||||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
+1
-1
@@ -17,6 +17,6 @@
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_panel_faq_back_end_qa_path, :class => 'btn btn-primary pull-right' if (is_manager? rescue nil) %>
|
||||
<div id="qa_pagination" class="paginationFixed">
|
||||
<%= paginate @qas, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||
<%= paginate @qas, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} rescue nil %>
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user