class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController
	
	def index
		@newlocation = Location.new
	end

	def create
		debugger 
		@newlocation = Location.new(params[:location])
		@newlocation.save!
		render :action => "index"
	end

	def get_locations 
		locations = Location.all
		@data = Array.new

		locations.each do |location|
			picurl = "http://"+request.host + location.file.url
			thumburl = "http://"+request.host + location.file.thumb.url
			@data << {"name"=>location.name,"pic_url"=>picurl,"thumb_url"=>thumburl,"description"=>location.description}
		end
		render :json => @data.to_json
	end
	
end



