Sha256: 0343b6f729870ad8a0e15d326b01ff9f888c9b67c71166bfae7fda3ca5b7cdbb

Contents?: true

Size: 1.52 KB

Versions: 24

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    # This cell renders the button to join a meeting.
    class JoinMeetingButtonCell < Decidim::ViewModel
      include MeetingCellsHelper
      include Decidim::SanitizeHelper
      include ActionView::Helpers::FormTagHelper
      include ActionView::Helpers::FormOptionsHelper

      def show
        render
      end

      private

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

      def current_component
        model.component
      end

      def button_classes
        return "button expanded button--sc" if big_button?

        "button card__button button--sc small"
      end

      def big_button?
        options[:big_button]
      end

      def shows_remaining_slots?
        options[:show_remaining_slots] && model.available_slots.positive?
      end

      def i18n_join_text
        return I18n.t("join", scope: "decidim.meetings.meetings.show") if model.has_available_slots?

        I18n.t("no_slots_available", scope: "decidim.meetings.meetings.show")
      end

      def i18n_confirm_text
        I18n.t("confirm", scope: "decidim.meetings.meetings.registration_confirm")
      end

      def i18n_cancel_text
        I18n.t("cancel", scope: "decidim.meetings.meetings.registration_confirm")
      end

      def registration_terms_text
        decidim_sanitize_editor translated_attribute(model.registration_terms)
      end

      def registration_form
        @registration_form ||= Decidim::Meetings::JoinMeetingForm.new
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
decidim-meetings-0.27.9 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.27.8 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.27.7 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.27.6 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.26.10 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.26.9 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.27.5 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.26.8 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.27.4 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.27.3 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.26.7 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.26.5 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.27.2 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.27.1 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.26.4 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.27.0 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.26.3 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.27.0.rc2 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.27.0.rc1 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.26.2 app/cells/decidim/meetings/join_meeting_button_cell.rb