Class: WoopleTheme::Reports::ActivityReportPresenter
- Inherits:
-
ExplicitDelegator
show all
- Includes:
- ActionView::Helpers::UrlHelper
- Defined in:
- app/presenters/woople_theme/reports/activity_report_presenter.rb
Constant Summary
collapse
- DAILY_LEGEND =
['0-3', '4-6', '7+']
- WEEKLY_LEGEND =
['0-28', '29-48', '49+']
- MONTHLY_LEGEND =
['0-123', '124-216', '217+']
Instance Method Summary
collapse
enforce_definitions, #enforced_methods, #ensure_defined, #initialize
Instance Method Details
#chart_title ⇒ Object
52
53
54
55
56
|
# File 'app/presenters/woople_theme/reports/activity_report_presenter.rb', line 52
def chart_title
return I18n.t('woople_theme.reports.chart.titles.daily') if daily?
return I18n.t('woople_theme.reports.chart.titles.weekly') if weekly?
return I18n.t('woople_theme.reports.chart.titles.monthly') if monthly?
end
|
#container ⇒ Object
42
43
44
|
# File 'app/presenters/woople_theme/reports/activity_report_presenter.rb', line 42
def container
"#{tab_name}_report_chart"
end
|
#daily? ⇒ Boolean
58
59
60
|
# File 'app/presenters/woople_theme/reports/activity_report_presenter.rb', line 58
def daily?
report.type.to_s == 'week'
end
|
#href ⇒ Object
38
39
40
|
# File 'app/presenters/woople_theme/reports/activity_report_presenter.rb', line 38
def href
"##{tab_name}"
end
|
#legend ⇒ Object
46
47
48
49
50
|
# File 'app/presenters/woople_theme/reports/activity_report_presenter.rb', line 46
def legend
return DAILY_LEGEND if daily?
return WEEKLY_LEGEND if weekly?
return MONTHLY_LEGEND if monthly?
end
|
#monthly? ⇒ Boolean
66
67
68
|
# File 'app/presenters/woople_theme/reports/activity_report_presenter.rb', line 66
def monthly?
report.type.to_s == 'annual'
end
|
#name ⇒ Object
30
31
32
|
# File 'app/presenters/woople_theme/reports/activity_report_presenter.rb', line 30
def name
report.name.titleize
end
|
#report_link ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/presenters/woople_theme/reports/activity_report_presenter.rb', line 15
def report_link
link_to(
name,
href,
{
data: {
toggle: 'tab',
type: type,
container: container,
path: data_path
}
}
)
end
|
#tab_name ⇒ Object
34
35
36
|
# File 'app/presenters/woople_theme/reports/activity_report_presenter.rb', line 34
def tab_name
report.type.downcase
end
|
#weekly? ⇒ Boolean
62
63
64
|
# File 'app/presenters/woople_theme/reports/activity_report_presenter.rb', line 62
def weekly?
report.type.to_s == 'month'
end
|