Class: ActionView::Base

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

Instance Method Summary collapse

Instance Method Details

#_pick_template(template_path) ⇒ Object

added from ActionView::Base with additional call to registerView added in there not proud of the solution but need to quickly establish access to the base class from within the template to pick up some gui widget metadata used to control the navigation in rails 2.1 and below we had access to the ActionView::Base via @view instance var



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/hooks/helpers/ActionView.rb', line 56

def _pick_template(template_path)
  return template_path if template_path.respond_to?(:render)

  path = template_path.sub(/^\//, '')
  if m = path.match(/(.*)\.(\w+)$/)
    template_file_name, template_file_extension = m[1], m[2]
  else
    template_file_name = path
  end

  # OPTIMIZE: Checks to lookup template in view path
  if template = self.view_paths["#{template_file_name}.#{template_format}"]
    template
  elsif template = self.view_paths[template_file_name]
    template
  elsif (first_render = @_render_stack.first) && first_render.respond_to?(:format_and_extension) &&
      (template = self.view_paths["#{template_file_name}.#{first_render.format_and_extension}"])
    template
  elsif template_format == :js && template = self.view_paths["#{template_file_name}.html"]
    @template_format = :html
    template
  else
    template = ActionView::Template.new(template_path, view_paths)
    template.registerView(self)

    if self.class.warn_cache_misses && logger
      logger.debug "[PERFORMANCE] Rendering a template that was " +
        "not found in view path. Templates outside the view path are " +
        "not cached and result in expensive disk operations. Move this " +
        "file into #{view_paths.join(':')} or add the folder to your " +
        "view path list"
    end

    template
  end
end


40
41
42
43
44
45
46
47
48
49
50
# File 'lib/hooks/helpers/ActionView.rb', line 40

def navigationSteps
  if @productInfo[@productInfo[:currentstep]] == nil
    logger.error("Line of the form \"flow :#{@productInfo[:currentstep]} , [:nextstep1,:nextstep2,...]\" is missing in the \"valid_flows\" section of the product processes.oil file") if logger
  end
  steps = "navigation [:#{@productInfo[@productInfo[:currentstep]].first}"
  @productInfo[@productInfo[:currentstep]].each do |action|
    steps << ",:#{action}" unless action  == @productInfo[@productInfo[:currentstep]].first
  end
  steps << "]"
  steps
end

#productInfoObject



29
30
31
# File 'lib/hooks/helpers/ActionView.rb', line 29

def productInfo
  @productInfo
end

#setParmsForViewUse(productInfo) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/hooks/helpers/ActionView.rb', line 32

def setParmsForViewUse(productInfo)
  if (@productInfo)
    @productInfo.merge!(productInfo)
  else
    @productInfo = productInfo
  end
end