1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-03 14:24:23 +01:00
fab-manager/app/views/api/trainings/index.json.jbuilder

8 lines
349 B
Plaintext
Raw Normal View History

2016-06-21 17:02:44 +02:00
role = (current_user and current_user.is_admin?) ? 'admin' : 'user'
2016-03-23 18:39:41 +01:00
json.array!(@trainings) do |training|
json.extract! training, :id, :name, :description, :machine_ids, :nb_total_places, :slug
json.training_image training.training_image.attachment.large.url if training.training_image
json.plan_ids training.plan_ids if role === 'admin'
2016-03-23 18:39:41 +01:00
end