Module: Wisepdf::Helper::Legacy

Defined in:
lib/wisepdf/helper.rb

Instance Method Summary collapse

Instance Method Details

#wisepdf_image_tag(img, options = {}) ⇒ Object



15
16
17
# File 'lib/wisepdf/helper.rb', line 15

def wisepdf_image_tag(img, options={})
  image_tag "file:///#{::Rails.root.join('public', 'images', img).pathname.to_s}", options
end

#wisepdf_javascript_tag(*sources) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/wisepdf/helper.rb', line 19

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

#wisepdf_stylesheet_tag(*sources) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/wisepdf/helper.rb', line 4

def wisepdf_stylesheet_tag(*sources)
  stylesheets_dir = ::Rails.root.join('public','stylesheets')

  sources.collect { |source|
    filename = ( source =~ /.css\z/ ? source : source + '.css' )
    "<style type='text/css'>
      #{File.read(stylesheets_dir.join(filename))}
    </style>"
  }.join("\n").html_safe
end