space/app/controllers/spaces_controller.rb

28 lines
649 B
Ruby

class SpacesController < ApplicationController
def index
buildings = Building.all.collect do |building|
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
{
"building-title" => building.title,
"building-image" => building.image.url,
"alt-title" => building.title,
"floors" => floors
}
end
{
"buildings" => buildings,
"extra" => {
}
}
end
end