Sha256: 483bf998f502d6bd080291d1a5991b895d32a0257ab20e3045d52fb570ff1281
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
module WithFilters module Filter # @private class Text < Base def initialize(name, namespace, value, options = {}) super if @attrs[:type] != :text new_partial = @to_partial_path.split(File::SEPARATOR) new_partial[-1] = "_#{new_partial[-1]}_as_#{@attrs[:type]}.*" @to_partial_path << "_as_#{@attrs[:type]}" if Dir.glob(File.join(Rails.root, 'app', 'views', *new_partial)).any? end end def create_partial_path partial_path = nil if @theme and @attrs[:type] != :text themed_partial_path = self.class.name.underscore.split(File::SEPARATOR).insert(1, @theme) themed_partial_path[themed_partial_path.length - 1] << "_as_#{@attrs[:type]}" if Dir.glob(File.join(Rails.root, 'app', 'views', *themed_partial_path).sub(/([^#{File::SEPARATOR}]+?)$/, '_\1.*')).any? partial_path = themed_partial_path.join(File::SEPARATOR) end end partial_path || super end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
with_filters-0.1.2 | lib/with_filters/models/filter/text.rb |
with_filters-0.1.1 | lib/with_filters/models/filter/text.rb |
with_filters-0.1.0 | lib/with_filters/models/filter/text.rb |