Class: ExceptionHunter::DashboardPresenter
- Inherits:
-
Object
- Object
- ExceptionHunter::DashboardPresenter
- Defined in:
- app/presenters/exception_hunter/dashboard_presenter.rb
Constant Summary collapse
- LAST_7_DAYS_TAB =
'last_7_days'.freeze
- CURRENT_MONTH_TAB =
'current_month'.freeze
- TOTAL_ERRORS_TAB =
'total_errors'.freeze
- RESOLVED_ERRORS_TAB =
'resolved'.freeze
- IGNORED_ERRORS_TAB =
'ignored'.freeze
- TABS =
[LAST_7_DAYS_TAB, CURRENT_MONTH_TAB, TOTAL_ERRORS_TAB, RESOLVED_ERRORS_TAB, IGNORED_ERRORS_TAB].freeze
- DEFAULT_TAB =
LAST_7_DAYS_TAB
Instance Attribute Summary collapse
- #current_tab ⇒ Object readonly
Instance Method Summary collapse
- #errors_count(tab) ⇒ Object
-
#initialize(current_tab) ⇒ DashboardPresenter
constructor
A new instance of DashboardPresenter.
- #partial_for_tab ⇒ Object
- #tab_active?(tab) ⇒ Boolean
Constructor Details
#initialize(current_tab) ⇒ DashboardPresenter
Returns a new instance of DashboardPresenter.
13 14 15 16 |
# File 'app/presenters/exception_hunter/dashboard_presenter.rb', line 13 def initialize(current_tab) assign_tab(current_tab) calculate_tabs_counts end |
Instance Attribute Details
#current_tab ⇒ Object (readonly)
11 12 13 |
# File 'app/presenters/exception_hunter/dashboard_presenter.rb', line 11 def current_tab @current_tab end |
Instance Method Details
#errors_count(tab) ⇒ Object
31 32 33 |
# File 'app/presenters/exception_hunter/dashboard_presenter.rb', line 31 def errors_count(tab) @tabs_counts[tab] end |
#partial_for_tab ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'app/presenters/exception_hunter/dashboard_presenter.rb', line 22 def partial_for_tab case current_tab when LAST_7_DAYS_TAB 'exception_hunter/errors/last_7_days_errors_table' when CURRENT_MONTH_TAB, TOTAL_ERRORS_TAB, RESOLVED_ERRORS_TAB, IGNORED_ERRORS_TAB 'exception_hunter/errors/errors_table' end end |
#tab_active?(tab) ⇒ Boolean
18 19 20 |
# File 'app/presenters/exception_hunter/dashboard_presenter.rb', line 18 def tab_active?(tab) tab == current_tab end |