Class: EasyAdmin::Resources::IndexFrameComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/easy_admin/resources/index_frame_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(resource_class:, records:, pagy: nil, current_params: {}, current_path: nil, current_user: nil) ⇒ IndexFrameComponent

Returns a new instance of IndexFrameComponent.



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

def initialize(resource_class:, records:, pagy: nil, current_params: {}, current_path: nil, current_user: nil)
  @resource_class = resource_class
  @records = records
  @pagy = pagy
  @current_params = current_params
  @current_path = current_path
  @current_user = current_user
end

Instance Method Details

#view_templateObject



13
14
15
16
17
18
19
20
21
22
# File 'app/components/easy_admin/resources/index_frame_component.rb', line 13

def view_template
  turbo_frame(id: "table-frame") do
    if @records.any?
      render_table_content
    else
      render_empty_state
    end
    render_pagination if @pagy
  end
end