Sha256: 7deb3881b7a1b08d49e47fd0ad0ccb5c9d8b68187597514ffb4cceceed7327d5

Contents?: true

Size: 636 Bytes

Versions: 8

Compression:

Stored size: 636 Bytes

Contents

module Locomotive::Builder
  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['builder.content_entry'] = content_entry
        else
          env['builder.page'] = nil
        end
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
locomotivecms_builder-1.0.0.alpha8 lib/locomotive/builder/server/templatized_page.rb
locomotivecms_builder-1.0.0.alpha7 lib/locomotive/builder/server/templatized_page.rb
locomotivecms_builder-1.0.0.alpha6 lib/locomotive/builder/server/templatized_page.rb
locomotivecms_builder-1.0.0.alpha5 lib/locomotive/builder/server/templatized_page.rb
locomotivecms_builder-1.0.0.alpha4 lib/locomotive/builder/server/templatized_page.rb
locomotivecms_builder-1.0.0.alpha3 lib/locomotive/builder/server/templatized_page.rb
locomotivecms_builder-1.0.0.alpha2 lib/locomotive/builder/server/templatized_page.rb
locomotivecms_builder-1.0.0.alpha1 lib/locomotive/builder/server/templatized_page.rb