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