diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb
index 28b51ca4..dc96a67c 100644
--- a/app/controllers/admin/pages_controller.rb
+++ b/app/controllers/admin/pages_controller.rb
@@ -55,6 +55,9 @@ helper Admin::PagePartsHelper
when 'archive'
@categories = ArchiveFileCategory.all
@tags = ArchiveTag.all
+ when 'faq'
+ @categories = QaCategory.all
+ @tags = FaqTag.all
end
else
@categories = nil
@@ -168,6 +171,9 @@ helper Admin::PagePartsHelper
when 'archive'
@categories = ArchiveFileCategory.all
@tags = ArchiveTag.all
+ when 'faq'
+ @categories = QaCategory.all
+ @tags = FaqTag.all
else
@categories = []
@tags = []
diff --git a/vendor/built_in_modules/faq/app/models/qa.rb b/vendor/built_in_modules/faq/app/models/qa.rb
index 81ce4af9..e457253c 100644
--- a/vendor/built_in_modules/faq/app/models/qa.rb
+++ b/vendor/built_in_modules/faq/app/models/qa.rb
@@ -7,7 +7,7 @@ class Qa
scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
- field :question, localize: true
+ field :title, localize: true
field :answer, localize: true
has_and_belongs_to_many :tags, :class_name => "FaqTag"
@@ -32,7 +32,7 @@ class Qa
before_save :update_avliable_language, :clean_values
- validates :question, :at_least_one => true
+ validates :title, :at_least_one => true
def self.search( category_id = nil )
@@ -66,7 +66,7 @@ class Qa
def update_avliable_language
VALID_LOCALES.each do |locale|
- if (question_translations[locale].blank? rescue true)
+ if (title_translations[locale].blank? rescue true)
self["available_for_#{locale}".to_sym] = false
else
self["available_for_#{locale}".to_sym] = true
diff --git a/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_form.html.erb b/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_form.html.erb
index 0621c8b9..3e723707 100644
--- a/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_form.html.erb
+++ b/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_form.html.erb
@@ -70,10 +70,10 @@
">
- <%= f.label :question , t('faq.question') %>
- <%= f.fields_for :question_translations do |f| %>
+ <%= f.label :title , t('faq.question') %>
+ <%= f.fields_for :title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
- <%= f.text_field locale, :class=>'post-title', :value => (@qa.question_translations[locale] rescue nil) %>
+ <%= f.text_field locale, :class=>'post-title', :value => (@qa.title_translations[locale] rescue nil) %>
<% end %>
diff --git a/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_qa.html.erb b/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_qa.html.erb
index 158b2b8c..bcb1de1b 100644
--- a/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_qa.html.erb
+++ b/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_qa.html.erb
@@ -21,7 +21,7 @@
<%= qa.qa_category.title rescue nil %> |
- <%= link_to qa.question, panel_faq_front_end_qa_path(qa) %>
+ <%= link_to qa.title, panel_faq_front_end_qa_path(qa) %>
<%if at_least_module_manager || qa.qa_category.cur_user_is_sub_manager_of(:edit)%>
diff --git a/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_sort_headers.html.erb b/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_sort_headers.html.erb
index a00e1d0b..71b0a8b9 100644
--- a/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_sort_headers.html.erb
+++ b/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_sort_headers.html.erb
@@ -1,5 +1,5 @@
<%= render_sort_bar(true, delete_panel_faq_back_end_qas_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
['status', ['is_top', 'is_hot', 'is_hidden'], 'span1', :status],
['category', 'qa_category', 'span2', :category],
- ['question', 'question','span3', :question],
+ ['question', 'title','span3', 'faq.question'],
['tags', 'tags', 'span2', :tags]).html_safe %>
\ No newline at end of file
diff --git a/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/show.html.erb b/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/show.html.erb
index 4aa64fc2..09cf5afc 100644
--- a/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/show.html.erb
+++ b/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/show.html.erb
@@ -5,7 +5,7 @@
-
<%= t("faq.question") %>
- <%= @qa.question %>
+ <%= @qa.title %>
-
<%= t("faq.answer") %>
diff --git a/vendor/built_in_modules/faq/app/views/panel/faq/front_end/qas/show.html.erb b/vendor/built_in_modules/faq/app/views/panel/faq/front_end/qas/show.html.erb
index 4aa64fc2..b168b211 100644
--- a/vendor/built_in_modules/faq/app/views/panel/faq/front_end/qas/show.html.erb
+++ b/vendor/built_in_modules/faq/app/views/panel/faq/front_end/qas/show.html.erb
@@ -1,28 +1,31 @@
-
- -
- <%= t(:category) %>
- <%= @qa.qa_category.title rescue nil %>
-
- -
- <%= t("faq.question") %>
- <%= @qa.question %>
-
- -
- <%= t("faq.answer") %>
+
<%= @qa.title %>
+
+
+ <%= t(:category) %> : <%= @qa.qa_category.title rescue nil %>
+
+
+
<%= @qa.answer.html_safe rescue '' %>
-
- -
- <%= t(:link) if !@qa.qa_links.blank? %>
- <% @qa.qa_links.each do | blink | %>
- <%= link_to blink.title, blink.url, :target => '_blank' %>
- <% end %>
-
- -
- <%= t("faq.file") if !@qa.qa_files.blank? %>
- <% @qa.qa_files.each do | bfile | %>
- <%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
- <% end %>
-
-
-
-<%= link_back %>
+
+
+ <% if @qa.qa_links.size > 0 %>
+
+
+
+ <% @qa.qa_links.each do | blink | %>
+ <%= link_to blink.title, blink.url, :target => '_blank' %>
+ <% end %>
+
+
+ <% end %>
+ <% if @qa.qa_files.size > 0 %>
+
+
+
+ <% @qa.qa_files.each do | bfile | %>
+ <%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
+ <% end %>
+
+
+ <% end %>
+
diff --git a/vendor/built_in_modules/faq/config/locales/en.yml b/vendor/built_in_modules/faq/config/locales/en.yml
index 9d73317c..5be79e88 100644
--- a/vendor/built_in_modules/faq/config/locales/en.yml
+++ b/vendor/built_in_modules/faq/config/locales/en.yml
@@ -3,6 +3,7 @@ en:
faq:
default_widget:
question: Question
+ title: Question
answer: Answer
to_more: Read More
qa_category_with_title: Category
diff --git a/vendor/built_in_modules/faq/config/locales/zh_tw.yml b/vendor/built_in_modules/faq/config/locales/zh_tw.yml
index 621a33e8..aa932e8d 100644
--- a/vendor/built_in_modules/faq/config/locales/zh_tw.yml
+++ b/vendor/built_in_modules/faq/config/locales/zh_tw.yml
@@ -3,6 +3,7 @@ zh_tw:
faq:
default_widget:
question: 問題
+ title: 問題
answer: 回答
to_more: 閱讀更多
qa_category_with_title: 類別
diff --git a/vendor/built_in_modules/faq/init.rb b/vendor/built_in_modules/faq/init.rb
index 0982f4c0..a2e4f783 100644
--- a/vendor/built_in_modules/faq/init.rb
+++ b/vendor/built_in_modules/faq/init.rb
@@ -22,9 +22,9 @@ module Faq
widgets do
default_widget do
query 'Qa.all'
- enable ['typeA']
+ # enable ['typeA']
link_field :qa_category_with_title,{:method => 'panel_faq_front_end_qas_path',:args=>{:category_id => [:qa_category,:id]}}
- link_field :question,{:method => 'panel_faq_front_end_qa_path',:args=>:self}
+ link_field :title, {:method => 'panel_faq_front_end_qa_path',:args=>:self}
link_to_more 'panel_faq_front_end_qas_path',:title_i18n=> 'faq.default_widget.to_more'
end
|