Class: RubyUIAdmin::Views::Action

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

Overview

Full-page confirmation/form for a custom action (no-JS fallback for the modal).

Instance Method Summary collapse

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:, action:, action_id:, record_ids:) ⇒ Action

Returns a new instance of Action.



7
8
9
10
11
12
# File 'app/components/ruby_ui_admin/views/action.rb', line 7

def initialize(resource:, action:, action_id:, record_ids:)
  @resource = resource
  @action = action
  @action_id = action_id
  @record_ids = record_ids
end

Instance Method Details

#contentObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/components/ruby_ui_admin/views/action.rb', line 18

def content
  div(class: "mb-6") do
    a(href: resource_index_path(@resource.class), class: "text-sm text-muted-foreground hover:underline") { "#{@resource.navigation_label}" }
    h1(class: "text-2xl font-semibold tracking-tight mt-1") { @action.name }
  end

  render RubyUI::Card.new(class: "max-w-2xl") do
    render RubyUI::CardContent.new(class: "pt-6") do
      render RubyUIAdmin::Views::ActionForm.new(
        resource: @resource,
        action: @action,
        action_id: @action_id,
        record_ids: @record_ids
      )
    end
  end
end

#page_titleObject



14
15
16
# File 'app/components/ruby_ui_admin/views/action.rb', line 14

def page_title
  "#{@action.name} · #{RubyUIAdmin.configuration.app_name}"
end