2015-09-25 06:32:59 +00:00
|
|
|
class SpacesController < ApplicationController
|
|
|
|
def index
|
2015-09-25 07:21:32 +00:00
|
|
|
buildings = Building.all.collect do |building|
|
2015-09-25 10:11:30 +00:00
|
|
|
floors = building.floors.collect do |floor|
|
|
|
|
image = (!floor.layout_image.nil? ? floor.layout_image.url : "/assets/no-layout.jpg")
|
|
|
|
{
|
|
|
|
"floor-title" => floor.title,
|
|
|
|
"floor-image" => image,
|
|
|
|
"alt-title" => floor.title,
|
|
|
|
"link_to_show" => OrbitHelper.url_to_show(floor.to_param)
|
|
|
|
}
|
|
|
|
end
|
2015-09-25 07:21:32 +00:00
|
|
|
{
|
|
|
|
"building-title" => building.title,
|
|
|
|
"building-image" => building.image.url,
|
2015-09-25 10:11:30 +00:00
|
|
|
"alt-title" => building.title,
|
|
|
|
"floors" => floors
|
2015-09-25 07:21:32 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2015-09-25 06:32:59 +00:00
|
|
|
{
|
2015-09-25 07:21:32 +00:00
|
|
|
"buildings" => buildings,
|
2015-09-25 06:32:59 +00:00
|
|
|
"extra" => {
|
2015-09-25 07:21:32 +00:00
|
|
|
|
2015-09-25 06:32:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|