Changes for FAQ to work with not latest but stable code
This commit is contained in:
parent
468555a037
commit
3e96cfe514
|
@ -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 = []
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -70,10 +70,10 @@
|
|||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
<div class="title">
|
||||
<%= 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 %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
</td>
|
||||
<td><%= qa.qa_category.title rescue nil %></td>
|
||||
<td>
|
||||
<%= link_to qa.question, panel_faq_front_end_qa_path(qa) %>
|
||||
<%= link_to qa.title, panel_faq_front_end_qa_path(qa) %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<%if at_least_module_manager || qa.qa_category.cur_user_is_sub_manager_of(:edit)%>
|
||||
|
|
|
@ -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 %>
|
|
@ -5,7 +5,7 @@
|
|||
</li>
|
||||
<li>
|
||||
<b><%= t("faq.question") %></b>
|
||||
<%= @qa.question %>
|
||||
<%= @qa.title %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t("faq.answer") %></b>
|
||||
|
|
|
@ -1,28 +1,31 @@
|
|||
<ul>
|
||||
<li>
|
||||
<b><%= t(:category) %></b>
|
||||
<%= @qa.qa_category.title rescue nil %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t("faq.question") %></b>
|
||||
<%= @qa.question %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t("faq.answer") %></b>
|
||||
<h1 class="h1"><%= @qa.title %></h1>
|
||||
<div class="info">
|
||||
<div class="info1">
|
||||
<span><%= t(:category) %> : <%= @qa.qa_category.title rescue nil %></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="news_paragraph">
|
||||
<%= @qa.answer.html_safe rescue '' %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t(:link) if !@qa.qa_links.blank? %></b>
|
||||
<% @qa.qa_links.each do | blink | %>
|
||||
<%= link_to blink.title, blink.url, :target => '_blank' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t("faq.file") if !@qa.qa_files.blank? %></b>
|
||||
<% @qa.qa_files.each do | bfile | %>
|
||||
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<%= link_back %>
|
||||
</div>
|
||||
<div class="linkAndFile">
|
||||
<% if @qa.qa_links.size > 0 %>
|
||||
<div>
|
||||
<i class="icons-link"></i>
|
||||
<div class="showLink">
|
||||
<% @qa.qa_links.each do | blink | %>
|
||||
<%= link_to blink.title, blink.url, :target => '_blank' %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @qa.qa_files.size > 0 %>
|
||||
<div>
|
||||
<i class="icons-paperclip"></i>
|
||||
<div class="showFile">
|
||||
<% @qa.qa_files.each do | bfile | %>
|
||||
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -3,6 +3,7 @@ en:
|
|||
faq:
|
||||
default_widget:
|
||||
question: Question
|
||||
title: Question
|
||||
answer: Answer
|
||||
to_more: Read More
|
||||
qa_category_with_title: Category
|
||||
|
|
|
@ -3,6 +3,7 @@ zh_tw:
|
|||
faq:
|
||||
default_widget:
|
||||
question: 問題
|
||||
title: 問題
|
||||
answer: 回答
|
||||
to_more: 閱讀更多
|
||||
qa_category_with_title: 類別
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Reference in New Issue