Class: RubyCms::Admin::AdminPage

Inherits:
BaseComponent show all
Defined in:
app/components/ruby_cms/admin/admin_page.rb,
app/components/ruby_cms/admin/admin_page/admin_table_content.rb

Overview

Admin page wrapper component (Tailwind-first)

NOTE: This file must exist (at this path) so Zeitwerk autoloads RubyCms::Admin::AdminPage as a CLASS (not a module inferred from the admin_page/ directory).

Defined Under Namespace

Classes: AdminTableContent

Instance Method Summary collapse

Methods inherited from 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, footer: nil, **options) ⇒ AdminPage

Returns a new instance of AdminPage.



11
12
13
14
15
16
17
18
# File 'app/components/ruby_cms/admin/admin_page.rb', line 11

def initialize(title: nil, footer: nil, **options)
  super()
  @title = title
  @footer = footer

  assign_options(options)
  @user_attrs = extract_user_attrs(options)
end

Instance Method Details

#extract_user_attrs(options) ⇒ Object



20
21
22
23
24
25
26
# File 'app/components/ruby_cms/admin/admin_page.rb', line 20

def extract_user_attrs(options)
  excluded_keys = i[
    title subtitle actions action_icons search breadcrumbs padding overflow
    content_card turbo_frame turbo_frame_options
  ]
  options.except(*excluded_keys)
end

#view_templateObject



28
29
30
31
# File 'app/components/ruby_cms/admin/admin_page.rb', line 28

def view_template(&)
  content = build_page_content(&)
  wrap_with_turbo_frame(content)
end