app/controllers/decidim/conferences/admin/conference_registrations_controller.rb in decidim-conferences-0.26.7 vs app/controllers/decidim/conferences/admin/conference_registrations_controller.rb in decidim-conferences-0.26.8
- old
+ new
@@ -9,28 +9,30 @@
include Concerns::ConferenceAdmin
include Decidim::Paginable
helper_method :conference
+ alias conference current_participatory_space
+
def index
- enforce_permission_to :read_conference_registrations, :conference, conference: conference
+ enforce_permission_to(:read_conference_registrations, :conference, conference: current_participatory_space)
- @conference_registrations = paginate(Decidim::Conferences::ConferenceRegistration.where(conference: conference))
+ @conference_registrations = paginate(current_participatory_space.conference_registrations)
end
def export
- enforce_permission_to :export_conference_registrations, :conference, conference: conference
+ enforce_permission_to(:export_conference_registrations, :conference, conference: current_participatory_space)
- ExportConferenceRegistrations.call(conference, params[:format], current_user) do
+ ExportConferenceRegistrations.call(current_participatory_space, params[:format], current_user) do
on(:ok) do |export_data|
send_data export_data.read, type: "text/#{export_data.extension}", filename: export_data.filename("conference_registrations")
end
end
end
def confirm
- enforce_permission_to :confirm, :conference_registration, conference_registration: conference_registration
+ enforce_permission_to(:confirm, :conference_registration, conference_registration: conference_registration)
ConfirmConferenceRegistration.call(conference_registration, current_user) do
on(:ok) do
flash[:notice] = I18n.t("conference_registration.confirm.success", scope: "decidim.admin")
end
@@ -43,17 +45,13 @@
end
end
private
- def conference
- @conference ||= Decidim::Conference.find_by(slug: params[:conference_slug])
- end
-
def conference_registration
return if params[:id].blank?
- @conference_registration ||= conference.conference_registrations.find_by(id: params[:id])
+ @conference_registration ||= current_participatory_space.conference_registrations.find_by(id: params[:id])
end
end
end
end
end