Sha256: 3f40f04ca49b62ec9d3ee22bfdfa5744b79b4b9e016949358076698925303053

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    # This cell renders the media link card for an instance of a RegistrationType
    class RegistrationTypeCell < Decidim::ViewModel
      include ActionView::Helpers::NumberHelper
      include Decidim::SanitizeHelper
      include Decidim::Conferences::Engine.routes.url_helpers
      include Decidim::LayoutHelper

      def show
        render
      end

      private

      delegate :current_user, to: :controller, prefix: false

      def title
        translated_attribute model.title
      end

      def description
        translated_attribute model.description
      end

      def price
        return I18n.t("free", scope: "decidim.conferences.conference.show") if model.price.blank?
        number_to_currency(model.price, locale: I18n.locale, unit: Decidim.currency_unit)
      end

      def allowed?
        options[:allowed]
      end

      def button_classes
        "button button--sc small"
      end

      def conference
        model.conference
      end

      def i18n_join_text
        return I18n.t("registration", scope: "decidim.conferences.conference.show") if conference.has_available_slots?
        I18n.t("no_slots_available", scope: "decidim.conferences.conference.show")
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-conferences-0.18.1 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.17.2 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.18.0 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.17.1 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.16.1 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.17.0 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.16.0 app/cells/decidim/conferences/registration_type_cell.rb