Update description.

This commit is contained in:
BoHung Chiu 2021-03-24 18:16:04 +08:00
parent e3997dc83a
commit eca5ae8a98
5 changed files with 14 additions and 4 deletions

View File

@ -10,7 +10,7 @@ class FaqsController < ApplicationController
end
qa_files = qa.qa_files.map do |qa_file|
{
"file_url" => qa_file.file.url,
"file_url" => qa_file.file.url + "\" title=\"#{qa_file.file_title}",
"file_title" => (qa_file.title.blank? ? File.basename(qa_file["file"]) : qa_file.title)
}
end
@ -39,7 +39,7 @@ class FaqsController < ApplicationController
faqs_files = faq.qa_files.collect do |f|
{
"file_url" => f.file.url,
"file_url" => f.file.url + "\" title=\"#{f.file_title}",
"file_title" => f.title
}
end

View File

@ -10,5 +10,13 @@ class QaFile
field :title, localize: true
belongs_to :qa
def file_title
if self.description.present?
return self.description
elsif self.title.present?
return self.title
else
return File.basename(self.file.path)
end
end
end

View File

@ -142,7 +142,7 @@
<div class="control-group">
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<div id="file_description_hint"><%= t("qa.file_description_hint") %></div>
<!-- Exist -->
<% if @qa && !@qa.qa_files.blank? %>
<div class="exist">

View File

@ -20,6 +20,7 @@ en:
answer: Answer
update_user: Last modified
qa:
file_description_hint: 'File Description will display in the title of file link.(When placing mouse on the link,the title will display)'
create_qa_category_success: FAQ category was successfully created
editing_web_resource: Editing FAQ
list_of_web_resource: FAQ list

View File

@ -23,3 +23,4 @@ zh_tw:
list_of_web_resource: 問與答列表
new_web_resource: 新增問與答
update_qa_category_success: 問與答已成功更新
file_description_hint: '檔案描述將會顯示在前台檔案連結的title(把滑鼠放在連結上會出現的文字)'