lib/wisepdf/helper.rb in wisepdf-1.2.6 vs lib/wisepdf/helper.rb in wisepdf-1.2.7
- old
+ new
@@ -1,41 +1,41 @@
module Wisepdf
module Helper
module Legacy
def wisepdf_stylesheet_tag(*sources)
stylesheets_dir = ::Rails.root.join('public','stylesheets')
-
+
sources.collect { |source|
- filename = ( source =~ /.css\z/ ? source : source + '.css' )
+ filename = ( source =~ /.css\z/ ? source : source + '.css' )
"<style type='text/css'>
#{File.read(stylesheets_dir.join(filename))}
</style>"
}.join("\n").html_safe
end
def wisepdf_image_tag(img, options={})
image_tag "file:///#{::Rails.root.join('public', 'images', img).pathname.to_s}", options
end
-
+
def wisepdf_javascript_tag(*sources)
javascripts_dir = ::Rails.root.join('public','javascripts')
-
+
sources.collect { |source|
filename = ( source =~ /.js\z/ ? source : source + '.js' )
"<script type='text/javascript'>
//<![CDATA[
#{File.read(javascripts_dir.join(filename))}
//]]>
</script>"
}.join("\n").html_safe
end
- end
-
+ end
+
module Assets
- def wisepdf_stylesheet_tag(*sources)
+ def wisepdf_stylesheet_tag(*sources)
sources.collect { |source|
- filename = ( source =~ /.css\z/ ? source : source + '.css' )
+ filename = ( source =~ /.css\z/ ? source : source + '.css' )
"<style type='text/css'>
#{::Rails.application.assets.find_asset(filename)}
</style>"
}.join("\n").html_safe
end
@@ -45,11 +45,11 @@
image_tag "file://#{img}", options
elsif asset = ::Rails.application.assets.find_asset(img)
image_tag "file:///#{asset.pathname.to_s}", options
end
end
-
+
def wisepdf_javascript_tag(*sources)
sources.collect { |source|
filename = ( source =~ /.js\z/ ? source : source + '.js' )
"<script type='text/javascript'>
//<![CDATA[
@@ -58,6 +58,6 @@
</script>"
}.join("\n").html_safe
end
end
end
-end
\ No newline at end of file
+end