Class: Smithy::Liquid::Tags::Html::SmithyJavascriptIncludeTag

Inherits:
Base
  • Object
show all
Defined in:
lib/smithy/liquid/tags/html.rb

Constant Summary

Constants inherited from Base

Base::Syntax

Instance Method Summary collapse

Methods inherited from Base

#initialize, #tag, #tag_with_ext, #tag_without_ext

Constructor Details

This class inherits a constructor from Smithy::Liquid::Tags::Html::Base

Instance Method Details

#render(context) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/smithy/liquid/tags/html.rb', line 47

def render(context)
  controller = context.registers[:controller]
  javascript = Smithy::Template.javascripts.find_by(name: tag_without_ext('js'))
  path = "/templates/javascripts/#{tag_with_ext('js')}"
  path += "?#{javascript.updated_at.to_s(:number)}" if javascript.present?
  controller.view_context.send(:javascript_include_tag, path)
end