Class: EasyAdmin::Resources::TableCellComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/easy_admin/resources/table_cell_component.rb

Instance Method Summary collapse

Methods inherited from BaseComponent

#easy_admin_url_helpers, #helpers, #rails_url_helpers

Methods included from Permissions::Component

#current_user_can?, #current_user_has_role?, #if_can, #if_has_role, #permission_attrs, #permission_button, #permission_case, #permission_classes, #permission_field, #permission_link, #unless_can, #unless_has_role

Methods included from FieldsHelper

#field_component, #render_field

Methods included from DashboardsHelper

#delta_badge_classes, #metric_value_classes, #render_card, #sparkline_color, #sparkline_points, #trend_direction, #trend_icon, #trend_indicator_classes

Constructor Details

#initialize(record:, field_config:, resource_class:, mobile_hide: false) ⇒ TableCellComponent

Returns a new instance of TableCellComponent.



4
5
6
7
8
9
# File 'app/components/easy_admin/resources/table_cell_component.rb', line 4

def initialize(record:, field_config:, resource_class:, mobile_hide: false)
  @record = record
  @field_config = field_config
  @resource_class = resource_class
  @mobile_hide = mobile_hide
end

Instance Method Details

#view_template ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/components/easy_admin/resources/table_cell_component.rb', line 11

def view_template
  td(id: cell_id, class: cell_classes) do
    div(class: "flex items-center justify-between group-hover:bg-transparent") do
      div(class: "flex-1 text-gray-900 font-medium") do
        render_field_value
      end
      
      if field_editable?
        div(class: "ml-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200") do
          render_inline_edit_trigger
        end
      end
    end
  end
end