fix category setiing new problem and add ask time for admin index
This commit is contained in:
parent
e54a180511
commit
96b601074b
|
@ -92,7 +92,7 @@ class Admin::AsksController < OrbitAdminController
|
||||||
@categories = @module_app.categories
|
@categories = @module_app.categories
|
||||||
@filter_fields = filter_fields(@categories, @tags)
|
@filter_fields = filter_fields(@categories, @tags)
|
||||||
# 列表欄位
|
# 列表欄位
|
||||||
@table_fields = [:situation, :category, 'title' , 'ask.name', 'ask.phone', 'ask.appointment']
|
@table_fields = [:situation, :category, 'title' , 'ask.name', 'ask.phone', 'ask.appointment','ask.created_at']
|
||||||
# 列表排序
|
# 列表排序
|
||||||
# debugger
|
# debugger
|
||||||
if filter2("situation").blank? and filter2("identity").blank?
|
if filter2("situation").blank? and filter2("identity").blank?
|
||||||
|
|
|
@ -133,7 +133,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" style="text-align: center;">
|
<td colspan="2" style="text-align: center;">
|
||||||
<%= hidden_field_tag :delete_field, nil,{'class'=> 'delete_field' } %>
|
<%= hidden_field_tag :delete_field, nil,{'class'=> 'delete_field' } %>
|
||||||
<%= f.hidden_field :id, value: ask_setting.id %>
|
<% if !ask_setting.new_record? %>
|
||||||
|
<%= f.hidden_field :id, value: ask_setting.id %>
|
||||||
|
<% end %>
|
||||||
<input class="btn btn-primary" type="submit" value="<%= submit_text %>">
|
<input class="btn btn-primary" type="submit" value="<%= submit_text %>">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<%
|
<%
|
||||||
ask_setting = @ask_setting
|
ask_setting = @ask_setting
|
||||||
set_input_name('ask_question')
|
set_input_name('ask_question')
|
||||||
%>
|
%>
|
||||||
<% content_for :page_specific_css do %>
|
<% content_for :page_specific_css do %>
|
||||||
<%= stylesheet_link_tag "lib/main-forms" %>
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||||
|
@ -14,104 +14,109 @@
|
||||||
<%# javascript_include_tag "jquery.ui.datepicker.monthyearpicker" %>
|
<%# javascript_include_tag "jquery.ui.datepicker.monthyearpicker" %>
|
||||||
<%# javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
<%# javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.input-area tr td {
|
.input-area tr td {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.form-horizontal .control-label {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('input:file').change(function(e){
|
$('input:file').change(function(e){
|
||||||
var fileName = e.target.files[0].name;
|
var fileName = e.target.files[0].name;
|
||||||
$(this).parents(".file-selector").eq(0).find('.filename').html(fileName);
|
$(this).parents(".file-selector").eq(0).find('.filename').html(fileName);
|
||||||
})
|
})
|
||||||
$('input:file').each(function(i,v){
|
$('input:file').each(function(i,v){
|
||||||
|
|
||||||
var filename = $(v).attr('value')
|
var filename = $(v).attr('value')
|
||||||
if (filename){
|
if (filename){
|
||||||
if ($(v).attr('data-image-src')){
|
if ($(v).attr('data-image-src')){
|
||||||
$(v).parents(".file-selector").eq(0).find('.filename').html("<img src=\""+$(v).attr('data-image-src')+"\">"+filename);
|
$(v).parents(".file-selector").eq(0).find('.filename').html("<img src=\""+$(v).attr('data-image-src')+"\">"+filename);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$(v).parents(".file-selector").eq(0).find('.filename').html("<a href=\""+$(v).attr('data-src')+"\">"+filename);
|
$(v).parents(".file-selector").eq(0).find('.filename').html("<a href=\""+$(v).attr('data-src')+"\">"+filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<div class="input-area">
|
<div class="input-area">
|
||||||
<div id="ask-asks">
|
<div id="ask-asks">
|
||||||
<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) %>:
|
<!-- <td><%# AskQuestion.human_attribute_name(:identity) %>:
|
||||||
<%# Tag.where({:id => @ask_question[:identity]}).each do |tag| %>
|
<%# Tag.where({:id => @ask_question[:identity]}).each do |tag| %>
|
||||||
<%# tag.name %>
|
<%# tag.name %>
|
||||||
<%# end %>
|
<%# end %>
|
||||||
</td> -->
|
</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> -->
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5"><%= t('title') %>:<%= f.text_field :title %></td>
|
<td colspan="5"><%= t('title') %>:<%= @ask_question.title %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5"><%= AskQuestion.human_attribute_name(:appointment) %>:<%= @ask_question.appointment.strftime("%Y-%m-%d %H:%M") rescue nil %></td>
|
<td colspan="5"><%= AskQuestion.human_attribute_name(:appointment) %>:<%= @ask_question.appointment.strftime("%Y-%m-%d %H:%M") rescue nil %></td>
|
||||||
<!-- <td colspan="5"><%# AskQuestion.human_attribute_name(:name) %>:<%# @ask_question.name %></td> -->
|
<!-- <td colspan="5"><%# AskQuestion.human_attribute_name(:name) %>:<%# @ask_question.name %></td> -->
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<!-- <td colspan="5"><%# AskQuestion.human_attribute_name(:name) %>:<br/><%# @ask_question.name.gsub(/[(\n)(\r)]/, "\n" => "<br/>", "\r" => "" ).html_safe %></td> -->
|
<!-- <td colspan="5"><%# AskQuestion.human_attribute_name(:name) %>:<br/><%# @ask_question.name.gsub(/[(\n)(\r)]/, "\n" => "<br/>", "\r" => "" ).html_safe %></td> -->
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5">
|
<td colspan="5">
|
||||||
<%= f.label :reply %>
|
<%= f.label :reply %>
|
||||||
<br/> <%= f.text_area :reply, rows: 10, style: 'width: 500px' %>
|
<br/> <%= f.text_area :reply, rows: 10, style: 'width: 500px' %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5">
|
<td colspan="5">
|
||||||
<%= f.label :comment %>
|
<%= f.label :comment %>
|
||||||
<br/> <%= f.text_field :comment, style: 'width: 500px' %></td>
|
<br/> <%= @ask_question.comment %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5"><%= f.label :agree_show %><%= f.select :agree_show,[[t('ask.no'),false],[t('ask.yes'),true]] %></td>
|
<td colspan="5"><%= f.label :agree_show %><%= @ask_question.agree_show ? t('ask.yes') : t('ask.no') %>
|
||||||
</tr>
|
</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td colspan="5"><%= f.label t('situation') %> <%= f.select :situation, [
|
<tr>
|
||||||
[t('ask.is_waiting'), 'is_waiting'],
|
<td colspan="5"><%= f.label t('situation') %>
|
||||||
[t('ask.is_processed'), 'is_processed'],
|
<% tmp = {'is_waiting'=>t('ask.is_waiting'),
|
||||||
[t('ask.is_referral'), 'is_referral'],
|
'is_processed'=>t('ask.is_processed'),
|
||||||
[t('ask.is_published'),'is_published']
|
'is_referral'=>t('ask.is_referral'),
|
||||||
] %></td>
|
'is_published'=>t('ask.is_published')} %>
|
||||||
</tr>
|
<%= tmp[@ask_question.situation] %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5">
|
<td colspan="5">
|
||||||
<%= f.label :send_email %><%= f.radio_button :send_email, 1, checked: @ask_question.send_email? %><%= t('ask.yes') %>
|
<%= f.label :send_email %><%= f.radio_button :send_email, 1, checked: @ask_question.send_email? %><%= t('ask.yes') %>
|
||||||
|
|
||||||
<%= f.radio_button :send_email, 0, checked: !@ask_question.send_email? %><%= t('ask.no') %>
|
<%= f.radio_button :send_email, 0, checked: !@ask_question.send_email? %><%= t('ask.no') %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<%= ask_setting.custom_fields.collect do |k,v|
|
<%= ask_setting.custom_fields.collect do |k,v|
|
||||||
required_pattern = v['required']=='true' ? '*' : ''
|
required_pattern = v['required']=='true' ? '*' : ''
|
||||||
"<div class=\"control-group\">
|
"<div class=\"control-group\">
|
||||||
<label class=\"control-label\">#{required_pattern}#{v['field'][I18n.locale]}</label>
|
<label class=\"control-label\">#{required_pattern}#{v['field'][I18n.locale]}</label>
|
||||||
<div class=\"controls\">
|
<div class=\"controls\">
|
||||||
#{show_on_front(k,v,@ask_question.custom_values[k])}
|
#{show_on_front(k,v,@ask_question.custom_values[k],true)}
|
||||||
</div>
|
</div>
|
||||||
</div>"
|
</div>"
|
||||||
end.join.html_safe %>
|
end.join.html_safe %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%
|
<%
|
||||||
cancel_href = url_for(:back)
|
cancel_href = url_for(:back)
|
||||||
if cancel_href == 'javascript:history.back()'
|
if cancel_href == 'javascript:history.back()'
|
||||||
now_ask_page = AskQuestion.order_by(:id).map(&:id).map.with_index.select{|v,i| v==@ask_question.id}[0][1] rescue nil
|
now_ask_page = AskQuestion.order_by(:id).map(&:id).map.with_index.select{|v,i| v==@ask_question.id}[0][1] rescue nil
|
||||||
now_ask_page = now_ask_page.nil? ? 1 : ((now_ask_page+1).to_f/10).ceil
|
now_ask_page = now_ask_page.nil? ? 1 : ((now_ask_page+1).to_f/10).ceil
|
||||||
cancel_href = "/#{I18n.locale}/admin/asks?page=#{now_ask_page}"
|
cancel_href = "/#{I18n.locale}/admin/asks?page=#{now_ask_page}"
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
<% if @ask_setting.default_setting['appointment'] %>
|
<% if @ask_setting.default_setting['appointment'] %>
|
||||||
<td><%= b.appointment.strftime("%Y-%m-%d %H:%M") rescue nil %></td>
|
<td><%= b.appointment.strftime("%Y-%m-%d %H:%M") rescue nil %></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<td><%= b.created_at.strftime("%Y-%m-%d %H:%M") rescue nil %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -13,6 +13,7 @@ en:
|
||||||
select_category: '-----Select a category-----'
|
select_category: '-----Select a category-----'
|
||||||
save_data: Save as pdf
|
save_data: Save as pdf
|
||||||
print: Print
|
print: Print
|
||||||
|
created_at: Ask Time
|
||||||
ask_time: Ask Time
|
ask_time: Ask Time
|
||||||
custom_format_explain: use checkbox format to show custom-field's value
|
custom_format_explain: use checkbox format to show custom-field's value
|
||||||
output_result: Output result
|
output_result: Output result
|
||||||
|
|
Loading…
Reference in New Issue