Module: Phlex::Rails::Layout

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::TurboRefreshScrollTag

#turbo_refresh_scroll_tag

Methods included from HelperMacros

#register_output_helper, #register_value_helper

Methods included from Helpers::TurboRefreshMethodTag

#turbo_refresh_method_tag

Methods included from Helpers::JavascriptImportModuleTag

#javascript_import_module_tag

Methods included from Helpers::JavascriptImportmapTags

#javascript_importmap_tags

Methods included from Helpers::JavascriptIncludeTag

#javascript_include_tag

Methods included from Helpers::AutoDiscoveryLinkTag

#auto_discovery_link_tag

Methods included from Helpers::ActionCableMetaTag

#action_cable_meta_tag

Methods included from Helpers::StylesheetLinkTag

#stylesheet_link_tag

Methods included from Helpers::PreloadLinkTag

#preload_link_tag

Methods included from Helpers::FaviconLinkTag

#favicon_link_tag

Methods included from Helpers::CSRFMetaTags

#csrf_meta_tags

Methods included from Helpers::CSPMetaTag

#csp_meta_tag

Class Method Details

.included(klass) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/phlex/rails/layout.rb', line 39

def self.included(klass)
	unless klass < Phlex::HTML
		raise Phlex::ArgumentError.new("👋 #{name} should only be included into Phlex::HTML classes.")
	end

	klass.extend(Interface)
end

Instance Method Details

#identifierObject



64
65
66
# File 'lib/phlex/rails/layout.rb', line 64

def identifier
	self.class.identifier
end

#render(view_context = nil, *args, **kwargs, &block) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/phlex/rails/layout.rb', line 47

def render(view_context = nil, *args, **kwargs, &block)
	if @_context
		super
	else
		call(view_context: view_context) do |yielded|
			case yielded
			when Symbol
				output = view_context.view_flow.get(yielded)
			else
				output = view_context.capture(&block)
			end

			unsafe_raw output
		end
	end
end

#virtual_pathObject



68
69
70
# File 'lib/phlex/rails/layout.rb', line 68

def virtual_path
	self.class.virtual_path
end