Sha256: c6162088705a92875e3471e9df188c05e14fd3709e69537e5c7b8aea239a87ad

Contents?: true

Size: 1.24 KB

Versions: 13

Compression:

Stored size: 1.24 KB

Contents

module Locomotive
  module Steam
    module Adapters
      module Filesystem
        module YAMLLoaders
          class Section

            include Adapters::Filesystem::YAMLLoader

            def load(scope)
              super
              load_list
            end

            private

            def load_list
              Dir.glob(File.join(path, "*.{#{template_extensions.join(',')}}")).map do |filepath|
                load_file(filepath)
              end
            end

            def load_file(filepath)
              slug        = File.basename(filepath).split('.').first
              attributes  = build(filepath, slug.permalink)

              _load(filepath, true, true) do |definition, template|
                attributes[:definition] = definition
                attributes[:template]   = template
              end

              attributes
            end

            def build(filepath, slug)
              {
                name:           slug.humanize,
                slug:           slug,
                template_path:  filepath
              }
            end

            def path
              @path ||= File.join(site_path, 'app', 'views', 'sections')
            end

          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
locomotivecms_steam-1.8.0.alpha2 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.8.0.alpha1 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.7.1 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.7.0 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.6.1 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.6.0 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.6.0.rc1 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.6.0.beta1 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.5.3 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.5.2 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.5.1 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.5.0 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.5.0.rc1 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb