Class: RubyUIAdmin::Views::Home

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

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(resources:) ⇒ Home

Returns a new instance of Home.



6
7
8
# File 'app/components/ruby_ui_admin/views/home.rb', line 6

def initialize(resources:)
  @resources = resources
end

Instance Method Details

#contentObject



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

def content
  h1(class: "text-2xl font-semibold tracking-tight mb-6") { RubyUIAdmin.configuration.app_name }

  if @resources.empty?
    p(class: "text-muted-foreground") { "No resources defined yet. Create one in app/ruby_ui_admin/resources." }
  else
    div(class: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3") do
      @resources.each { |rc| render_card(rc) }
    end
  end
end