summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-04-19 08:25:25 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-04-19 08:25:25 +0000
commit43200e21220db2aa7a88838a6713d77de1bb3f16 (patch)
tree68aa057f76771d7a13091ba21a21ccbaf65b3574 /lib
parentdf2e0dbcd7215d4e8349fe73c5e3408fc5101c93 (diff)
downloadredmine-43200e21220db2aa7a88838a6713d77de1bb3f16.tar.gz
redmine-43200e21220db2aa7a88838a6713d77de1bb3f16.zip
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
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/mime_type.rb11
1 files changed, 11 insertions, 0 deletions
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