Class: Godmin::Resolver

Inherits:
ActionView::FileSystemResolver
  • Object
show all
Defined in:
lib/godmin/resolver.rb

Direct Known Subclasses

EngineResolver, GodminResolver

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#controller_nameObject

Returns the value of attribute controller_name.



3
4
5
# File 'lib/godmin/resolver.rb', line 3

def controller_name
  @controller_name
end

#namespaceObject

Returns the value of attribute namespace.



3
4
5
# File 'lib/godmin/resolver.rb', line 3

def namespace
  @namespace
end

Instance Method Details

#find_templates(name, prefix, partial, details) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/godmin/resolver.rb', line 5

def find_templates(name, prefix, partial, details)
  template = []

  template_paths(prefix, partial).each do |path|
    template = super(name, path, partial, details)

    if template.present?
      break
    end
  end

  template
end

#template_paths(prefix, _partial) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/godmin/resolver.rb', line 19

def template_paths(prefix, _partial)
  [
    [namespace, controller_name, prefix],
    [namespace, controller_name],
    [namespace, prefix],
    [namespace, "resource", prefix],
    [namespace, "resource"],
    [namespace]
  ].map { |path| path.compact.join("/") }.compact
end