Class: EasyAdmin::Resources::TableComponent
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- EasyAdmin::Resources::TableComponent
- Defined in:
- app/components/easy_admin/resources/table_component.rb
Instance Method Summary collapse
-
#initialize(resource_class:, records:, current_params: {}, current_user: nil) ⇒ TableComponent
constructor
A new instance of TableComponent.
- #view_template ⇒ Object
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:, current_params: {}, current_user: nil) ⇒ TableComponent
Returns a new instance of TableComponent.
4 5 6 7 8 9 |
# File 'app/components/easy_admin/resources/table_component.rb', line 4 def initialize(resource_class:, records:, current_params: {}, current_user: nil) @resource_class = resource_class @records = records @current_params = current_params @current_user = current_user end |
Instance Method Details
#view_template ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/components/easy_admin/resources/table_component.rb', line 11 def view_template div(data: batch_actions_enabled? ? { controller: "batch-selection", batch_selection_resource_name_value: @resource_class.route_key, action: "batch-action:completed@window->batch-selection#clearSelection" } : {}) do table(class: "table-striped min-w-full divide-y divide-gray-300") do render_table_header render_table_body end # Render batch action bar if enabled if batch_actions_enabled? # Context menu containers for each record end end |