Sha256: 9ac65876c3dd9986d47382c767c00ff7ff57fac09685e5fa7424a198ee05099a

Contents?: true

Size: 1.31 KB

Versions: 21

Compression:

Stored size: 1.31 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
        decidim_sanitize translated_attribute model.title
      end

      def description
        decidim_sanitize 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

21 entries across 21 versions & 1 rubygems

Version Path
decidim-conferences-0.25.2 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.25.1 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.25.0 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.25.0.rc4 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.25.0.rc3 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.25.0.rc2 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.25.0.rc1 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.24.3 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.23.6 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.24.2 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.23.5 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.24.1 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.24.0 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.24.0.rc2 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.23.4 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.24.0.rc1 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.23.3 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.23.2 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.23.1 app/cells/decidim/conferences/registration_type_cell.rb
decidim-conferences-0.23.1.rc1 app/cells/decidim/conferences/registration_type_cell.rb