Sha256: b9394925c659d440d3d8bcb15c36c7753cb9d4eddd692bcd3a829331adc52845
Contents?: true
Size: 1.35 KB
Versions: 4
Compression:
Stored size: 1.35 KB
Contents
module Godmin class Resolver < ::ActionView::FileSystemResolver attr_accessor :namespace, :controller_name def find_templates(name, prefix, partial, details) template = [] template_paths(prefix, partial).each do |path| template = super(name, path, partial, details) break if template.present? end template end def template_paths(prefix, _partial) prefix = clean_prefix(prefix) [ [namespace, controller_name, prefix], [namespace, controller_name], [namespace, prefix], [namespace, "resource", prefix], [namespace, "resource"], [namespace] ].map { |path| path.compact.join("/") }.compact end private def clean_prefix(prefix) prefix.gsub(/^#{namespace}\//, "") end end class EngineResolver < Resolver def initialize(controller_name) super [Godmin.namespace, "app/views"].compact.join("/") self.namespace = Godmin.namespace self.controller_name = controller_name end def template_paths(prefix, _partial) return [] if prefix =~ /^godmin\// super end end class GodminResolver < Resolver def initialize(controller_name) super [Godmin::Engine.root, "app/views"].compact.join("/") self.namespace = "godmin" self.controller_name = controller_name end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
godmin-0.12.0 | lib/godmin/resolver.rb |
godmin-0.11.2 | lib/godmin/resolver.rb |
godmin-0.11.1 | lib/godmin/resolver.rb |
godmin-0.11.0 | lib/godmin/resolver.rb |