Class: Avo::Dashboards::BaseDashboard
- Inherits:
-
Object
- Object
- Avo::Dashboards::BaseDashboard
- Extended by:
- ActiveSupport::DescendantsTracker
- Defined in:
- lib/avo/dashboards/base_dashboard.rb
Class Method Summary collapse
- .card(klass, label: nil, description: nil, cols: nil, rows: nil, refresh_every: nil, options: {}, arguments: {}) ⇒ Object
- .classes ⇒ Object
- .divider(**args) ⇒ Object
- .is_hidden? ⇒ Boolean
- .is_visible? ⇒ Boolean
- .item_at_index(index) ⇒ Object
- .items ⇒ Object
- .navigation_label ⇒ Object
- .navigation_path ⇒ Object
- .options_deprecation_message ⇒ Object
Class Method Details
.card(klass, label: nil, description: nil, cols: nil, rows: nil, refresh_every: nil, options: {}, arguments: {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 20 def card(klass, label: nil, description: nil, cols: nil, rows: nil, refresh_every: nil, options: {}, arguments: {}) if .present? self.items_holder ||= [] self.items_holder << klass.new(dashboard: self, label: label, description: description, cols: cols, rows: rows, refresh_every: refresh_every, options: , arguments: arguments, index: index ) self.index += 1 end |
.classes ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 55 def classes case grid_cols when 3 "sm:grid-cols-3" when 4 "sm:grid-cols-4" when 5 "sm:grid-cols-5" when 6 "sm:grid-cols-6" else "sm:grid-cols-3" end end |
.divider(**args) ⇒ Object
45 46 47 48 49 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 45 def divider(**args) self.items_holder ||= [] self.items_holder << BaseDivider.new(**args) end |
.is_hidden? ⇒ Boolean
90 91 92 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 90 def is_hidden? !is_visible? end |
.is_visible? ⇒ Boolean
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 78 def is_visible? # Default is true return true if visible == true # Hide if false return false if visible == false if visible.respond_to? :call ::Avo::Hosts::DashboardVisibility.new(block: visible, dashboard: self).handle end end |
.item_at_index(index) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 37 def item_at_index(index) items.find do |item| next if item.index.blank? item.index == index end end |
.items ⇒ Object
51 52 53 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 51 def items self.items_holder end |
.navigation_label ⇒ Object
70 71 72 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 70 def name end |
.navigation_path ⇒ Object
74 75 76 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 74 def Avo::App.view_context.avo.dashboard_path id end |
.options_deprecation_message ⇒ Object
16 17 18 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 16 def Rails.logger.warn "DEPRECATION WARNING: Card options parameter is deprecated in favor of arguments parameter and will be removed from Avo version 3.0.0" end |