Class: ForestAdminDatasourceToolkit::Components::Actions::ActionField

Inherits:
Object
  • Object
show all
Defined in:
lib/forest_admin_datasource_toolkit/components/actions/action_field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, label: nil, id: nil, description: nil, is_required: false, is_read_only: false, value: nil, enum_values: nil, collection_name: nil, watch_changes: false, placeholder: nil, **_kwargs) ⇒ ActionField

Returns a new instance of ActionField.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 9

def initialize(
  type:,
  label: nil,
  id: nil,
  description: nil,
  is_required: false,
  is_read_only: false,
  value: nil,
  enum_values: nil,
  collection_name: nil,
  watch_changes: false,
  placeholder: nil,
  **_kwargs
)
  @type = type
  @label = label
  @id = id
  @description = description
  @is_required = is_required
  @is_read_only = is_read_only
  @value = value
  @enum_values = enum_values
  @collection_name = collection_name
  @watch_changes = watch_changes
  @widget = nil
  @placeholder = placeholder
end

Instance Attribute Details

#collection_nameObject (readonly)

Returns the value of attribute collection_name.



6
7
8
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 6

def collection_name
  @collection_name
end

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 6

def description
  @description
end

#enum_valuesObject (readonly)

Returns the value of attribute enum_values.



6
7
8
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 6

def enum_values
  @enum_values
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 6

def id
  @id
end

#is_read_onlyObject (readonly)

Returns the value of attribute is_read_only.



6
7
8
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 6

def is_read_only
  @is_read_only
end

#is_requiredObject (readonly)

Returns the value of attribute is_required.



6
7
8
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 6

def is_required
  @is_required
end

#labelObject (readonly)

Returns the value of attribute label.



6
7
8
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 6

def label
  @label
end

#placeholderObject (readonly)

Returns the value of attribute placeholder.



6
7
8
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 6

def placeholder
  @placeholder
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 6

def type
  @type
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 5

def value
  @value
end

#watch_changesObject

Returns the value of attribute watch_changes.



5
6
7
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 5

def watch_changes
  @watch_changes
end

#widgetObject (readonly)

Returns the value of attribute widget.



6
7
8
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 6

def widget
  @widget
end

Instance Method Details

#to_hObject



41
42
43
44
45
46
47
48
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 41

def to_h
  result = {}
  instance_variables.each do |attribute|
    result[attribute.to_s.delete('@').to_sym] = instance_variable_get(attribute)
  end

  result
end

#watch_changes?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_field.rb', line 37

def watch_changes?
  @watch_changes
end