Module: Plutonium::Helpers::AssetsHelper

Included in:
UI::Layout::Base
Defined in:
lib/plutonium/helpers/assets_helper.rb

Overview

Helper module for managing asset-related functionality

Instance Method Summary collapse

Instance Method Details

#resource_favicon_assetString

Get the favicon asset path

Returns:

  • (String)

    path to the favicon asset



62
63
64
# File 'lib/plutonium/helpers/assets_helper.rb', line 62

def resource_favicon_asset
  Plutonium.configuration.assets.favicon
end

#resource_favicon_tagActiveSupport::SafeBuffer

Generate a favicon link tag

Returns:

  • (ActiveSupport::SafeBuffer)

    HTML favicon link tag



26
27
28
# File 'lib/plutonium/helpers/assets_helper.rb', line 26

def resource_favicon_tag
  favicon_link_tag(resource_favicon_asset)
end

#resource_logo_assetString

Get the logo asset path

Returns:

  • (String)

    path to the logo asset



41
42
43
# File 'lib/plutonium/helpers/assets_helper.rb', line 41

def resource_logo_asset
  Plutonium.configuration.assets.
end

#resource_logo_tag(classname:) ⇒ ActiveSupport::SafeBuffer

Generate an image tag for the logo

Parameters:

  • classname (String)

    CSS class name for the image tag

Returns:

  • (ActiveSupport::SafeBuffer)

    HTML image tag



34
35
36
# File 'lib/plutonium/helpers/assets_helper.rb', line 34

def resource_logo_tag(classname:)
  image_tag(resource_logo_asset, class: classname)
end

#resource_script_assetString

Get the script asset path

Returns:

  • (String)

    path to the script asset



55
56
57
# File 'lib/plutonium/helpers/assets_helper.rb', line 55

def resource_script_asset
  Plutonium.configuration.assets.script
end

#resource_script_tagActiveSupport::SafeBuffer

Generate a script tag for the resource

Returns:

  • (ActiveSupport::SafeBuffer)

    HTML script tag



18
19
20
21
# File 'lib/plutonium/helpers/assets_helper.rb', line 18

def resource_script_tag
  url = resource_asset_url_for(:js, resource_script_asset)
  javascript_include_tag(url, "data-turbo-track": "reload", type: "module")
end

#resource_stylesheet_assetString

Get the stylesheet asset path

Returns:

  • (String)

    path to the stylesheet asset



48
49
50
# File 'lib/plutonium/helpers/assets_helper.rb', line 48

def resource_stylesheet_asset
  Plutonium.configuration.assets.stylesheet
end

#resource_stylesheet_tagActiveSupport::SafeBuffer

Generate a stylesheet tag for the resource

Returns:

  • (ActiveSupport::SafeBuffer)

    HTML stylesheet link tag



10
11
12
13
# File 'lib/plutonium/helpers/assets_helper.rb', line 10

def resource_stylesheet_tag
  url = resource_asset_url_for(:css, resource_stylesheet_asset)
  stylesheet_link_tag(url, "data-turbo-track": "reload")
end