mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 15:08:15 -07:00
inline list of years
This commit is contained in:
parent
6c626be9c5
commit
d240e8cdc2
3 changed files with 6 additions and 9 deletions
|
|
@ -17,7 +17,6 @@ class CategoriesController < ApplicationController
|
|||
school_categories = SchoolCategory.for(@school, @category)
|
||||
@years = school_categories.map(&:year).map(&:to_i).sort
|
||||
@year = (params[:year] || @years.last || "2019").to_i
|
||||
@years.delete(@year)
|
||||
|
||||
if school_categories.empty?
|
||||
school_categories = [SchoolCategory.new(school: @school, category: @category, year: @year)]
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ class SchoolsController < ApplicationController
|
|||
|
||||
@years = @school_categories.map(&:year).map(&:to_i).sort.uniq
|
||||
@year = (params[:year] || @years.last || "2019").to_i
|
||||
@years.delete(@year)
|
||||
|
||||
missing_categories = @categories - @school_categories.map(&:category)
|
||||
missing_categories.each do |category|
|
||||
|
|
|
|||
|
|
@ -5,17 +5,16 @@
|
|||
= simple_format(@school.description)
|
||||
- if @year.present?
|
||||
%p
|
||||
Data from
|
||||
= "#{@year - 1}-#{@year}"
|
||||
school year.
|
||||
|
||||
- if @years.present?
|
||||
%p
|
||||
Show year:
|
||||
- @years.each do |year|
|
||||
%b Data from:
|
||||
- @years.sort.reverse.each do |year|
|
||||
|
||||
- if @school_category.present?
|
||||
= link_to("#{year - 1}-#{year}", school_category_path(@school_category.school, @school_category.category, year: year))
|
||||
= link_to_unless(year == @year, "#{year - 1}-#{year}", school_category_path(@school_category.school, @school_category.category, year: year))
|
||||
- else
|
||||
= link_to("#{year - 1}-#{year}", school_path(@school, year: year))
|
||||
= link_to_unless(year == @year, "#{year - 1}-#{year}", school_path(@school, year: year))
|
||||
- if @school.district.present?
|
||||
%p
|
||||
%strong District:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue