Class: RubyCms::Admin::BulkActionTable::BulkActionTableHeaderBar

Inherits:
RubyCms::Admin::BaseComponent show all
Defined in:
app/components/ruby_cms/admin/bulk_action_table/bulk_action_table_header_bar.rb

Overview

Header bar with optional title, filter, action icons (+ button) and search form Renders using Phlex elements - no raw() needed

Instance Method Summary collapse

Methods inherited from RubyCms::Admin::BaseComponent

#build_classes, #conditional_attributes, #controller, #form_authenticity_token, #helpers, #merge_data_attributes, #token_from_controller, #token_from_controller?, #token_from_helpers?

Constructor Details

#initialize(title: nil, header_filter: nil, action_icons: [], search_url: "#", search_param: "q", turbo_frame: nil) ⇒ BulkActionTableHeaderBar

Returns a new instance of BulkActionTableHeaderBar.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/components/ruby_cms/admin/bulk_action_table/bulk_action_table_header_bar.rb', line 16

def initialize(
  title: nil,
  header_filter: nil,
  action_icons: [],
  search_url: "#",
  search_param: "q",
  turbo_frame: nil
)
  super
  @title = title
  @header_filter = header_filter
  @action_icons = action_icons || []
  @search_url = search_url
  @search_param = search_param
  @turbo_frame = turbo_frame
end

Instance Method Details

#view_templateObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/components/ruby_cms/admin/bulk_action_table/bulk_action_table_header_bar.rb', line 33

def view_template
  div(class: "px-5 py-3 border-b border-border/60 bg-white") do
    div(class: "flex flex-wrap items-center justify-between gap-4") do
      render_title_group if @title.present?
      div(class: "flex items-center gap-2 flex-wrap") do
        render_header_filter if @header_filter.present?
        render_action_icons
        render_search_form
      end
    end
  end
end