parent
6477792f1d
commit
557109662c
@ -1,25 +1,12 @@
|
|||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
protect_from_forgery with: :exception, prepend: true
|
|
||||||
before_action :set_google_analytics_id
|
before_action :set_google_analytics_id
|
||||||
|
before_action :set_hotjar_id
|
||||||
|
|
||||||
|
|
||||||
def verify_admin
|
|
||||||
return true #if current_user.admin?(@school)
|
|
||||||
|
|
||||||
redirect_to root_path, notice: 'You must be logged in as an admin of that school to access that page.'
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
def authenticate(username, password)
|
|
||||||
return true if username == "boston"
|
|
||||||
authenticate_or_request_with_http_basic do |u, p|
|
|
||||||
u == username && p == password
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
def set_google_analytics_id
|
def set_google_analytics_id
|
||||||
@google_analytics_id = ENV['GOOGLE_ANALYTICS_ID']
|
@google_analytics_id = ENV['GOOGLE_ANALYTICS_ID']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_hotjar_id
|
||||||
|
@hotjar_id = ENV['HOTJAR_ID']
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,21 +1,8 @@
|
|||||||
class HomeController < ActionController::Base
|
class HomeController < ApplicationController
|
||||||
before_action :set_google_analytics_id
|
|
||||||
before_action :set_hotjar_id
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@districts = District.all.order(:name)
|
@districts = District.all.order(:name)
|
||||||
@schools = School.all
|
@schools = School.all
|
||||||
|
|
||||||
@categories = Category.sorted.map { |category| CategoryPresenter.new(category: category) }
|
@categories = Category.sorted.map { |category| CategoryPresenter.new(category: category) }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_google_analytics_id
|
|
||||||
@google_analytics_id = ENV['GOOGLE_ANALYTICS_ID']
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_hotjar_id
|
|
||||||
@hotjar_id = ENV['HOTJAR_ID']
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
module Legacy
|
||||||
|
class ApplicationController < ActionController::Base
|
||||||
|
protect_from_forgery with: :exception, prepend: true
|
||||||
|
before_action :set_google_analytics_id
|
||||||
|
|
||||||
|
layout "legacy/application"
|
||||||
|
|
||||||
|
def verify_admin
|
||||||
|
return true #if current_user.admin?(@school)
|
||||||
|
|
||||||
|
redirect_to root_path, notice: 'You must be logged in as an admin of that school to access that page.'
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
def authenticate(username, password)
|
||||||
|
return true if username == "boston"
|
||||||
|
authenticate_or_request_with_http_basic do |u, p|
|
||||||
|
u == username && p == password
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_google_analytics_id
|
||||||
|
@google_analytics_id = ENV['GOOGLE_ANALYTICS_ID']
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in new issue