Class: RubyUIAdmin::Views::Index

Inherits:
Base
  • Object
show all
Includes:
ActionsMenu
Defined in:
app/components/ruby_ui_admin/views/index.rb

Constant Summary collapse

BULK_FORM_ID =
"rua-bulk-form"

Instance Method Summary collapse

Methods included from ActionsMenu

#render_actions_menu

Methods inherited from Base

#authorized_to?, #view_template

Methods included from Translation

#rua_t

Methods included from PathHelpers

#attachment_url, #resource_edit_path, #resource_index_path, #resource_new_path, #resource_show_path

Constructor Details

#initialize(resource:, records:, pagy:, filters: [], filter_values: {}, scopes: [], current_scope_key: nil, scope_param: nil, remove_scope_all: false, query_params: {}, sort_by: nil, sort_direction: nil) ⇒ Index

Returns a new instance of Index.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/components/ruby_ui_admin/views/index.rb', line 8

def initialize(resource:, records:, pagy:, filters: [], filter_values: {}, scopes: [], current_scope_key: nil, scope_param: nil, remove_scope_all: false, query_params: {}, sort_by: nil, sort_direction: nil)
  @resource = resource
  @records = records
  @pagy = pagy
  @filters = filters
  @filter_values = filter_values
  @scopes = scopes
  @current_scope_key = current_scope_key
  @scope_param = scope_param
  @remove_scope_all = remove_scope_all
  @query_params = query_params
  @sort_by = sort_by
  @sort_direction = sort_direction
end

Instance Method Details

#contentObject



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/components/ruby_ui_admin/views/index.rb', line 29

def content
  render_header
  render_scope_tabs
  render_filter_bar
  render_bulk_toolbar
  # The `rua--bulk-select` controller (select-all + checked-ids) scopes to this table card.
  card_attrs = {class: "p-4"}
  card_attrs[:data] = {controller: "rua--bulk-select"} if bulk?
  render RubyUI::Card.new(**card_attrs) do
    render_table
  end
  render_pagination
end

#page_titleObject



23
24
25
# File 'app/components/ruby_ui_admin/views/index.rb', line 23

def page_title
  "#{@resource.navigation_label} ยท #{RubyUIAdmin.configuration.app_name}"
end