Module: Gotenberg::Helpers::ActionView

Defined in:
lib/gotenberg/helpers/action_view.rb

Instance Method Summary collapse

Instance Method Details

#gotenberg_image_tag(source, options = {}) ⇒ Object



4
5
6
7
8
9
# File 'lib/gotenberg/helpers/action_view.rb', line 4

def gotenberg_image_tag source, options = {}
  options[:tag] = 'image'
  options[:src] = gotenberg_source_location(source, options)

  gotenberg_context_tag(options)
end

#gotenberg_javascript_tag(source, options = {}) ⇒ Object



11
12
13
14
15
16
# File 'lib/gotenberg/helpers/action_view.rb', line 11

def gotenberg_javascript_tag source, options = {}
  options[:tag] = 'js'
  options[:src] = gotenberg_source_location(source, options)

  gotenberg_context_tag(options)
end

#gotenberg_stylesheet_tag(source, options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/gotenberg/helpers/action_view.rb', line 18

def gotenberg_stylesheet_tag source, options = {}
  options[:tag] = 'css'
  options[:src] = gotenberg_source_location(source, options)

  options[:base_path] =
    case gotenberg_source_type(options)
    when :absolute
      Rails.root
    when :proxy
      compute_asset_host(source, protocol: :request)
    when :static
      Rails.public_path
    end

  options[:skip_analyze] ||= false

  gotenberg_context_tag(options)
end