Module: Primer::Forms::ActsAsComponent
Overview
Defined Under Namespace
Modules: InstanceMethods
Classes: TemplateGlob, TemplateParams
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
permalink
.extended(base) ⇒ Object
[View source]
46
47
48
|
# File 'app/lib/primer/forms/acts_as_component.rb', line 46
def self.extended(base)
base.include(InstanceMethods)
end
|
Instance Method Details
permalink
#base_template_path ⇒ Object
[View source]
79
80
81
82
83
84
85
86
87
88
|
# File 'app/lib/primer/forms/acts_as_component.rb', line 79
def base_template_path
return @base_template_path if defined?(@base_template_path)
base_path = Utils.const_source_location(self.name)
if base_path
@base_template_path = File.dirname(base_path)
else
warn "Could not identify the template for #{self}"
end
end
|
permalink
#compile! ⇒ Object
[View source]
58
59
60
61
62
63
64
65
66
67
|
# File 'app/lib/primer/forms/acts_as_component.rb', line 58
def compile!
return if defined?(@compiled) && @compiled && !Rails.env.development?
template_globs.each do |template_glob|
compile_templates_in(template_glob)
end
@compiled = true
end
|
permalink
#renders_templates(glob_pattern, method_name = nil, &block) ⇒ Object
Also known as:
renders_template
[View source]
53
54
55
|
# File 'app/lib/primer/forms/acts_as_component.rb', line 53
def renders_templates(glob_pattern, method_name = nil, &block)
template_globs << TemplateGlob.new(glob_pattern, method_name, block)
end
|
permalink
#template_root_path ⇒ Object
[View source]
69
70
71
72
73
74
75
76
77
|
# File 'app/lib/primer/forms/acts_as_component.rb', line 69
def template_root_path
return @template_root_path if defined?(@template_root_path)
form_path = Utils.const_source_location(self.name)
@template_root_path =
if form_path
File.join(File.dirname(form_path), self.name.demodulize.underscore)
end
end
|