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 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)[1..-1]
puts ext
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