Sha256: cece01f0dd80b2c0f0220984c8a4b07687d0da5589797f7d5cd03387c0bd0e13

Contents?: true

Size: 1.37 KB

Versions: 32

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true

require 'phlex/rails'

# Include this in your view for additional logic for rendering a full HTML page, usually from a
# controller.
module Proscenium::Phlex::Page
  include Phlex::Rails::Helpers::CSPMetaTag
  include Phlex::Rails::Helpers::CSRFMetaTags
  include Phlex::Rails::Helpers::FaviconLinkTag
  include Phlex::Rails::Helpers::PreloadLinkTag
  include Phlex::Rails::Helpers::StyleSheetLinkTag
  include Phlex::Rails::Helpers::ActionCableMetaTag
  include Phlex::Rails::Helpers::AutoDiscoveryLinkTag
  include Phlex::Rails::Helpers::JavaScriptIncludeTag
  include Phlex::Rails::Helpers::JavaScriptImportMapTags
  include Phlex::Rails::Helpers::JavaScriptImportModuleTag

  def self.included(klass)
    klass.extend(Phlex::Rails::Layout::Interface)
  end

  def template(&block)
    doctype
    html do
      head
      body(&block)
    end
  end

  private

  def after_template
    super
    @_buffer.gsub!('<!-- [SIDE_LOAD_STYLESHEETS] -->', capture { include_stylesheets })
  end

  def page_title
    Rails.application.class.name.deconstantize
  end

  def head
    super do
      title { page_title }

      yield if block_given?

      csp_meta_tag
      csrf_meta_tags

      comment { '[SIDE_LOAD_STYLESHEETS]' }
    end
  end

  def body
    super do
      yield if block_given?

      include_javascripts type: :module, defer: true
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
proscenium-0.11.0.pre.9-x86_64-linux lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.9-aarch64-linux lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.9-arm64-darwin lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.9-x86_64-darwin lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.8-x86_64-linux lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.8-aarch64-linux lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.8-arm64-darwin lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.8-x86_64-darwin lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.7-x86_64-linux lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.7-aarch64-linux lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.7-arm64-darwin lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.7-x86_64-darwin lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.6-x86_64-linux lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.6-aarch64-linux lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.6-arm64-darwin lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.6-x86_64-darwin lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.5-x86_64-linux lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.5-aarch64-linux lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.5-arm64-darwin lib/proscenium/phlex/page.rb
proscenium-0.11.0.pre.5-x86_64-darwin lib/proscenium/phlex/page.rb