Class: SubmittedAssessmentFormPresenter
- Inherits:
-
AssessmentFormPresenter
show all
- Includes:
- ActionView::Helpers::NumberHelper, ActionView::Helpers::TagHelper
- Defined in:
- app/presenters/submitted_assessment_form_presenter.rb
Instance Method Summary
collapse
#render_copyright
enforce_definitions, #enforced_methods, #ensure_defined, #initialize
Instance Method Details
#css_classes ⇒ Object
17
18
19
|
# File 'app/presenters/submitted_assessment_form_presenter.rb', line 17
def css_classes
[:results]
end
|
38
39
40
|
# File 'app/presenters/submitted_assessment_form_presenter.rb', line 38
def
'woople-theme/assessment_form_return'
end
|
#render_result_status {|OpenStruct.new(message: status_message, classes: result_status_classes)| ... } ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/presenters/submitted_assessment_form_presenter.rb', line 25
def render_result_status
status_message = I18n.t('woople_theme.assessment.result_status', {
completed_at: WoopleThemeI18n.l(completed_at.to_date),
status: status,
correct_questions: correct_questions,
total_questions: total_questions,
score: number_to_percentage(score, :precision => 0),
count: total_questions
})
yield OpenStruct.new(message: status_message, classes: result_status_classes)
end
|
#result_status_classes ⇒ Object
42
43
44
45
|
# File 'app/presenters/submitted_assessment_form_presenter.rb', line 42
def result_status_classes
css_classes = [:alert]
css_classes << (passed? ? 'alert-success' : 'alert-error')
end
|
#status ⇒ Object
47
48
49
|
# File 'app/presenters/submitted_assessment_form_presenter.rb', line 47
def status
passed? ? I18n.t('woople_theme.assessment.passed') : I18n.t('woople_theme.assessment.failed')
end
|
#title ⇒ Object
13
14
15
|
# File 'app/presenters/submitted_assessment_form_presenter.rb', line 13
def title
I18n.t('woople_theme.assessment.result')
end
|
#total_questions ⇒ Object
51
52
53
|
# File 'app/presenters/submitted_assessment_form_presenter.rb', line 51
def total_questions
questions.length
end
|