Module: IronAdmin::Form::Concerns::FormInputBehavior

Extended by:
ActiveSupport::Concern
Included in:
BelongsToAutocompleteComponent
Defined in:
app/components/iron_admin/form/concerns/form_input_behavior.rb

Overview

Shared behavior for form input components.

Provides field-level readonly checks and theme access. Included by all form input components.

Instance Method Summary collapse

Instance Method Details

#effectively_disabled?Boolean

Checks if input should be disabled (explicitly or via field readonly).

Returns:

  • (Boolean)

    True if input should be disabled



28
29
30
# File 'app/components/iron_admin/form/concerns/form_input_behavior.rb', line 28

def effectively_disabled?
  disabled || field_readonly?
end

#field_readonly?Boolean

Checks if field is readonly for the current user.

Returns:

  • (Boolean)

    True if field is readonly



35
36
37
# File 'app/components/iron_admin/form/concerns/form_input_behavior.rb', line 35

def field_readonly?
  @field&.readonly?(@current_user) || false
end

#themeIronAdmin::Configuration::Theme

Returns the theme configuration.



42
43
44
# File 'app/components/iron_admin/form/concerns/form_input_behavior.rb', line 42

def theme
  IronAdmin.configuration.theme
end