2016-09-24 03:00:46 +00:00
|
|
|
# frozen_string_literal: true
|
2017-11-06 16:15:18 +00:00
|
|
|
|
2012-09-23 02:39:12 +00:00
|
|
|
class MainController < ApplicationController
|
2016-09-25 17:04:58 +00:00
|
|
|
before_action :authorize_main
|
2016-09-25 17:00:30 +00:00
|
|
|
after_action :verify_authorized
|
2016-03-11 14:10:31 +00:00
|
|
|
|
2016-09-25 17:00:30 +00:00
|
|
|
# GET /
|
2013-01-08 04:03:41 +00:00
|
|
|
def home
|
2014-08-10 17:06:58 +00:00
|
|
|
respond_to do |format|
|
2016-09-24 03:00:46 +00:00
|
|
|
format.html do
|
2016-10-03 02:49:45 +00:00
|
|
|
if authenticated?
|
2016-10-07 03:45:17 +00:00
|
|
|
@maps = policy_scope(Map).where.not(name: 'Untitled Map').where.not(permission: 'private')
|
2016-10-03 02:49:45 +00:00
|
|
|
.order(updated_at: :desc).page(1).per(20)
|
2016-09-25 15:37:08 +00:00
|
|
|
render 'explore/active'
|
2016-10-03 02:49:45 +00:00
|
|
|
else
|
|
|
|
render 'main/home'
|
2016-09-24 03:00:46 +00:00
|
|
|
end
|
|
|
|
end
|
2014-08-10 17:06:58 +00:00
|
|
|
end
|
2013-01-08 04:03:41 +00:00
|
|
|
end
|
2016-09-25 17:04:58 +00:00
|
|
|
|
|
|
|
# GET /request
|
|
|
|
def requestinvite
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def authorize_main
|
|
|
|
authorize :Main
|
|
|
|
end
|
2012-09-23 02:39:12 +00:00
|
|
|
end
|