Display pre-selected dropdowns on dashboard graph

pull/1/head
Alex Basson 4 years ago
parent 810a702333
commit 886f94a60c

@ -24,7 +24,7 @@ class DashboardController < ApplicationController
end
def academic_year
params[:year]
@academic_year ||= params[:year]
end
end

@ -1,2 +0,0 @@
module CategoriesHelper
end

@ -0,0 +1,6 @@
module DashboardHelper
def format_academic_year(ay)
years = ay.split('-')
"#{years.first} 20#{years.second}"
end
end

@ -1,2 +0,0 @@
module DistrictsHelper
end

@ -1,2 +0,0 @@
module QuestionListsHelper
end

@ -1,3 +0,0 @@
module QuestionsHelper
end

@ -1,2 +0,0 @@
module RecipientListsHelper
end

@ -1,2 +0,0 @@
module RecipientsHelper
end

@ -1,2 +0,0 @@
module SchoolsHelper
end

@ -1,5 +1,25 @@
<h1><%= @school.name %></h1>
<div>
<h2>Areas Of Interest</h2>
<select name="academic-year">
<option value="<%= @academic_year %>" selected><%= format_academic_year(@academic_year) %></option>
</select>
<select name="district">
<option value="<%= @district.name %>" selected><%= @district.name %></option>
</select>
<select name="school">
<option value="<%= @school.slug %>" selected><%= @school.name %></option>
</select>
</div>
<div>
<h2>Top & Bottom 5 Distance From Benchmark</h2>
</div>
<% heading_gutter = 30 %>
<% graph_height = @construct_graph_row_presenters.length * ConstructGraphParameters::CONSTRUCT_ROW_HEIGHT + heading_gutter %>
<svg viewbox="0 0 <%= ConstructGraphParameters::TOTAL_GRAPH_WIDTH %> <%= graph_height %>" width=<%= ConstructGraphParameters::TOTAL_GRAPH_WIDTH %> height=<%= graph_height %> xmlns="http://www.w3.org/2000/svg">

@ -31,6 +31,10 @@ feature "School dashboard", type: feature do
visit "/districts/winchester/schools/#{school.slug}/dashboard?year=#{ay_2020_21}"
expect(page).to have_select('academic-year', selected: '2020 2021')
expect(page).to have_select('district', selected: 'Winchester')
expect(page).to have_select('school', selected: 'Winchester High School')
expect(page).to have_text(school.name)
expect(page).to have_text('Professional Qualifications')
first_row_bar = construct_row_bars.first

Loading…
Cancel
Save