Class: RubyUIAdmin::Views::Dashboard
- Defined in:
- app/components/ruby_ui_admin/views/dashboard.rb
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(dashboard:) ⇒ Dashboard
constructor
A new instance of Dashboard.
- #page_title ⇒ Object
Methods inherited from Base
#authorized_to?, #view_template
Methods included from Translation
Methods included from PathHelpers
#attachment_url, #resource_edit_path, #resource_index_path, #resource_new_path, #resource_show_path
Constructor Details
#initialize(dashboard:) ⇒ Dashboard
Returns a new instance of Dashboard.
6 7 8 |
# File 'app/components/ruby_ui_admin/views/dashboard.rb', line 6 def initialize(dashboard:) @dashboard = dashboard end |
Instance Method Details
#content ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/components/ruby_ui_admin/views/dashboard.rb', line 14 def content div(class: "mb-6") do h1(class: "text-2xl font-semibold tracking-tight") { @dashboard.class.title } if (description = @dashboard.class.description) p(class: "text-sm text-muted-foreground mt-1") { description } end end cards = @dashboard.get_cards if cards.empty? p(class: "text-muted-foreground") { "No cards defined yet." } else div(class: grid_class) do cards.each { |card| render RubyUIAdmin::Views::CardComponent.new(card: card) } end end end |
#page_title ⇒ Object
10 11 12 |
# File 'app/components/ruby_ui_admin/views/dashboard.rb', line 10 def page_title "#{@dashboard.class.title} ยท #{RubyUIAdmin.configuration.app_name}" end |