Sha256: bbbafc7778b3d0807e97f3ed77d15a46f8219b8359d6a49a504eb5db8b912ce4
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 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'), class: 'flip-action pull-right') 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
woople-theme-0.2.34 | app/presenters/outline_assessment_presenter.rb |