diff --git a/app/controllers/admin/asks_controller.rb b/app/controllers/admin/asks_controller.rb
index 19fb8bd..1861bf3 100644
--- a/app/controllers/admin/asks_controller.rb
+++ b/app/controllers/admin/asks_controller.rb
@@ -154,8 +154,7 @@ class Admin::AsksController < OrbitAdminController
@categories = @module_app.categories.enabled.sort_by{|category| (((@module_app.asc rescue true) ? category.sort_number.to_i : -category.sort_number.to_i) rescue category.id)}
@filter_fields = filter_fields(@categories)
# 列表欄位
- @table_fields_default_fields = @ask_list_setting.default_fields.select{|f| @ask_setting.default_setting[f].nil? || @ask_setting.default_setting[f] }
- @table_fields = @table_fields_default_fields.map{|v| ['title'].include?(v) ? v : "ask.#{v}"}
+ @table_fields = @ask_list_setting.default_fields.select{|f| @ask_setting.default_setting[f].nil? || @ask_setting.default_setting[f] }
if @category_id.present?
ask_setting = AskCategorySetting.where(:category_id=>@category_id).first
tmp = ask_setting.custom_fields
diff --git a/app/models/ask_setting.rb b/app/models/ask_setting.rb
index e1f145a..c591a65 100644
--- a/app/models/ask_setting.rb
+++ b/app/models/ask_setting.rb
@@ -67,7 +67,7 @@ class AskSetting
self.default_setting_required[k]
end
def default_field_name(k,locale=I18n.locale.to_s,use_checkbox_trans=false)
- I18n.with_locale(locale){ (use_checkbox_trans && ['agree_show','agree_usage'].include?(k.to_s)) ? I18n.t("ask.#{k}_checkbox") : I18n.t("mongoid.attributes.ask_question.#{k}")}
+ I18n.with_locale(locale){ (use_checkbox_trans && ['agree_show','agree_usage'].include?(k.to_s)) ? I18n.t("ask.#{k}_checkbox") : ['serial_number','situation','ip'].include?(k) ? I18n.t("ask.#{k}") : I18n.t("mongoid.attributes.ask_question.#{k}")}
end
def field_name_translations(k)
diff --git a/app/views/admin/asks/_index.html.erb b/app/views/admin/asks/_index.html.erb
index 3a97575..74d1f46 100644
--- a/app/views/admin/asks/_index.html.erb
+++ b/app/views/admin/asks/_index.html.erb
@@ -170,8 +170,7 @@
- <% is_editable = can_edit_or_delete?(b) %>
+ <% is_editable = can_edit_or_delete?(b)
+ ask_show_url = Page.where(:module=>'ask').first.url rescue nil
+ edit_button_can_show = true
+ %>
+ <% content_for :edit_button do %>
+
+ <% end %>
<% if is_editable %><% end %> |
- <% @table_fields_default_fields.each do |f| %>
- <% case f %>
- <% when 'serial_number' %>
- <%= b.get_serial_number(last_serial_number, display_length) %> |
- <% when 'situation' %>
+ <% @table_fields.each_with_index do |f,i| %>
- <%= situation_trans[b.situation] %>
- |
- <% when 'ask_category_id' %>
-
- <%= b.category.title rescue 'category not set' %>
-
- |
- <% when 'title' %>
-
- <% if b.situation == 'is_published' %>
- <%= link_to b.title,((Page.where(:module=>'ask').first.url+"?item=#{b.id}") rescue "javascript:alert('#{t('ask.no_index_page')}')") %>
- <% else %>
- <%= b.title %>
+ <% case f %>
+ <% when 'serial_number' %>
+ <%= b.get_serial_number(last_serial_number, display_length) %>
+ <% when 'situation' %>
+ <%= situation_trans[b.situation] %>
+ <% when 'ask_category_id' %>
+ <%= b.category.title rescue 'category not set' %>
+ <% when 'sex' %>
+ <%= ['male','female'].include?(sex.to_s) ? t("mongoid.attributes.ask_question.#{sex}") : '' %>
+ <% when 'mail' %>
+ <%= b.mail %>
+ <% when 'title' %>
+ <% if b.situation == 'is_published' %>
+ <%= link_to b.title, (ask_show_url ? (ask_show_url+"?item=#{b.id}") : "javascript:alert('#{t('ask.no_index_page')}')") %>
+ <% else %>
+ <%= b.title %>
+ <% end %>
+ <% when 'name' %>
+ <%= b.name %>
+ <% when 'phone' %>
+ <%= b.phone %>
+ <% when 'appointment' %>
+ <%= b.appointment.strftime("%Y-%m-%d %H:%M") rescue nil %>
+ <% when 'created_at' %>
+ <%= b.created_at.strftime("%Y-%m-%d %H:%M") rescue nil %>
+ <% when 'ip' %>
+ <%= b.ip %>
+ <% end %>
+ <% if edit_button_display_index == i %>
+ <%= yield :edit_button %>
<% end %>
|
- <% when 'name' %>
-
- <%= b.name %>
- |
- <% when 'phone' %>
- <%= b.phone %> |
- <% when 'appointment' %>
- <%= b.appointment.strftime("%Y-%m-%d %H:%M") rescue nil %> |
- <% when 'created_at' %>
- <%= b.created_at.strftime("%Y-%m-%d %H:%M") rescue nil %> |
- <% when 'ip' %>
- <%= b.ip %> |
- <% end %>
<% end %>
<% @table_ext_fields.each do |f, v| %>
|