Class: Frontyard::ApplicationForm

Inherits:
ApplicationComponent show all
Includes:
Phlex::Rails::Helpers::DatetimeField, Phlex::Rails::Helpers::FormWith, Phlex::Rails::Helpers::Label, Phlex::Rails::Helpers::Pluralize, Phlex::Rails::Helpers::TextField
Defined in:
app/components/frontyard/application_form.rb

Defined Under Namespace

Classes: DateTimeParamTransformer

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationComponent

#before_template, config, default_config, generate_css_class, #html_options, initialize_with, #namespace, #params, #render_model, #render_table, #view_template

Class Method Details

.process_params(params) ⇒ Object



67
68
69
# File 'app/components/frontyard/application_form.rb', line 67

def process_params(params)
  params
end

Instance Method Details

#field(attribute, **kwargs, &block) ⇒ Object



15
16
17
18
19
# File 'app/components/frontyard/application_form.rb', line 15

def field(attribute, **kwargs, &block)
  # Use the form object if available, otherwise use a default object
  form_object = respond_to?(:object) ? object : self
  render Frontyard::Field.new(object: form_object, attribute: attribute, **kwargs, &block)
end

#form_actions(**kwargs, &block) ⇒ Object



11
12
13
# File 'app/components/frontyard/application_form.rb', line 11

def form_actions(**kwargs, &block)
  render Frontyard::Actions.new(**kwargs, &block)
end

#objectObject

Default object method - subclasses can override this



22
23
24
# File 'app/components/frontyard/application_form.rb', line 22

def object
  nil
end