From 1c6e9efd403c778723e7a996bc46f171775ecaad Mon Sep 17 00:00:00 2001 From: Wieger Hofstra Date: Mon, 6 Mar 2017 16:27:34 +0100 Subject: [PATCH 1/3] asset helpers work again with new sprockets --- lib/wisepdf/helper.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/wisepdf/helper.rb b/lib/wisepdf/helper.rb index 751609d..a575a15 100644 --- a/lib/wisepdf/helper.rb +++ b/lib/wisepdf/helper.rb @@ -32,28 +32,31 @@ def wisepdf_javascript_tag(*sources) module Assets def wisepdf_stylesheet_tag(*sources) + env = ::Sprockets::Railtie.build_environment(::Rails.application) sources.collect { |source| filename = ( source =~ /.css\z/ ? source : source + '.css' ) "" }.join("\n").html_safe end def wisepdf_image_tag(img, options={}) + env = ::Sprockets::Railtie.build_environment(::Rails.application) if File.exists? img image_tag "file://#{img}", options - elsif asset = ::Rails.application.assets.find_asset(img) - image_tag "file:///#{asset.pathname.to_s}", options + elsif asset = env.find_asset(img) + image_tag "file://#{asset.pathname.to_s}", options end end def wisepdf_javascript_tag(*sources) + env = ::Sprockets::Railtie.build_environment(::Rails.application) sources.collect { |source| filename = ( source =~ /.js\z/ ? source : source + '.js' ) "" }.join("\n").html_safe From b5200e293e8b156f4d14cc499a100d962d4440f9 Mon Sep 17 00:00:00 2001 From: Wieger Hofstra Date: Fri, 29 Sep 2017 20:08:34 +0200 Subject: [PATCH 2/3] stop using deprecated rails alias chain --- lib/wisepdf/render.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/wisepdf/render.rb b/lib/wisepdf/render.rb index 79bddd1..fad92df 100644 --- a/lib/wisepdf/render.rb +++ b/lib/wisepdf/render.rb @@ -4,9 +4,16 @@ module Wisepdf module Render def self.included(base) base.class_eval do - alias_method_chain :render, :wisepdf - alias_method_chain :render_to_string, :wisepdf - after_filter :clean_temp_files + # alias_method_chain :render, :wisepdf + # alias_method_chain :render_to_string, :wisepdf + + alias_method :render_without_wisepdf, :render + alias_method :render, :render_with_wisepdf + + alias_method :render_to_string_without_wisepdf, :render_to_string + alias_method :render_to_string, :render_to_string_with_wisepdf + + after_action :clean_temp_files end end From 876a4475c18268f716d6714870dc49dbfedc046c Mon Sep 17 00:00:00 2001 From: Wieger Hofstra Date: Tue, 30 Oct 2018 22:02:46 +0100 Subject: [PATCH 3/3] Remove assets pipeline in favour of webpack --- lib/wisepdf/configuration.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/wisepdf/configuration.rb b/lib/wisepdf/configuration.rb index b56cb9c..99c0349 100644 --- a/lib/wisepdf/configuration.rb +++ b/lib/wisepdf/configuration.rb @@ -22,9 +22,10 @@ def configure end def use_asset_pipeline? - return true if ::Rails.configuration.assets.enabled.nil? + false + #return true if ::Rails.configuration.assets.enabled.nil? - !!(::Rails.configuration.assets.enabled) + #!!(::Rails.configuration.assets.enabled) end def reset!