Sha256: 7cc93fad762c6233b3b28c3f01479cadab4453c7ca8c19fdedb48980d9729cdd

Contents?: true

Size: 978 Bytes

Versions: 18

Compression:

Stored size: 978 Bytes

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

      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
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
decidim-meetings-0.17.2 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.17.1 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.16.1 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.17.0 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.16.0 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.15.2 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.15.1 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.15.0 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.14.4 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.14.3 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.14.2 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.14.1 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.13.1 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.12.2 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.13.0 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.12.1 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.13.0.pre1 app/cells/decidim/meetings/join_meeting_button_cell.rb
decidim-meetings-0.12.0 app/cells/decidim/meetings/join_meeting_button_cell.rb