2012-09-23 02:39:12 +00:00
|
|
|
class MainController < ApplicationController
|
2012-10-26 10:04:52 +00:00
|
|
|
include ItemsHelper
|
2012-09-23 02:39:12 +00:00
|
|
|
|
|
|
|
respond_to :html, :js, :json
|
|
|
|
|
2012-10-28 18:37:46 +00:00
|
|
|
#homepage pick a random map and show it
|
|
|
|
def samplemap
|
|
|
|
@current = current_user
|
|
|
|
@maps = Map.visibleToUser(@current, nil)
|
|
|
|
@map = @maps.sample
|
|
|
|
|
|
|
|
@mapjson = @map.self_as_json(@current).html_safe
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html { respond_with(@map, @user) }
|
|
|
|
format.json { respond_with(@mapjson) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def metamap
|
2012-10-27 08:30:56 +00:00
|
|
|
@current = current_user
|
|
|
|
|
|
|
|
@item = Item.visibleToUser(@current, nil).first
|
|
|
|
@alljson = all_as_json(@current).html_safe
|
2012-10-19 04:06:16 +00:00
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html { respond_with(@item) }
|
|
|
|
format.json { respond_with(@alljson) }
|
|
|
|
end
|
2012-09-23 02:39:12 +00:00
|
|
|
end
|
2012-10-08 05:45:44 +00:00
|
|
|
|
2012-10-27 08:30:56 +00:00
|
|
|
def allmaps
|
|
|
|
@current = current_user
|
|
|
|
@maps = Map.visibleToUser(@current, nil)
|
2012-10-08 05:45:44 +00:00
|
|
|
|
2012-10-26 10:04:52 +00:00
|
|
|
respond_to do |format|
|
|
|
|
format.html { respond_with(@maps) }
|
2012-10-19 21:26:46 +00:00
|
|
|
end
|
2012-10-08 05:45:44 +00:00
|
|
|
end
|
2012-10-28 18:37:46 +00:00
|
|
|
|
2012-09-23 02:39:12 +00:00
|
|
|
|
|
|
|
end
|