diff --git a/lib/mail_view.rb b/lib/mail_view.rb index b9e77bf..65d9020 100644 --- a/lib/mail_view.rb +++ b/lib/mail_view.rb @@ -22,7 +22,7 @@ def call(env) end def call(env) - request = Rack::Request.new(env) + @request = Rack::Request.new(env) if request.path_info == "" || request.path_info == "/" links = self.actions.map do |action| @@ -67,6 +67,10 @@ def call(env) def actions public_methods(false).map(&:to_s).sort - ['call'] end + + def request + @request + end def email_template Tilt.new(email_template_path) @@ -110,7 +114,7 @@ def find_preferred_part(mail, formats) end def part_body_url(part) - '?part=%s' % Rack::Utils.escape([part.main_type, part.sub_type].compact.join('/')) + "?#{request.params.merge({'part' => [part.main_type, part.sub_type].compact.join('/')}).to_param}" end def find_part(mail, matching_content_type) diff --git a/lib/mail_view/email.html.erb b/lib/mail_view/email.html.erb index 638a43f..d84c4dd 100644 --- a/lib/mail_view/email.html.erb +++ b/lib/mail_view/email.html.erb @@ -84,8 +84,8 @@ <% if mail.multipart? %>