Class: BulmaPhlex::Rails::TextDisplay

Inherits:
BaseDisplay
  • Object
show all
Defined in:
lib/bulma_phlex/rails/components/displays/text_display.rb

Overview

# Text Display

A read-only text display field styled with Bulma.

An optional formatter can be provided to customize the display of the text value, such as &:titleize or a custom lambda.

#### Arguments

  • ‘model`: ActiveRecord Model - The model containing the text attribute.

  • ‘method`: Symbol or String - The attribute method name for the text field.

  • ‘options`: Hash - Additional Bulma form field options can be passed, such as `:help`, `:icon_left`, `:icon_right`, `:column`, and `:grid`. Use the `formatter` key to provide a block or lambda for custom text formatting.

Direct Known Subclasses

FormattedDisplay

Constant Summary

Constants inherited from BaseDisplay

BaseDisplay::FORM_FIELD_OPTIONS

Instance Method Summary collapse

Methods inherited from BaseDisplay

#view_template

Constructor Details

#initialize(model, method, **options) ⇒ TextDisplay

Returns a new instance of TextDisplay.



20
21
22
23
# File 'lib/bulma_phlex/rails/components/displays/text_display.rb', line 20

def initialize(model, method, **options)
  super(model, method, **options.except(:formatter))
  @formatter = options[:formatter]
end