2012-09-22 22:39:12 -04:00
|
|
|
class MainController < ApplicationController
|
2013-01-01 17:45:35 -05:00
|
|
|
include TopicsHelper
|
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
|
2013-01-01 17:45:35 -05:00
|
|
|
@topics = Array.new()
|
2012-12-23 01:12:56 -05:00
|
|
|
if params[:topics_by_user_id] != ""
|
|
|
|
@user = User.find(params[:topics_by_user_id])
|
2013-01-01 17:45:35 -05:00
|
|
|
@topics = Topic.visibleToUser(@current, @user)
|
2012-12-23 01:12:56 -05:00
|
|
|
elsif params[:topics_by_map_id] != ""
|
|
|
|
@map = Map.find(params[:topics_by_map_id])
|
2013-01-01 17:45:35 -05:00
|
|
|
@topics = @map.topics.delete_if{|topic| not topic.authorize_to_view(@current)}
|
2012-12-23 01:12:56 -05:00
|
|
|
end
|
|
|
|
respond_to do |format|
|
2013-01-01 17:45:35 -05:00
|
|
|
format.js { respond_with(@topics) }
|
2012-12-23 01:12:56 -05:00
|
|
|
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
|