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
This commit is contained in:
Jean-Philippe Lang
2009-04-19 08:25:25 +00:00
parent df2e0dbcd7
commit 43200e2122
17 changed files with 89 additions and 2 deletions
+11
View File
@@ -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