2012-09-22 22:39:12 -04:00
|
|
|
class MainController < ApplicationController
|
2012-10-26 06:04:52 -04:00
|
|
|
include ItemsHelper
|
2012-09-22 22:39:12 -04:00
|
|
|
|
2012-10-29 13:52:29 -04:00
|
|
|
before_filter :require_user, only: [:invite]
|
|
|
|
|
2012-09-22 22:39:12 -04:00
|
|
|
respond_to :html, :js, :json
|
|
|
|
|
2012-12-14 13:31:39 -05:00
|
|
|
def console
|
2012-10-28 14:37:46 -04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2012-12-23 01:12:56 -05:00
|
|
|
def search
|
|
|
|
@current = current_user
|
|
|
|
@items = Array.new()
|
|
|
|
if params[:topics_by_user_id] != ""
|
|
|
|
@user = User.find(params[:topics_by_user_id])
|
|
|
|
@items = Item.visibleToUser(@current, @user)
|
|
|
|
elsif params[:topics_by_map_id] != ""
|
|
|
|
@map = Map.find(params[:topics_by_map_id])
|
|
|
|
@items = @map.items.delete_if{|item| not item.authorize_to_view(@current)}
|
|
|
|
end
|
|
|
|
respond_to do |format|
|
|
|
|
format.js { respond_with(@items) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-10-29 13:52:29 -04:00
|
|
|
def invite
|
|
|
|
@user = current_user
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html { respond_with(@user) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-22 22:39:12 -04:00
|
|
|
|
|
|
|
end
|