From 43200e21220db2aa7a88838a6713d77de1bb3f16 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 19 Apr 2009 08:25:25 +0000 Subject: Adds mime type specific css classes to the SCM browser. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2672 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/mime_type.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib') diff --git a/lib/redmine/mime_type.rb b/lib/redmine/mime_type.rb index dfdfff407..f0e55cc92 100644 --- a/lib/redmine/mime_type.rb +++ b/lib/redmine/mime_type.rb @@ -24,6 +24,7 @@ module Redmine 'text/html' => 'html,htm,xhtml', 'text/jsp' => 'jsp', 'text/x-c' => 'c,cpp,cc,h,hh', + 'text/x-csharp' => 'cs', 'text/x-java' => 'java', 'text/x-javascript' => 'js', 'text/x-html-template' => 'rhtml', @@ -41,6 +42,9 @@ module Redmine 'image/tiff' => 'tiff,tif', 'image/x-ms-bmp' => 'bmp', 'image/x-xpixmap' => 'xpm', + 'application/pdf' => 'pdf', + 'application/zip' => 'zip', + 'application/x-gzip' => 'gz', }.freeze EXTENSIONS = MIME_TYPES.inject({}) do |map, (type, exts)| @@ -55,6 +59,13 @@ module Redmine EXTENSIONS[m[2].downcase] if m end + # Returns the css class associated to + # the mime type of name + def self.css_class_of(name) + mime = of(name) + mime && mime.gsub('/', '-') + end + def self.main_mimetype_of(name) mimetype = of(name) mimetype.split('/').first if mimetype -- cgit v1.2.3