Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support RM 5.1 #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'redmine'

require_dependency 'patches/attachments_patch'
require_dependency 'hooks/view_layouts_base_html_head_hook'
require_relative 'lib/redmine_lightbox2/patches/attachments_patch'
require_relative 'lib/redmine_lightbox2/hooks/view_layouts_base_html_head_hook'

Redmine::Plugin.register :redmine_lightbox2 do
name 'Redmine Lightbox 2'
Expand Down
21 changes: 0 additions & 21 deletions lib/patches/attachments_patch.rb

This file was deleted.

23 changes: 23 additions & 0 deletions lib/redmine_lightbox2/patches/attachments_patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require_dependency 'attachment'
module RedmineLightbox2
module Patches
module AttachmentsPatch
def self.included(base) # :nodoc:
base.class_eval do
unloadable # Send unloadable so it will not be unloaded in development

def download_inline
# apply before_filters
find_attachment
file_readable
read_authorize

send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
:type => detect_content_type(@attachment),
:disposition => 'inline'
end
end
end
end
end
end