2022-05-09 17:18:49 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-01-14 12:57:31 +01:00
|
|
|
role = (current_user and current_user.admin?) ? 'admin' : 'user'
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2017-07-18 10:55:41 +02:00
|
|
|
json.array!(@trainings) do |training|
|
2017-10-10 17:16:43 +02:00
|
|
|
json.extract! training, :id, :name, :description, :machine_ids, :nb_total_places, :slug, :disabled
|
2017-07-18 10:55:41 +02:00
|
|
|
json.training_image training.training_image.attachment.large.url if training.training_image
|
2022-05-09 17:18:49 +02:00
|
|
|
json.plan_ids training.plan_ids if role == 'admin'
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|