Class: ActionView::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/hooks/helpers/ActionView.rb

Instance Method Summary collapse

Instance Method Details

#registerView(view) ⇒ Object



24
25
26
# File 'lib/hooks/helpers/ActionView.rb', line 24

def registerView(view)
  @view = view
end

#sourceObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/hooks/helpers/ActionView.rb', line 3

def source
  if (self.filename.include?("oil"))
    require 'LayoutInterpreter'
    open(self.filename) {|f| @contents = f.read }
    if (@view)
      dsl = "product \"#{@view.productInfo[:product]}\"\n#{@view.navigationSteps}\n"+@contents.to_s
    else
      #the JRuby version inside tomcat seems to pass thru here before @view is setup, but then again once it is
      #this is to allow it to work until this issue is better understood
      dsl = "product \"Retailer\"\nnavigation [:QNBRiskDataCollect,:QuoteSearch,:PolicySearch,:CancelConfirm]\n"+@contents.to_s
    end
    erb = "\t<% widgetROOT=\"#{WIDGET_ROOT2}\" %>\n"
    erb << "\t<% teaserROOT=\"#{TEASER_ROOT}\" %>\n"
    erb << LayoutInterpreter.execute(dsl)
    source ||= erb
  else
    source ||= File.read(self.filename)
  end
  source
end