Sha256: be0f190da94df131f83f3578dba6b9036c6efcad61201890d26ae81316746bb7
Contents?: true
Size: 1.35 KB
Versions: 30
Compression:
Stored size: 1.35 KB
Contents
require 'action_view' require 'woople_theme_i18n' class SubmittedAssessmentFormPresenter < AssessmentFormPresenter include ActionView::Helpers::NumberHelper include ActionView::Helpers::TagHelper enforce_definitions :completed_at, :passed?, :correct_questions, :score def title I18n.t('woople_theme.assessment.result') end def css_classes [:results] end def questions ThemePresentation.wrap_collection(__getobj__.questions, WoopleTheme::SubmittedQuestionPresenter) end 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 def footer_partial 'woople-theme/assessment_form_return' end def result_status_classes css_classes = [:alert] css_classes << (passed? ? 'alert-success' : 'alert-error') end def status passed? ? I18n.t('woople_theme.assessment.passed') : I18n.t('woople_theme.assessment.failed') end def total_questions questions.length end end
Version data entries
30 entries across 30 versions & 1 rubygems