Class: FlexiAdmin::Components::Resource::FormComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- FlexiAdmin::Components::Resource::FormComponent
- Includes:
- FormMixin
- Defined in:
- lib/flexi_admin/components/resource/form_component.rb
Direct Known Subclasses
FlexiAdmin::Components::Resources::BulkAction::ModalComponent
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Attributes included from FormMixin
Instance Method Summary collapse
- #disabled ⇒ Object
-
#initialize(resource, disabled: true) ⇒ FormComponent
constructor
A new instance of FormComponent.
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
#resource ⇒ Object (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
#disabled ⇒ Object
14 15 16 |
# File 'lib/flexi_admin/components/resource/form_component.rb', line 14 def disabled !helpers.current_ability&.can?(:update, resource) || @disabled end |