Move legacy layouts into a legacy folder

pull/1/head
Liam Morley 4 years ago
parent 6477792f1d
commit 557109662c

@ -1,25 +1,12 @@
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception, prepend: true
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
@google_analytics_id = ENV['GOOGLE_ANALYTICS_ID']
end
def set_hotjar_id
@hotjar_id = ENV['HOTJAR_ID']
end
end

@ -1,21 +1,8 @@
class HomeController < ActionController::Base
before_action :set_google_analytics_id
before_action :set_hotjar_id
class HomeController < ApplicationController
def index
@districts = District.all.order(:name)
@schools = School.all
@categories = Category.sorted.map { |category| CategoryPresenter.new(category: category) }
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

@ -1,5 +1,5 @@
module Legacy
class AdminController < ApplicationController
class AdminController < Legacy::ApplicationController
def index
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

@ -1,5 +1,5 @@
module Legacy
class AttemptsController < ApplicationController
class AttemptsController < Legacy::ApplicationController
# before_action :set_attempt, only: [:edit, :update]
protect_from_forgery :except => [:twilio]

@ -1,5 +1,5 @@
module Legacy
class CategoriesController < ApplicationController
class CategoriesController < Legacy::ApplicationController
before_action :set_school, only: [:show]
before_action :set_category, only: [:show, :edit, :update, :destroy]

@ -1,5 +1,5 @@
module Legacy
class DistrictsController < ApplicationController
class DistrictsController < Legacy::ApplicationController
before_action :set_district, only: [:show, :edit, :update, :destroy]
# GET /districts

@ -1,5 +1,5 @@
module Legacy
class QuestionListsController < ApplicationController
class QuestionListsController < Legacy::ApplicationController
before_action :set_question_list, only: [:show, :edit, :update, :destroy]
# GET /question_lists

@ -1,5 +1,5 @@
module Legacy
class QuestionsController < ApplicationController
class QuestionsController < Legacy::ApplicationController
before_action :authenticate_user!, except: [:show]
before_action :verify_super_admin, except: [:show]
before_action :set_school, only: [:show]

@ -1,5 +1,5 @@
module Legacy
class RecipientListsController < ApplicationController
class RecipientListsController < Legacy::ApplicationController
before_action :authenticate_user!
before_action :set_school
before_action :verify_admin

@ -1,5 +1,5 @@
module Legacy
class RecipientsController < ApplicationController
class RecipientsController < Legacy::ApplicationController
before_action :authenticate_user!
before_action :set_school
before_action :verify_admin

@ -1,5 +1,5 @@
module Legacy
class SchedulesController < ApplicationController
class SchedulesController < Legacy::ApplicationController
before_action :authenticate_user!, except: [:show]
before_action :set_school
before_action :verify_admin

@ -1,5 +1,5 @@
module Legacy
class SchoolsController < ApplicationController
class SchoolsController < Legacy::ApplicationController
before_action :authenticate_user!, except: [:show]
before_action :set_school, only: [:admin, :show, :edit, :update, :destroy]
before_action :verify_admin, except: [:show, :create, :new]

@ -1,5 +1,5 @@
module Legacy
class UsersController < ApplicationController
class UsersController < Legacy::ApplicationController
def show; end
# private

@ -1,5 +1,5 @@
module Legacy
class WelcomeController < ApplicationController
class WelcomeController < Legacy::ApplicationController
def index
@districts = Legacy::District.all.alphabetic

@ -1,10 +1,7 @@
class SqmApplicationController < ActionController::Base
class SqmApplicationController < ApplicationController
protect_from_forgery with: :exception, prepend: true
layout "sqm/application"
before_action :set_schools_and_districts
before_action :authenticate_district
before_action :set_google_analytics_id
before_action :set_hotjar_id
private
@ -35,12 +32,4 @@ class SqmApplicationController < ActionController::Base
u == username && p == password
end
end
def set_google_analytics_id
@google_analytics_id = ENV['GOOGLE_ANALYTICS_ID']
end
def set_hotjar_id
@hotjar_id = ENV['HOTJAR_ID']
end
end

@ -16,7 +16,7 @@
<body>
<div>
<%= render partial: 'layouts/sqm/header' %>
<%= render partial: 'layouts/header' %>
</div>
<div class="bg-color-light-blue">
@ -30,10 +30,10 @@
</div>
<div>
<%= render partial: 'layouts/sqm/footer' %>
<%= render partial: 'layouts/footer' %>
</div>
<%= render partial: 'layouts/sqm/empty_dataset_modal' if @has_empty_dataset %>
<%= render partial: 'layouts/empty_dataset_modal' if @has_empty_dataset %>
</body>
</html>

@ -24,7 +24,7 @@
<%= yield %>
<div>
<%= render partial: 'layouts/sqm/footer' %>
<%= render partial: 'layouts/footer' %>
</div>
<script>

@ -25,7 +25,7 @@
.container
.row
.col-12
= render partial: 'layouts/header'
= render partial: 'layouts/legacy/header'
- if notice.present?
%p.notice= notice

@ -1,6 +1,6 @@
- valid = @school_category.school.district.name != "Boston" || (((@school_category.valid_child_count || 1) > 0) && (@school_category.category.benchmark.blank?))
= render 'layouts/school_header'
= render 'layouts/legacy/school_header'
- if @school_category.school.district.name != "Boston"
.row

@ -1,4 +1,4 @@
= render 'layouts/school_header'
= render 'layouts/legacy/school_header'
- if @school_categories.blank?
.row.pt-3.mt-3 &nbsp;

Loading…
Cancel
Save