Class: Godmin::EngineResolver
- Defined in:
- lib/godmin/resolver.rb
Overview
Matches templates such as:
{ name: index, prefix: articles } => app/views/resource/index { name: form, prefix: articles } => app/views/resource/_form { name: title, prefix: columns } => app/views/resource/columns/_title
Instance Method Summary collapse
-
#initialize(controller_path, engine_wrapper) ⇒ EngineResolver
constructor
A new instance of EngineResolver.
- #resource_path_for_engine(prefix) ⇒ Object
- #template_paths(prefix) ⇒ Object
Methods inherited from Resolver
Constructor Details
#initialize(controller_path, engine_wrapper) ⇒ EngineResolver
Returns a new instance of EngineResolver.
40 41 42 |
# File 'lib/godmin/resolver.rb', line 40 def initialize(controller_path, engine_wrapper) super(File.join(engine_wrapper.root, "app/views"), controller_path, engine_wrapper) end |
Instance Method Details
#resource_path_for_engine(prefix) ⇒ Object
50 51 52 |
# File 'lib/godmin/resolver.rb', line 50 def resource_path_for_engine(prefix) prefix.sub(/\A#{@controller_path}/, File.join(@engine_wrapper.namespaced_path, "resource")).sub(/\A\//, "") end |
#template_paths(prefix) ⇒ Object
44 45 46 47 48 |
# File 'lib/godmin/resolver.rb', line 44 def template_paths(prefix) [ resource_path_for_engine(prefix) ] end |