Module: Tandem::ApplicationHelper

Defined in:
app/helpers/tandem/application_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
10
# File 'app/helpers/tandem/application_helper.rb', line 3

def self.included(base)
  main_app_url_helpers.each do |helper|
    base.send(:define_method, helper) do |*arguments|
      arguments = [{}] if arguments.empty?
      main_app.send(helper, *arguments)
    end
  end
end

Instance Method Details

#render_eco_template(template, locals = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/tandem/application_helper.rb', line 13

def render_eco_template(template, locals = {})
  @eco_templates ||= {}

  if @eco_templates[template].nil?
    template_file = File.read("#{Tandem::Engine.config.root}/app/assets/javascripts/tandem/#{template}.jst.eco")
    @eco_templates[template] = Eco.context_for(template_file)
  end

  @eco_templates[template].call("render", locals).html_safe
end