custom icon for msoffice
This commit is contained in:
parent
5f7453c3fb
commit
f67664df29
|
@ -37,15 +37,19 @@ module Panel::Announcement::BackEnd::BulletinsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_picture_preview_setting(file_path)
|
def file_picture_preview_setting(file_path)
|
||||||
res= ""
|
ext = File.extname(file_path)[1..-1].downcase
|
||||||
#ext = File.extname(file_path)
|
|
||||||
ext = MIME::Types.type_for(file_path).first.to_s.split("/")[1]
|
|
||||||
unless file_path.nil?
|
unless file_path.nil?
|
||||||
case ext
|
case ext
|
||||||
when "jpg","jpeg","png","gif"
|
when "jpg","jpeg","png","gif"
|
||||||
{"data-content" => "#{image_tag file_path}" }
|
{"data-content" => "#{image_tag file_path}" }
|
||||||
when "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx"
|
when "pdf", "zip", "rar"
|
||||||
{"data-content" => "#{image_tag("http://#{request.host_with_port}/assets/ft-icons/#{ext}/#{ext}-48_32.png")}"}
|
{"data-content" => "#{image_tag("http://#{request.host_with_port}/assets/ft-icons/#{ext}/#{ext}-64_32.png")}"}
|
||||||
|
when "doc", "docx"
|
||||||
|
{"data-content" => "#{image_tag("http://#{request.host_with_port}/assets/ft-icons/docx_mac/docx_mac-64_32.png")}"}
|
||||||
|
when "xls", "xlsx"
|
||||||
|
{"data-content" => "#{image_tag("http://#{request.host_with_port}/assets/ft-icons/xlsx_mac/xlsx_mac-64_32.png")}"}
|
||||||
|
when "ppt", "pptx"
|
||||||
|
{"data-content" => "#{image_tag("http://#{request.host_with_port}/assets/ft-icons/pptx_mac/pptx_mac-64_32.png")}"}
|
||||||
else
|
else
|
||||||
{"data-content" => t("sys.not_previewable") }
|
{"data-content" => t("sys.not_previewable") }
|
||||||
end
|
end
|
||||||
|
|
Reference in New Issue