Sha256: 306db56f999778f3b838a38dc09ac2c60f8ff0da45490c467e618fe1969d6818
Contents?: true
Size: 1.15 KB
Versions: 11
Compression:
Stored size: 1.15 KB
Contents
require 'ostruct' require 'delegate' require 'action_view' require 'active_support/core_ext/object/blank' require 'woople_theme_i18n' class OutlineAssessmentPresenter < SimpleDelegator include ActionView::Helpers::TagHelper def render yield if enabled? end def render_relearnings yield unless relearnings.empty? end def start_button_tag css = 'btn btn-primary btn-large' if url.present? content_tag(:a, I18n.t('woople_theme.assessment.start'), class: css, href: url) else content_tag(:a, I18n.t('woople_theme.assessment.start'), class: "#{css} disabled") end end def history_link_tag history.empty? ? '' : content_tag(:a, I18n.t('woople_theme.assessment.history')) end def each_history_item history.each do |history_item| yield normalize(history_item) end end private def normalize history_item OpenStruct.new( date: WoopleThemeI18n.l(history_item.completed_at.to_date), score: "#{history_item.score}%", result_name: history_item.passed ? I18n.t('woople_theme.assessment.pass') : I18n.t('woople_theme.assessment.fail'), url: history_item.url ) end end
Version data entries
11 entries across 11 versions & 1 rubygems