Class: OutlineAssessmentPresenter
- Inherits:
-
ExplicitDelegator
show all
- Includes:
- ActionView::Helpers::FormTagHelper, ActionView::Helpers::NumberHelper, ActionView::Helpers::TagHelper
- Defined in:
- app/presenters/outline_assessment_presenter.rb
Instance Method Summary
collapse
enforce_definitions, #enforced_methods, #ensure_defined, #initialize
Instance Method Details
#completed_class ⇒ Object
67
68
69
|
# File 'app/presenters/outline_assessment_presenter.rb', line 67
def completed_class
"completed" if completed?
end
|
#each_history_item ⇒ Object
39
40
41
42
43
|
# File 'app/presenters/outline_assessment_presenter.rb', line 39
def each_history_item
history.each do |history_item|
yield normalize(history_item)
end
end
|
#render ⇒ Object
17
18
19
|
# File 'app/presenters/outline_assessment_presenter.rb', line 17
def render
yield if enabled?
end
|
#render_history_link ⇒ Object
35
36
37
|
# File 'app/presenters/outline_assessment_presenter.rb', line 35
def render_history_link
yield unless history.empty?
end
|
#render_pass_fail_alert ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'app/presenters/outline_assessment_presenter.rb', line 45
def render_pass_fail_alert
return if passed?.nil?
if passed?
yield OpenStruct.new(
css_class: 'alert-success',
heading: I18n.t('woople_theme.assessment.pass_alert.heading'),
link: history.first.url,
link_text: I18n.t('woople_theme.assessment.pass_alert.link_text'),
message: ''
)
else
yield OpenStruct.new(
css_class: 'alert-error',
heading: I18n.t('woople_theme.assessment.fail_alert.heading'),
link: history.first.url,
link_text: I18n.t('woople_theme.assessment.fail_alert.link_text'),
message: I18n.t('woople_theme.assessment.fail_alert.message')
)
end
end
|
#render_relearnings ⇒ Object
21
22
23
|
# File 'app/presenters/outline_assessment_presenter.rb', line 21
def render_relearnings
yield unless relearnings.empty?
end
|
25
26
27
28
29
30
31
32
33
|
# File 'app/presenters/outline_assessment_presenter.rb', line 25
def start_button_tag
css_classes = 'btn btn-primary btn-large'
if startable?
submit_tag I18n.t('woople_theme.assessment.start'), class: css_classes
else
submit_tag I18n.t('woople_theme.assessment.start'), class: "#{css_classes} disabled", disabled: true
end
end
|