Sha256: a49b787bfd7f1e44ef44394f6ff3be14aa9c281e20fa703a3f161b8f436fd39d

Contents?: true

Size: 765 Bytes

Versions: 54

Compression:

Stored size: 765 Bytes

Contents

module Locomotive::Steam
  module Adapters
    module Filesystem
      module Sanitizers

        class Snippet

          include Adapters::Filesystem::Sanitizer

          def apply_to_entity(entity)
            super

            use_default_template_if_missing_locale(entity)
          end

          private

          def use_default_template_if_missing_locale(entity)
            # if there a missing template in one of the locales,
            # then use the one from the default locale
            default = entity.template_path[default_locale]
            locales.each do |locale|
              next if locale == default_locale
              entity.template_path[locale] ||= default
            end
          end

        end

      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
locomotivecms_steam-1.4.0.rc1 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.4.0.pre.rc.1 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.3.0 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.3.0.rc2 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.1.2 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.2.1 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.3.0.rc1 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.2.0 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.2.0.rc3 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.2.0.rc2 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.2.0.rc1 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.2.0.beta1 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.1.1 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.1.0 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.1.0.rc3 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.1.0.rc2 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.1.0.rc1 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.0.1 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.0.0 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb
locomotivecms_steam-1.0.0.rc10 lib/locomotive/steam/adapters/filesystem/sanitizers/snippet.rb