Class: RubyUIAdmin::Views::FieldValue
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- RubyUIAdmin::Views::FieldValue
- Includes:
- UI, PathHelpers, RailsHelpers, Translation
- Defined in:
- app/components/ruby_ui_admin/views/field_value.rb
Overview
Renders a field's value for index/show views, dispatching on the field type.
Instance Method Summary collapse
-
#initialize(field:, record:, link: nil) ⇒ FieldValue
constructor
A new instance of FieldValue.
- #view_template ⇒ Object
Methods included from Translation
Methods included from PathHelpers
#attachment_url, #resource_edit_path, #resource_index_path, #resource_new_path, #resource_show_path
Constructor Details
#initialize(field:, record:, link: nil) ⇒ FieldValue
Returns a new instance of FieldValue.
12 13 14 15 16 |
# File 'app/components/ruby_ui_admin/views/field_value.rb', line 12 def initialize(field:, record:, link: nil) @field = field @record = record @link = link end |
Instance Method Details
#view_template ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/components/ruby_ui_admin/views/field_value.rb', line 18 def view_template case @field.type when :boolean then render_boolean when :belongs_to then render_belongs_to when :has_one then render_has_one when :has_many, :has_and_belongs_to_many then render_has_many when :record_link then render_record_link when :url then render_url when :badge then render_badge when :status then render_status when :code then render_code when :key_value then render_key_value when :boolean_group then render_boolean_group when :file then render_file when :files then render_files else render_text end end |