Class: ActionView::Base

Inherits:
Object show all
Defined in:
lib/desert/plugin_templates/2.0.2/action_view.rb,
lib/desert/plugin_templates/1.2.0/action_view.rb,
lib/desert/plugin_templates/1.99.0/action_view.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#view_pathsObject (readonly)

Returns the value of attribute view_paths.



3
4
5
# File 'lib/desert/plugin_templates/1.2.0/action_view.rb', line 3

def view_paths
  @view_paths
end

Instance Method Details

#find_template_extension_from_handler(template_path, formatted = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/desert/plugin_templates/2.0.2/action_view.rb', line 12

def find_template_extension_from_handler(template_path, formatted = nil)
  checked_template_path = formatted ? "#{template_path}.#{template_format}" : template_path

  view_paths.each do |view_path|
    self.class.template_handler_extensions.each do |extension|
      file_path = File.join(view_path, "#{checked_template_path}.#{extension}")
      if File.exist?(file_path)
        return formatted ? "#{template_format}.#{extension}" : extension.to_s
      end
    end
  end
  nil
end

#initialize_with_desert(base_path = nil, assigns_for_first_render = {}, controller = nil) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/desert/plugin_templates/1.2.0/action_view.rb', line 4

def initialize_with_desert(base_path = nil, assigns_for_first_render = {}, controller = nil)
  initialize_without_desert(base_path, assigns_for_first_render, controller)

  @view_paths = [base_path]
  Desert::Manager.plugins_and_app.reverse.each do |plugin|
    @view_paths << plugin.templates_path
  end
end

#initialize_with_desert_plugins(*args) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/desert/plugin_templates/2.0.2/action_view.rb', line 3

def initialize_with_desert_plugins(*args)
  initialize_without_desert_plugins *args

  Desert::Manager.plugins.reverse.each do |plugin|
    append_view_path plugin.templates_path
  end
end