Merge branch 'ntu' of github.com:Rulingcom/orbit into ntu

This commit is contained in:
Fu Matthew 2013-01-02 17:53:00 +08:00
commit 10473af154
1 changed files with 9 additions and 5 deletions

View File

@ -37,15 +37,19 @@ module Panel::Announcement::BackEnd::BulletinsHelper
end
def file_picture_preview_setting(file_path)
res= ""
ext = File.extname(file_path)[1..-1]
puts ext
ext = File.extname(file_path)[1..-1].downcase
unless file_path.nil?
case ext
when "jpg","jpeg","png","gif"
{"data-content" => "#{image_tag file_path}" }
when "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx"
{"data-content" => "#{image_tag("http://#{request.host_with_port}/assets/ft-icons/#{ext}/#{ext}-48_32.png")}"}
when "pdf", "zip", "rar"
{"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
{"data-content" => t("sys.not_previewable") }
end