adjust tag and sort
This commit is contained in:
parent
6b0a6a1fc8
commit
d33b0fe5a7
|
@ -9,70 +9,48 @@ class Admin::AsksController < OrbitAdminController
|
||||||
@app_title = "ask"
|
@app_title = "ask"
|
||||||
end
|
end
|
||||||
|
|
||||||
# 重新定義排序
|
def filter_fields(categories, tags)
|
||||||
def sort
|
|
||||||
unless params[:sort].blank?
|
|
||||||
case params[:sort]
|
|
||||||
when "status"
|
|
||||||
@sort = {:status=>params[:order]}
|
|
||||||
when "category"
|
|
||||||
@sort = {:category_id=>params[:order]}
|
|
||||||
when "start_date"
|
|
||||||
@sort = {:postdate=>params[:order]}
|
|
||||||
when "end_date"
|
|
||||||
@sort = {:deadline=>params[:order]}
|
|
||||||
when "last_modified"
|
|
||||||
@sort = {:update_user_id=>params[:order]}
|
|
||||||
when "banner"
|
|
||||||
@sort = {'banner_id'=>params[:order]}
|
|
||||||
when "banner_name"
|
|
||||||
@sort = {:title=>params[:order]}
|
|
||||||
when "effect"
|
|
||||||
@sort = {:ad_fx=>params[:order]}
|
|
||||||
when "transition_interval"
|
|
||||||
@sort = {:timeout=>params[:order]}
|
|
||||||
when "transition_speed"
|
|
||||||
@sort = {:speed=>params[:order]}
|
|
||||||
when "size"
|
|
||||||
@sort = {:height=>params[:order]}
|
|
||||||
when "link"
|
|
||||||
@sort = {:out_link=>params[:order]}
|
|
||||||
else
|
|
||||||
s = Sanitize.clean(params[:sort]).to_sym
|
|
||||||
@sort = {s=>params[:order]}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@sort = {:created_at=>'desc'}
|
|
||||||
end
|
|
||||||
@sort
|
|
||||||
end
|
|
||||||
|
|
||||||
# 重新定義分類搜尋
|
|
||||||
def filter_fields(categories)
|
|
||||||
{
|
{
|
||||||
:status=>[{:title=>"待處理",:id=>"is_hot"},{:title=>"已處理",:id=>"is_top"},{:title=>"轉介其他單位",:id=>"is_hidden"}],
|
:situation=>[{:title=>"is_waiting",:id=>"is_waiting"},{:title=>"is_processed",:id=>"is_processed"},{:title=>"is_referral",:id=>"is_referral"}],
|
||||||
:category=>categories.map{|c| {:title=>(c.title.blank? ? " " : c.title), :id=>c.id}}
|
:category=>categories.map{|c| {:title=>(c.title.blank? ? " " : c.title), :id=>c.id}},
|
||||||
|
:identity=>tags.map{|tag| {:title=>(tag.name.blank? ? " " : tag.name), :id=>tag.id}}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
# 抓取網址的狀態參數
|
# 抓取網址的狀態參數
|
||||||
def filter2(type)
|
def filter2(type)
|
||||||
case type
|
case type
|
||||||
when "status"
|
when "situation"
|
||||||
params[:filters][:status].blank? ? [] : params[:filters][:status] rescue []
|
params[:filters][:situation].blank? ? [] : params[:filters][:situation] rescue []
|
||||||
|
when "identity"
|
||||||
|
params[:filters][:identity].blank? ? [] : params[:filters][:identity] rescue []
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@tags = @module_app.tags
|
||||||
@categories = @module_app.categories
|
@categories = @module_app.categories
|
||||||
@filter_fields = filter_fields(@categories)
|
@filter_fields = filter_fields(@categories, @tags)
|
||||||
# 列表欄位
|
# 列表欄位
|
||||||
@table_fields = [:status, :category, :title, 'ask.name', 'ask.created_at']
|
@table_fields = [:situation, :category, :title, 'ask.name', 'ask.created_at']
|
||||||
# 列表排序
|
# 列表排序
|
||||||
if filter2("status").blank?
|
# debugger
|
||||||
@askquestions = AskQuestion.order_by(sort) .with_categories(filters("category"))
|
if filter2("situation").blank? and filter2("identity").blank?
|
||||||
|
@askquestions = AskQuestion.order_by(sort)
|
||||||
|
.with_categories(filters("category"))
|
||||||
|
elsif filter2("situation").blank?
|
||||||
|
@askquestions = AskQuestion.order_by(sort)
|
||||||
|
.with_categories(filters("category"))
|
||||||
|
.any_in(:identity => filter2("identity"))
|
||||||
|
elsif filter2("identity").blank?
|
||||||
|
@askquestions = AskQuestion.order_by(sort)
|
||||||
|
.with_categories(filters("category"))
|
||||||
|
.any_in(:situation => filter2("situation"))
|
||||||
else
|
else
|
||||||
@askquestions = AskQuestion.order_by(sort) .with_categories(filters("category")) .where(:status.in => filter2("status"))
|
@askquestions = AskQuestion.order_by(sort)
|
||||||
|
.with_categories(filters("category"))
|
||||||
|
.any_in(:identity => filter2("identity"))
|
||||||
|
.any_in(:situation => filter2("situation"))
|
||||||
end
|
end
|
||||||
|
|
||||||
# 分頁
|
# 分頁
|
||||||
|
@ -82,6 +60,10 @@ class Admin::AsksController < OrbitAdminController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def search_tag(tag)
|
||||||
|
Tag.find(tag).name_translations{}
|
||||||
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@ask_question = AskQuestion.find(params[:id])
|
@ask_question = AskQuestion.find(params[:id])
|
||||||
@url = admin_ask_path(@ask_question)
|
@url = admin_ask_path(@ask_question)
|
||||||
|
@ -149,16 +131,18 @@ class Admin::AsksController < OrbitAdminController
|
||||||
AskQuestion.human_attribute_name(:reply),
|
AskQuestion.human_attribute_name(:reply),
|
||||||
AskQuestion.human_attribute_name(:comment)]
|
AskQuestion.human_attribute_name(:comment)]
|
||||||
@ask_questions.each do |ask_question|
|
@ask_questions.each do |ask_question|
|
||||||
csv << [ ask_question.category.title,
|
Tag.where({:id => ask_question[:identity]}).each do |tag|
|
||||||
ask_question.name,
|
csv << [ ask_question.category.title,
|
||||||
ask_question[:identity],
|
ask_question.name,
|
||||||
ask_question.mail,
|
tag.name,
|
||||||
ask_question.phone,
|
ask_question.mail,
|
||||||
ask_question.fax,
|
ask_question.phone,
|
||||||
ask_question.title,
|
ask_question.fax,
|
||||||
ask_question.content,
|
ask_question.title,
|
||||||
ask_question.reply,
|
ask_question.content,
|
||||||
ask_question.comment ]
|
ask_question.reply,
|
||||||
|
ask_question.comment ]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
send_data csv.encode('Big5'), type: 'text/csv', filename: "Questions-#{date_start}-#{date_end}.csv"
|
send_data csv.encode('Big5'), type: 'text/csv', filename: "Questions-#{date_start}-#{date_end}.csv"
|
||||||
|
|
|
@ -7,10 +7,12 @@ class AsksController < ApplicationController
|
||||||
def index
|
def index
|
||||||
module_app = ModuleApp.where(:key => "ask").first
|
module_app = ModuleApp.where(:key => "ask").first
|
||||||
categories = module_app.categories
|
categories = module_app.categories
|
||||||
|
tags = module_app.tags
|
||||||
ask_question = AskQuestion.new
|
ask_question = AskQuestion.new
|
||||||
{
|
{
|
||||||
"ask_question" => ask_question,
|
"ask_question" => ask_question,
|
||||||
"categories" => categories,
|
"categories" => categories,
|
||||||
|
"tags" => tags,
|
||||||
"module_app" => module_app
|
"module_app" => module_app
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
class AskQuestion
|
class AskQuestion
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
include ActiveModel::Validations
|
# include ActiveModel::Validations
|
||||||
include OrbitCategory::Categorizable
|
include OrbitCategory::Categorizable
|
||||||
|
include OrbitTag::Taggable
|
||||||
|
|
||||||
# 欄位
|
# 欄位
|
||||||
field :name, type: String
|
field :name, type: String
|
||||||
|
@ -15,11 +16,11 @@ class AskQuestion
|
||||||
|
|
||||||
field :reply, type: String
|
field :reply, type: String
|
||||||
field :comment, type: String
|
field :comment, type: String
|
||||||
field :status, type: String, default: "is_hot" #預設待處理
|
field :situation, type: String, default: "is_waiting" #預設待處理
|
||||||
field :send_email, type: Boolean, default: false
|
field :send_email, type: Boolean, default: false
|
||||||
field :email_id
|
field :email_id
|
||||||
|
|
||||||
validates_presence_of :name, :identity, :mail, :title, :content
|
# validates_presence_of :name, :identity, :mail, :title, :content
|
||||||
|
|
||||||
def email
|
def email
|
||||||
mail = Email.find(self.email_id) rescue nil
|
mail = Email.find(self.email_id) rescue nil
|
||||||
|
|
|
@ -1,186 +0,0 @@
|
||||||
<% content_for :right_nav do %>
|
|
||||||
<% if !search_dom_id.nil?%>
|
|
||||||
<div class="searchClear pull-left" style="clear: left;">
|
|
||||||
<form id="module-search-form">
|
|
||||||
<input type="text" id="filter-input" class="search-query input-medium" placeholder="<%= t(:search_) %>" value="<%=params[:keywords]%>">
|
|
||||||
</form>
|
|
||||||
<img id="search-preloader" src="/assets/preloader.gif" style="height: 40px; position: absolute; left: 220px; top: -5px; display:none;">
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<ul class="nav nav-pills filter-nav pull-right">
|
|
||||||
<% fields.keys.each do |field| %>
|
|
||||||
<li class="accordion-group">
|
|
||||||
<div class="accordion-heading">
|
|
||||||
<a href="#collapse-<%= field %>" data-toggle="collapse" data-parent="#filter" class="accordion-toggle"><%= t(field) %></a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
<div class="filter-group accordion-group">
|
|
||||||
<% fields.keys.each do |field| %>
|
|
||||||
<div class="accordion-body collapse" id="collapse-<%= field %>">
|
|
||||||
<div class="accordion-inner pagination-right" data-toggle="buttons-checkbox">
|
|
||||||
<% fields[field].each do |val| %>
|
|
||||||
<%= link_to (val[:title].blank? ? "" : t(val[:title])), "#", :onclick => "filter.addFilter('filters[#{field}][]=#{val[:id]}')", :class => "btn btn-small #{is_filter_active?(field, val[:id])}", :id => "filter_#{val[:id]}" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<div class="filter-clear">
|
|
||||||
<a href="#" onclick="filter.clearFilter();" class="btn btn-link btn-small"><i class="icons-cycle"></i> <%= t(:clear) %></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<script type="text/javascript">
|
|
||||||
<% if !search_dom_id.nil?%>
|
|
||||||
var interval = 0;
|
|
||||||
var keyword;
|
|
||||||
var searchLock=false;
|
|
||||||
|
|
||||||
$("#filter-input").bind("input", function() {queueSearch();});
|
|
||||||
$("#module-search-form").submit(function(){queueSearch(); return false; });
|
|
||||||
|
|
||||||
var params = function(key){
|
|
||||||
var result = {};
|
|
||||||
var datas = window.location.search ? window.location.search.replace('?','').split('&') : []
|
|
||||||
datas.map(function(data){
|
|
||||||
tmp = data.split("=");
|
|
||||||
tmp[1] = decodeURIComponent(tmp[1]);
|
|
||||||
if(key){
|
|
||||||
if(tmp[0]==key){
|
|
||||||
if(tmp[0].indexOf('[]')>=0){
|
|
||||||
if(!Array.isArray(result)) result = [];
|
|
||||||
result.push(tmp[1]);
|
|
||||||
}else{
|
|
||||||
result = tmp[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(tmp[0].indexOf('[]')>=0){
|
|
||||||
if(typeof(result[tmp[0]]) == "undefined") result[tmp[0]] = [];
|
|
||||||
result[tmp[0]].push(tmp[1]);
|
|
||||||
}else{
|
|
||||||
result[tmp[0]] = tmp[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
var queueSearch = function(){
|
|
||||||
if($("#filter-input").val()!=keyword){
|
|
||||||
keyword = $("#filter-input").val();
|
|
||||||
interval=500;
|
|
||||||
if(!searchLock) moduleSearch();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var moduleSearch = function(){
|
|
||||||
$("#search-preloader").fadeIn();
|
|
||||||
searchLock = true;
|
|
||||||
if(interval==0){
|
|
||||||
url = document.URL;
|
|
||||||
url = url.replace('#','');
|
|
||||||
if(url.indexOf("keywords=")>=0){
|
|
||||||
url = url.replace("keywords="+encodeURIComponent(params("keywords")),"keywords="+keyword)
|
|
||||||
}else{
|
|
||||||
url = (url.indexOf("?")>=0) ? url+"&keywords="+keyword : url+"?keywords="+keyword
|
|
||||||
}
|
|
||||||
url = url.replace("page="+params("page"),"page=1");
|
|
||||||
|
|
||||||
history.pushState(null, null, url);
|
|
||||||
$.get(url,function(data){
|
|
||||||
searchLock = false;
|
|
||||||
$("#<%= search_dom_id %>").html(data);
|
|
||||||
bindPagination();
|
|
||||||
$("#search-preloader").fadeOut();
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
interval -= 100;
|
|
||||||
setTimeout(moduleSearch,100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
var bindPagination = function(){
|
|
||||||
$(".pagination a").click(function(){
|
|
||||||
filter.updateTable($(this).attr('href'),false,true);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var Filter = function(dom){
|
|
||||||
var self = this;
|
|
||||||
var makeFilters = function(){
|
|
||||||
return (window.location.search ? window.location.search.replace('?','').split('&') : []);
|
|
||||||
}
|
|
||||||
var filters = makeFilters(),
|
|
||||||
dom = $(dom),
|
|
||||||
mainUrl = window.location.pathname;
|
|
||||||
this.updateTable = function(url, goback, is_pagination){
|
|
||||||
update = true;
|
|
||||||
xurl = (url == null ? ( filters.length ? mainUrl + "?" + filters.join('&') : mainUrl ) : url);
|
|
||||||
$.ajax({
|
|
||||||
url : xurl,
|
|
||||||
type : "get",
|
|
||||||
dataType : "html"
|
|
||||||
}).done(function(data){
|
|
||||||
if(is_pagination){
|
|
||||||
history.pushState(null, null, decodeURIComponent(xurl));
|
|
||||||
}else{
|
|
||||||
if(!goback) history.replaceState(null, null, decodeURIComponent(xurl));
|
|
||||||
}
|
|
||||||
filters = makeFilters();
|
|
||||||
dom.html(data);
|
|
||||||
bindPagination();
|
|
||||||
update = false;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.addFilter = function(filter){
|
|
||||||
filters = makeFilters();
|
|
||||||
$.each(filters,function(idx,data){
|
|
||||||
if(typeof(data)=="undefined") return true;
|
|
||||||
if(data.indexOf("page=")>-1) filters.splice(idx,1);
|
|
||||||
});
|
|
||||||
|
|
||||||
if( (index = filters.indexOf(filter) ) > -1){
|
|
||||||
mainUrl = mainUrl.replace(filter,'');
|
|
||||||
filters.splice(index,1);
|
|
||||||
}else{
|
|
||||||
filters.push(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.updateTable();
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.clearFilter = function(){
|
|
||||||
$(".filter-group a.active").removeClass("active");
|
|
||||||
filters = [];
|
|
||||||
self.updateTable();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.onpopstate = function(event){
|
|
||||||
if(!update){
|
|
||||||
$("#filter-input").val( $.isEmptyObject(params('keywords')) ? "" : params('keywords') );
|
|
||||||
self.updateTable(document.location, true);
|
|
||||||
$(".filter-group .btn-small").removeClass('active');
|
|
||||||
$.each(document.location.search.split('&'),function(key,filter){
|
|
||||||
if(filter.split('=')[0].indexOf("keywords")>=0) return true;
|
|
||||||
$('#filter_'+filter.split('=')[1]).addClass('active');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
update = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var update = false;
|
|
||||||
var filter;
|
|
||||||
$(document).ready(function(){
|
|
||||||
filter = new Filter("#<%= search_dom_id %>");
|
|
||||||
bindPagination();
|
|
||||||
});
|
|
||||||
</script>
|
|
|
@ -11,7 +11,11 @@
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= AskQuestion.human_attribute_name(:name) %>:<%= @ask_question.name %></td>
|
<td><%= AskQuestion.human_attribute_name(:name) %>:<%= @ask_question.name %></td>
|
||||||
<td><%= AskQuestion.human_attribute_name(:identity) %>:<%= @ask_question[:identity] %></td>
|
<td><%= AskQuestion.human_attribute_name(:identity) %>:
|
||||||
|
<% Tag.where({:id => @ask_question[:identity]}).each do |tag| %>
|
||||||
|
<%= tag.name %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
<td><%= AskQuestion.human_attribute_name(:mail) %>:<%= @ask_question.mail %></td>
|
<td><%= AskQuestion.human_attribute_name(:mail) %>:<%= @ask_question.mail %></td>
|
||||||
<td><%= AskQuestion.human_attribute_name(:phone) %>:<%= @ask_question.phone %></td>
|
<td><%= AskQuestion.human_attribute_name(:phone) %>:<%= @ask_question.phone %></td>
|
||||||
<td><%= AskQuestion.human_attribute_name(:fax) %>:<%= @ask_question.fax %></td>
|
<td><%= AskQuestion.human_attribute_name(:fax) %>:<%= @ask_question.fax %></td>
|
||||||
|
@ -20,7 +24,7 @@
|
||||||
<td colspan="5"><%= AskQuestion.human_attribute_name(:title) %>:<%= @ask_question.title %></td>
|
<td colspan="5"><%= AskQuestion.human_attribute_name(:title) %>:<%= @ask_question.title %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5"><%= AskQuestion.human_attribute_name(:content) %>:<br/><%= @ask_question.content %></td>
|
<td colspan="5"><%= AskQuestion.human_attribute_name(:content) %>:<br/><%= @ask_question.content.gsub(/[(\n)(\r)]/, "\n" => "<br/>", "\r" => "" ).html_safe %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -35,10 +39,10 @@
|
||||||
<br/> <%= f.text_field :comment, style: 'width: 500px' %></td>
|
<br/> <%= f.text_field :comment, style: 'width: 500px' %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5"><%= f.label :status %> <%= f.select :status, [
|
<td colspan="5"><%= f.label t('situation') %> <%= f.select :situation, [
|
||||||
['待處理', 'is_hot'],
|
[t('is_waiting'), 'is_waiting'],
|
||||||
['已處理', 'is_top'],
|
[t('is_processed'), 'is_processed'],
|
||||||
['轉介其他單位', 'is_hidden']
|
[t('is_referral'), 'is_referral']
|
||||||
] %></td>
|
] %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
<% @askquestions.each do |b| %>
|
<% @askquestions.each do |b| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<% if b.status == 'is_hot' %>
|
<% if b.situation == 'is_waiting' %>
|
||||||
<span class='label label-important'><%= t('待處理') %></span>
|
<span class='label label-important'><%= t('is_waiting') %></span>
|
||||||
<% elsif b.status == 'is_top' %>
|
<% elsif b.situation == 'is_processed' %>
|
||||||
<span class='label label-success'><%= t('已處理') %></span>
|
<span class='label label-success'><%= t('is_processed') %></span>
|
||||||
<% elsif b.status == 'is_hidden' %>
|
<% elsif b.situation == 'is_referral' %>
|
||||||
<span class='label'><%= t('轉介其他單位') %></span>
|
<span class='label'><%= t('is_referral') %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td><%= b.category.title %></td>
|
<td><%= b.category.title %></td>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>
|
<p>
|
||||||
<%= @data['reply'] %>
|
<%= @data['reply'].gsub(/[(\n)(\r)]/, "\n" => "<br/>", "\r" => "" ).html_safe %>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<p>此為系統自動發信,請勿直接回覆</p>
|
<p>此為系統自動發信,請勿直接回覆</p>
|
||||||
|
|
|
@ -7,28 +7,32 @@
|
||||||
<h1><%= @data['title'] %></h1>
|
<h1><%= @data['title'] %></h1>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= AskQuestion.human_attribute_name(:name) %>:</td>
|
<th><%= AskQuestion.human_attribute_name(:name) %>:</th>
|
||||||
<td><%= @data['name'] %></td>
|
<td><%= @data['name'] %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= AskQuestion.human_attribute_name(:identity) %>:</td>
|
<th><%= AskQuestion.human_attribute_name(:identity) %>:</th>
|
||||||
<td><%= @data['identity'] %></td>
|
<td>
|
||||||
|
<% Tag.where({:id => @data['identity']}).each do |tag| %>
|
||||||
|
<%= tag.name %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= AskQuestion.human_attribute_name(:mail) %>:</td>
|
<th><%= AskQuestion.human_attribute_name(:mail) %>:</th>
|
||||||
<td><%= @data['mail'] %></td>
|
<td><%= @data['mail'] %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= AskQuestion.human_attribute_name(:phone) %>:</td>
|
<th><%= AskQuestion.human_attribute_name(:phone) %>:</th>
|
||||||
<td><%= @data['phone'] %></td>
|
<td><%= @data['phone'] %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= AskQuestion.human_attribute_name(:fax) %>:</td>
|
<th><%= AskQuestion.human_attribute_name(:fax) %>:</th>
|
||||||
<td><%= @data['fax'] %></td>
|
<td><%= @data['fax'] %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= AskQuestion.human_attribute_name(:content) %>:</td>
|
<th><%= AskQuestion.human_attribute_name(:content) %>:</th>
|
||||||
<td><%= @data['content'] %></td>
|
<td><%= @data['content'].gsub(/[(\n)(\r)]/, "\n" => "<br/>", "\r" => "" ).html_safe %></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p>此為系統自動發信,請勿直接回覆</p>
|
<p>此為系統自動發信,請勿直接回覆</p>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<% data = action_data
|
<% data = action_data
|
||||||
@ask_question = data["ask_question"]
|
@ask_question = data["ask_question"]
|
||||||
@categories = data["categories"]
|
@categories = data["categories"]
|
||||||
|
@tags = data["tags"]
|
||||||
@module_app = data["module_app"]
|
@module_app = data["module_app"]
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
@ -23,14 +24,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 身分 -->
|
<!-- 身分 -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<%= f.label :identity, class: 'control-label required' %>
|
<%= f.label :identity, class: 'control-label required' %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.select :identity, options_for_select( [t('ask.teacher'),
|
<%= select_tag "ask_question[identity]", options_for_select(@tags.collect{|t| [ t.name, t.id ]}) if !@tags.nil? %>
|
||||||
t('ask.stuff'),
|
|
||||||
t('ask.student'),
|
|
||||||
t('ask.schoolfellow'),
|
|
||||||
t('ask.others')].map{|i| [i, i]} ) %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Email -->
|
<!-- Email -->
|
||||||
|
|
|
@ -17,5 +17,5 @@ Gem::Specification.new do |s|
|
||||||
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||||
s.test_files = Dir["test/**/*"]
|
s.test_files = Dir["test/**/*"]
|
||||||
|
|
||||||
s.add_dependency "gotcha"
|
# s.add_dependency ~> "gotcha"
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
en:
|
en:
|
||||||
|
situation: Situation
|
||||||
|
is_waiting: Pending
|
||||||
|
is_processed: Processed
|
||||||
|
is_referral: Rreferral
|
||||||
ask:
|
ask:
|
||||||
ask: Ask
|
ask: Ask
|
||||||
all_articles: All
|
all_articles: All
|
||||||
export: Export
|
exports: Export
|
||||||
reply: Reply
|
reply: Reply
|
||||||
reply_success: Reply success
|
reply_success: Reply success
|
||||||
to: To
|
to: To
|
||||||
|
@ -15,10 +19,11 @@ en:
|
||||||
schoolfellow: Schoolfellow
|
schoolfellow: Schoolfellow
|
||||||
others: Others
|
others: Others
|
||||||
acknowledgements: Thank You
|
acknowledgements: Thank You
|
||||||
admin: Administrator
|
admins: Administrator
|
||||||
new_question: New question
|
new_question: New question
|
||||||
pending: Pending
|
|
||||||
mongoid:
|
mongoid:
|
||||||
attributes:
|
attributes:
|
||||||
ask_question:
|
ask_question:
|
||||||
ask_category_id: Ask Category
|
ask_category_id: Ask Category
|
||||||
|
identity: Identity
|
|
@ -1,4 +1,11 @@
|
||||||
zh_tw:
|
zh_tw:
|
||||||
|
|
||||||
|
situation: 狀況
|
||||||
|
identity: 身份
|
||||||
|
is_waiting: 待處理
|
||||||
|
is_processed: 已處理
|
||||||
|
is_referral: 轉介其他單位
|
||||||
|
|
||||||
module_name:
|
module_name:
|
||||||
ask: 發問
|
ask: 發問
|
||||||
recaptcha:
|
recaptcha:
|
||||||
|
@ -27,7 +34,6 @@ zh_tw:
|
||||||
acknowledgements: 感謝詞
|
acknowledgements: 感謝詞
|
||||||
admins: 管理者
|
admins: 管理者
|
||||||
new_question: 新的發問
|
new_question: 新的發問
|
||||||
pending: 待處理
|
|
||||||
|
|
||||||
mongoid:
|
mongoid:
|
||||||
attributes:
|
attributes:
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Ask
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
# widget_methods ["widget","widget1"]
|
# widget_methods ["widget","widget1"]
|
||||||
# widget_settings [{"data_count"=>10}]
|
# widget_settings [{"data_count"=>10}]
|
||||||
#taggable "AskQuestion"
|
taggable "AskQuestion"
|
||||||
categorizable
|
categorizable
|
||||||
authorizable
|
authorizable
|
||||||
frontend_enabled
|
frontend_enabled
|
||||||
|
@ -45,6 +45,13 @@ module Ask
|
||||||
:priority=>5,
|
:priority=>5,
|
||||||
:active_for_action=>{'admin/asks'=>'exports'},
|
:active_for_action=>{'admin/asks'=>'exports'},
|
||||||
:available_for => 'managers'
|
:available_for => 'managers'
|
||||||
|
context_link 'tags',
|
||||||
|
:link_path=>"admin_module_app_tags_path" ,
|
||||||
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'ask').id}",
|
||||||
|
:priority=>4,
|
||||||
|
:active_for_action=>{'admin/ask'=>'tags'},
|
||||||
|
:active_for_tag => 'Ask',
|
||||||
|
:available_for => 'managers'
|
||||||
# context_link 'new_',
|
# context_link 'new_',
|
||||||
# :link_path=>"new_admin_ask_path" ,
|
# :link_path=>"new_admin_ask_path" ,
|
||||||
# :priority=>2,
|
# :priority=>2,
|
||||||
|
|
Loading…
Reference in New Issue