diff --git a/app/models/dmsf_file_revision.rb b/app/models/dmsf_file_revision.rb index 55c32229..c6edb64f 100644 --- a/app/models/dmsf_file_revision.rb +++ b/app/models/dmsf_file_revision.rb @@ -34,6 +34,16 @@ class DmsfFileRevision < ActiveRecord::Base STATUS_DELETED = 1 STATUS_ACTIVE = 0 + PROTOCOLS = { + 'application/msword' => 'ms-word', + 'application/vnd.ms-excel' => 'ms-excel', + 'application/vnd.ms-powerpoint' => 'ms-powerpoint', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'ms-word', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'ms-excel', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'ms-powerpoint', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ms-powerpoint' + }.freeze + scope :visible, -> { where(:deleted => STATUS_ACTIVE) } scope :deleted, -> { where(:deleted => STATUS_DELETED) } @@ -340,4 +350,11 @@ class DmsfFileRevision < ActiveRecord::Base tooltip end + def protocol + unless @protocol + @protocol = PROTOCOLS[self.mime_type] + end + @protocol + end + end diff --git a/app/views/dmsf_context_menus/dmsf.html.erb b/app/views/dmsf_context_menus/dmsf.html.erb index 0826bf5e..8c582b0e 100644 --- a/app/views/dmsf_context_menus/dmsf.html.erb +++ b/app/views/dmsf_context_menus/dmsf.html.erb @@ -22,8 +22,8 @@