Class: ExpressTemplates::Components::Forms::ExpressForm
Instance Attribute Summary
Attributes inherited from Expander
#handlers, #locals, #stack, #template
Instance Method Summary
collapse
included
included
Methods inherited from Base
inherited
included
included
included
included
Methods included from Macro
included
Methods inherited from Expander
#expand, #initialize, #initialize_expander, #method_missing, #process_children!, register_macros_for
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class ExpressTemplates::Expander
Instance Method Details
23
24
25
26
27
28
29
30
31
|
# File 'lib/express_templates/components/forms/express_form.rb', line 23
def form_action
if _modifying_resource?
"{{#{resource_name_for_path}_path(@#{resource_name})}}"
else "{{#{resource_name_for_path.pluralize}_path}}"
end
end
|
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/express_templates/components/forms/express_form.rb', line 34
def form_args
args = {id: form_id, action: form_action}.merge!(@config).merge!(method: :post)
if html_options = args.delete(:html_options)
args.merge!(html_options)
end
args[:method] = args[:method].to_s.upcase
args
end
|
15
16
17
|
# File 'lib/express_templates/components/forms/express_form.rb', line 15
def form_id
"#{resource_name}_{{@#{resource_name}.id}}"
end
|
19
20
21
|
# File 'lib/express_templates/components/forms/express_form.rb', line 19
def form_method
@config[:method]
end
|
#namespace ⇒ Object
55
56
57
|
# File 'lib/express_templates/components/forms/express_form.rb', line 55
def namespace
@config[:namespace]
end
|
#resource_name ⇒ Object
51
52
53
|
# File 'lib/express_templates/components/forms/express_form.rb', line 51
def resource_name
(@config[:resource_name] || @config[:id]).to_s
end
|
#resource_name_for_path ⇒ Object
47
48
49
|
# File 'lib/express_templates/components/forms/express_form.rb', line 47
def resource_name_for_path
@config[:id].to_s
end
|