Class: Avo::Dashboards::BaseDashboard
- Inherits:
-
Object
- Object
- Avo::Dashboards::BaseDashboard
- Extended by:
- ActiveSupport::DescendantsTracker, Concerns::VisibleInDashboard
- 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: {}, visible: nil) ⇒ Object
- .classes ⇒ Object
- .divider(**args) ⇒ Object
- .item_at_index(index) ⇒ Object
- .items ⇒ Object
- .navigation_label ⇒ Object
- .navigation_path ⇒ Object
- .options_deprecation_message ⇒ Object
Methods included from Concerns::VisibleInDashboard
call_block, is_hidden?, is_visible?
Class Method Details
.card(klass, label: nil, description: nil, cols: nil, rows: nil, refresh_every: nil, options: {}, arguments: {}, visible: nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 23 def card(klass, label: nil, description: nil, cols: nil, rows: nil, refresh_every: nil, options: {}, arguments: {}, visible: nil) 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, visible: visible ) self.index += 1 end |
.classes ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 64 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
50 51 52 53 54 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 50 def divider(**args) self.items_holder ||= [] self.items_holder << BaseDivider.new(dashboard: self, **args) end |
.item_at_index(index) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 42 def item_at_index(index) items.find do |item| next if item.index.blank? item.index == index end end |
.items ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 56 def items items = self.items_holder || [] items.filter do |item| item.is_visible? end end |
.navigation_label ⇒ Object
79 80 81 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 79 def name end |
.navigation_path ⇒ Object
83 84 85 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 83 def Avo::App.view_context.avo.dashboard_path id end |
.options_deprecation_message ⇒ Object
19 20 21 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 19 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 |