Sha256: 802c836fdb20754de06b30c1a53007a7b22956bb63bb5397c1262e07d74bacdc

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require 'woople_theme_i18n'

module WoopleTheme
  module Dashboard
    class ElectiveHistoryPresenter < ContentItemPresenter
      include ContentImage

      enforce_definitions :completed_on,
                          :current_points,
                          :total_points

      def render_time_remaining(&block)
      end

      def render_popularity(&block)
      end

      def render_certification_metadata(&block)
      end

      def render_progress_bar(&block)
      end

      def render_elective_points(&block)
        yield(points_metadata)
      end

      def render_completed_on(&block)
        yield(formatted_date)
      end

      private

      def formatted_date
        WoopleThemeI18n.l(completed_on.to_date)
      end

      def points_metadata
        if in_progress?
          I18n.t('woople_theme.dashboards.member.points', count: total_points, points: "#{current_points}/#{total_points}")
        else
          I18n.t('woople_theme.dashboards.member.points', count: total_points, points: total_points)
        end
      end

      def in_progress?
        current_points < total_points
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
woople-theme-0.5.12 app/presenters/woople_theme/dashboard/elective_history_presenter.rb
woople-theme-0.5.11 app/presenters/woople_theme/dashboard/elective_history_presenter.rb
woople-theme-0.5.10 app/presenters/woople_theme/dashboard/elective_history_presenter.rb
woople-theme-0.5.9 app/presenters/woople_theme/dashboard/elective_history_presenter.rb