Sha256: a5acd9a2ab157ca30faf4148cade5e31f94efa7794915d2efa13efe9a05c966d

Contents?: true

Size: 1.67 KB

Versions: 22

Compression:

Stored size: 1.67 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    module Admin
      # Controller that allows inviting users to join a conference.
      #
      class ConferenceInvitesController < Decidim::Conferences::Admin::ApplicationController
        include Concerns::ConferenceAdmin

        helper_method :conference

        def index
          enforce_permission_to :read_invites, :conference, conference: conference

          @query = params[:q]
          @status = params[:status]
          @conference_invites = Decidim::Conferences::Admin::ConferenceInvites.for(conference.conference_invites, @query, @status).page(params[:page]).per(15)
        end

        def new
          enforce_permission_to :invite_attendee, :conference, conference: conference

          @form = form(ConferenceRegistrationInviteForm).instance
        end

        def create
          enforce_permission_to :invite_attendee, :conference, conference: conference

          @form = form(ConferenceRegistrationInviteForm).from_params(params)

          InviteUserToJoinConference.call(@form, conference, current_user) do
            on(:ok) do
              flash[:notice] = I18n.t("conference_invites.create.success", scope: "decidim.conferences.admin")
              redirect_to conference_conference_invites_path(conference)
            end

            on(:invalid) do
              flash.now[:alert] = I18n.t("conference_invites.create.error", scope: "decidim.conferences.admin")
              render :new
            end
          end
        end

        private

        def conference
          @conference ||= Decidim::Conference.find_by(slug: params[:conference_slug])
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
decidim-conferences-0.27.3 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.26.7 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.26.5 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.27.2 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.27.1 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.26.4 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.27.0 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.26.3 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.27.0.rc2 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.27.0.rc1 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.26.2 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.26.1 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.26.0 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.26.0.rc2 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.26.0.rc1 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.25.2 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.25.1 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.25.0 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.25.0.rc4 app/controllers/decidim/conferences/admin/conference_invites_controller.rb
decidim-conferences-0.25.0.rc3 app/controllers/decidim/conferences/admin/conference_invites_controller.rb