Class: FlexiAdmin::Components::Resource::FormComponent

Inherits:
BaseComponent
  • Object
show all
Includes:
FormMixin
Defined in:
lib/flexi_admin/components/resource/form_component.rb

Instance Attribute Summary collapse

Attributes included from FormMixin

#inline, #parent_resource

Instance Method Summary collapse

Methods included from FormMixin

#button_select_field, #checkbox_field, #checkbox_field_tag, #custom_field, #date_field, #datetime_field, #form, #header, #hidden_field, #html_field, #number_field, #select_field, #submit, #text_field, #text_field_tag, #with_resource

Methods included from Helpers::ResourceHelper

#autocomplete_path, #bulk_action_path, #datalist_path, #edit_resource_path, #paginate, #resource__path, #resource_input_name, #resource_path, #resources_path, #scope, #scope_plural, #scope_singular

Constructor Details

#initialize(resource, disabled: true) ⇒ FormComponent

Returns a new instance of FormComponent.



9
10
11
12
# File 'lib/flexi_admin/components/resource/form_component.rb', line 9

def initialize(resource, disabled: true)
  @resource = resource
  @disabled = disabled
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



7
8
9
# File 'lib/flexi_admin/components/resource/form_component.rb', line 7

def resource
  @resource
end

Instance Method Details

#disabledObject



14
15
16
# File 'lib/flexi_admin/components/resource/form_component.rb', line 14

def disabled
  !helpers.current_ability&.can?(:update, resource) || @disabled
end