Class: BulmaPhlex::Rails::FormattedDisplay

Inherits:
TextDisplay show all
Defined in:
lib/bulma_phlex/rails/components/displays/formatted_display.rb

Overview

# Formatted Display

A read-only display field styled with Bulma. This requires a ‘format` option, which will be passed to `to_fs` for formatting the value.

#### Arguments

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

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

  • ‘options`: Hash - Additional Bulma form field options can be passed, such as `:help`, `:icon_left`, `:icon_right`, `:column`, and `:grid`. Include a `format` key to specify the format to use with `to_fs`.

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 = nil, **options) ⇒ FormattedDisplay

Returns a new instance of FormattedDisplay.



18
19
20
21
# File 'lib/bulma_phlex/rails/components/displays/formatted_display.rb', line 18

def initialize(model, method = nil, **options)
  super(model, method, **options.except(:format))
  @format = options.fetch(:format, :default)
end