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
|
|
|
|
2012-10-29 17:52:29 +00:00
|
|
|
before_filter :require_user, only: [:invite]
|
|
|
|
|
2012-09-23 02:39:12 +00:00
|
|
|
respond_to :html, :js, :json
|
|
|
|
|
2012-12-14 18:31:39 +00:00
|
|
|
def console
|
2012-10-28 18:37:46 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2012-12-23 06:12:56 +00: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 17:52:29 +00:00
|
|
|
def invite
|
|
|
|
@user = current_user
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html { respond_with(@user) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-23 02:39:12 +00:00
|
|
|
|
|
|
|
end
|