Class: Glib::JsonUi::ViewBuilder::Fields::Check

Inherits:
Text show all
Defined in:
app/helpers/glib/json_ui/view_builder/fields.rb

Overview

Individual checkbox field.

Can be used standalone or within a CheckGroup. Supports custom icons, images, and indeterminate state for partial selections.

Examples:

Single checkbox with default value

form.fields_check \
  name: 'user[age_range]',
  value: '16+',
  checkValue: '16+',
  uncheckValue: '0-16',
  label: 'I am over 16 (has default value)'

Standalone checkboxes without group

form.fields_check name: 'user[choice][]', label: 'Choice 1', checkValue: 'choice_1'
form.fields_check name: 'user[choice][]', label: 'Choice 2', checkValue: 'choice_2'

See Also:

  • Garage example
  • Garage example for single checkbox

Instance Attribute Summary

Attributes inherited from JsonUiElement

#json, #page

Instance Method Summary collapse

Methods inherited from AbstractField

#autoValidate, #context, #created, #default_url_options, #determine_value, #disableDirtyCheck, #hint, #hint_args, #label, #label_args, #name, #placeholder, #placeholder_args, #prop, #validation

Methods inherited from View

component_name

Methods inherited from JsonUiElement

#initialize, #props

Constructor Details

This class inherits a constructor from Glib::JsonUi::JsonUiElement

Instance Method Details

#value(value) ⇒ Object



483
484
485
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 483

def value(value)
  @value = value if value != Glib::Value::DEFAULT
end