Sha256: 6446e9a148f98d096a71538e5b214613d08471e448dd605a4f9b24cf4e5066bb

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

module Locomotive::Steam
  class Server

    class TemplatizedPage < Middleware

      def call(env)
        self.set_accessors(env)

        if self.page && self.page.templatized?
          self.set_content_entry!(env)
        end

        app.call(env)
      end

      protected

      def set_content_entry!(env)
        %r(^#{self.page.safe_fullpath.gsub('*', '([^\/]+)')}$) =~ self.path

        permalink = $1

        if content_entry = self.page.content_type.find_entry(permalink)
          env['steam.content_entry'] = content_entry
        else
          env['steam.page'] = nil
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
locomotivecms_steam-0.1.0 lib/locomotive/steam/server/templatized_page.rb