mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Always reference fully-qualified School/District/Category in controllers
This commit is contained in:
parent
413096dfe2
commit
1be86721b0
10 changed files with 24 additions and 24 deletions
|
|
@ -6,7 +6,7 @@ module Legacy
|
|||
# GET /categories
|
||||
# GET /categories.json
|
||||
def index
|
||||
@categories = Category.all
|
||||
@categories = Legacy::Category.all
|
||||
end
|
||||
|
||||
# GET /categories/1
|
||||
|
|
@ -25,7 +25,7 @@ module Legacy
|
|||
|
||||
@school_category = school_categories.select { |sc| sc.year.to_s == @year.to_s }.first
|
||||
@child_school_categories = SchoolCategory.for_parent_category(@school, @category).in(@year).valid.to_a
|
||||
missing_categories = Category.for_parent(@category) - @child_school_categories.map(&:category)
|
||||
missing_categories = Legacy::Category.for_parent(@category) - @child_school_categories.map(&:category)
|
||||
missing_categories.each do |category|
|
||||
next if category.benchmark.present?
|
||||
@child_school_categories << category.school_categories.new(school: @school)
|
||||
|
|
@ -40,7 +40,7 @@ module Legacy
|
|||
|
||||
# GET /categories/new
|
||||
def new
|
||||
@category = Category.new
|
||||
@category = Legacy::Category.new
|
||||
end
|
||||
|
||||
# GET /categories/1/edit
|
||||
|
|
@ -50,7 +50,7 @@ module Legacy
|
|||
# POST /categories
|
||||
# POST /categories.json
|
||||
def create
|
||||
@category = Category.new(category_params)
|
||||
@category = Legacy::Category.new(category_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @category.save
|
||||
|
|
@ -91,12 +91,12 @@ module Legacy
|
|||
|
||||
def set_school
|
||||
redirect_to root_path and return false unless params.include?(:school_id)
|
||||
@school = School.friendly.find(params[:school_id])
|
||||
@school = Legacy::School.friendly.find(params[:school_id])
|
||||
redirect_to root_path and return false if @school.nil?
|
||||
end
|
||||
|
||||
def set_category
|
||||
@category = Category.friendly.find(params[:id])
|
||||
@category = Legacy::Category.friendly.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ module Legacy
|
|||
# GET /districts
|
||||
# GET /districts.json
|
||||
def index
|
||||
@districts = District.all.alphabetic
|
||||
@districts = Legacy::District.all.alphabetic
|
||||
end
|
||||
|
||||
# GET /districts/1
|
||||
|
|
@ -17,7 +17,7 @@ module Legacy
|
|||
|
||||
# GET /districts/new
|
||||
def new
|
||||
@district = District.new
|
||||
@district = Legacy::District.new
|
||||
end
|
||||
|
||||
# GET /districts/1/edit
|
||||
|
|
@ -27,7 +27,7 @@ module Legacy
|
|||
# POST /districts
|
||||
# POST /districts.json
|
||||
def create
|
||||
@district = District.new(district_params)
|
||||
@district = Legacy::District.new(district_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @district.save
|
||||
|
|
@ -68,7 +68,7 @@ module Legacy
|
|||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_district
|
||||
@district = District.find_by_slug(params[:id])
|
||||
@district = Legacy::District.find_by_slug(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ module Legacy
|
|||
|
||||
def set_school
|
||||
redirect_to root_path and return false unless params.include?(:school_id)
|
||||
@school = School.friendly.find(params[:school_id])
|
||||
@school = Legacy::School.friendly.find(params[:school_id])
|
||||
redirect_to root_path and return false if @school.nil?
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ module Legacy
|
|||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_school
|
||||
@school = School.friendly.find(params[:school_id])
|
||||
@school = Legacy::School.friendly.find(params[:school_id])
|
||||
end
|
||||
|
||||
def set_recipient_list
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ module Legacy
|
|||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_school
|
||||
@school = School.friendly.find(params[:school_id])
|
||||
@school = Legacy::School.friendly.find(params[:school_id])
|
||||
end
|
||||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ module Legacy
|
|||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_school
|
||||
@school = School.friendly.find(params[:school_id])
|
||||
@school = Legacy::School.friendly.find(params[:school_id])
|
||||
end
|
||||
|
||||
def set_schedule
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ module Legacy
|
|||
@year = (params[:year] || @years.last).to_i
|
||||
|
||||
if @district.name == "Boston"
|
||||
@categories = Category.joins(:questions)
|
||||
@categories = Legacy::Category.joins(:questions)
|
||||
@school_categories = SchoolCategory.where(school: @school).where(category: @categories).in(@year).to_a
|
||||
else
|
||||
@categories = Category.root
|
||||
@categories = Legacy::Category.root
|
||||
@school_categories = @school.school_categories.for_parent_category(@school, nil).valid.in(@year).sort
|
||||
end
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ module Legacy
|
|||
|
||||
# GET /schools/new
|
||||
def new
|
||||
@school = School.new
|
||||
@school = Legacy::School.new
|
||||
end
|
||||
|
||||
# GET /schools/1/edit
|
||||
|
|
@ -44,7 +44,7 @@ module Legacy
|
|||
# POST /schools
|
||||
# POST /schools.json
|
||||
def create
|
||||
@school = School.new(school_params)
|
||||
@school = Legacy::School.new(school_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @school.save
|
||||
|
|
@ -85,7 +85,7 @@ module Legacy
|
|||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_school
|
||||
@school = School.friendly.find(params[:id] || params[:school_id])
|
||||
@school = Legacy::School.friendly.find(params[:id] || params[:school_id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ module Legacy
|
|||
class WelcomeController < ApplicationController
|
||||
|
||||
def index
|
||||
@districts = District.all.alphabetic
|
||||
@schools = School.all.alphabetic
|
||||
@districts = Legacy::District.all.alphabetic
|
||||
@schools = Legacy::School.all.alphabetic
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
- if user_signed_in? && current_user.super_admin?
|
||||
.row.super-admin
|
||||
.col-12
|
||||
%p= link_to "Create A New School In This District", new_district_school_path(@district)
|
||||
%p= link_to "Create A New School In This District", new_legacy_district_legacy_school_path(@district)
|
||||
|
||||
|
||||
- if true || user_signed_in?
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
- if user_signed_in? && current_user.super_admin?
|
||||
.row.super-admin
|
||||
.col-12
|
||||
%p= link_to "Create A New District", new_district_path
|
||||
%p= link_to "Create A New District", new_legacy_district_path
|
||||
|
||||
%p= link_to "Create A New School", new_school_path
|
||||
%p= link_to "Create A New School", new_legacy_school_path
|
||||
|
||||
|
||||
- if true || user_signed_in?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue