diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb index 8d5d9ecb..7cb16a3b 100644 --- a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb +++ b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb @@ -37,15 +37,19 @@ module Panel::Announcement::BackEnd::BulletinsHelper end def file_picture_preview_setting(file_path) - res= "" - #ext = File.extname(file_path) - ext = MIME::Types.type_for(file_path).first.to_s.split("/")[1] + 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