1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-05 16:24:21 +01:00
fab-manager/app/views/api/machines/show.json.jbuilder

23 lines
944 B
Plaintext
Raw Normal View History

# frozen_string_literal: true
2017-10-11 12:10:05 +02:00
json.extract! @machine, :id, :name, :description, :spec, :disabled, :created_at, :updated_at, :slug
2015-05-05 03:10:25 +02:00
json.machine_image @machine.machine_image.attachment.large.url if @machine.machine_image
json.machine_files_attributes @machine.machine_files do |f|
json.id f.id
json.attachment f.attachment_identifier
json.attachment_url f.attachment_url
end
json.trainings @machine.trainings.each, :id, :name, :disabled
json.current_user_is_training current_user.training_machine?(@machine) if current_user
if current_user && !current_user.training_machine?(@machine) && current_user.training_reservation_by_machine(@machine)
json.current_user_training_reservation do
json.partial! 'api/reservations/reservation', reservation: current_user.training_reservation_by_machine(@machine)
end
end
2015-05-05 03:10:25 +02:00
json.machine_projects @machine.projects.published.last(10) do |p|
json.id p.id
json.name p.name
json.slug p.slug
end