Sha256: a2db2dd7343ca914f1f0cffdd64e3574f0beb8eb4d302f1a2d0a2129f351862c

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

# frozen_string_literal: true

require_relative "nice_partials/version"
require_relative "nice_partials/helper"
require_relative "nice_partials/monkey_patch"
require_relative "partials"

module NicePartials
end

# TODO Is there somewhere better we can put this?
def nice_partials_locale_prefix_from_view_context_and_block(context, block)
  root_paths = context.view_renderer.lookup_context.view_paths.map(&:path)
  partial_location = block.source_location.first.dup
  root_paths.each { |path| partial_location.gsub!(/^#{path}\//, '') }
  partial_location.split('.').first.gsub('/_', '/').gsub('/', '.')
end

ActionView::Base.send :include, NicePartials::Helper

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nice_partials-0.1.3 lib/nice_partials.rb