mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Completes Sub Categories and Measures for "All " Category Tabs -
Milford High School (Milford District). Add tabs to top navigation [#179727241]
This commit is contained in:
parent
5595af15b6
commit
a406205e20
16 changed files with 106 additions and 17 deletions
|
|
@ -8,6 +8,7 @@ $white: #FFFFFF;
|
|||
$blue: #01788E;
|
||||
$red: #C93047;
|
||||
$light-blue: #FAFCFD;
|
||||
$dark-blue: #004D61;
|
||||
|
||||
$teal: #00B0B3;
|
||||
$mint: #B2D236;
|
||||
|
|
@ -42,6 +43,12 @@ $ideal: #C0FF73;
|
|||
background-color: $light-blue;
|
||||
}
|
||||
|
||||
.nav-tabs {
|
||||
.bg-color-dark-blue {
|
||||
background-color: $dark-blue;
|
||||
}
|
||||
}
|
||||
|
||||
.bg-color-blue {
|
||||
background-color: $blue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
@import 'fonts';
|
||||
@import 'bootstrap';
|
||||
@import 'fonts';
|
||||
|
||||
|
|
|
|||
12
app/assets/stylesheets/navigation.scss
Normal file
12
app/assets/stylesheets/navigation.scss
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
.nav-tabs {
|
||||
margin-bottom: -1rem;
|
||||
border-bottom: 1px solid transparent;
|
||||
.nav-link {
|
||||
color: white;
|
||||
border-top-left-radius: 15px;
|
||||
border-top-right-radius: 15px;
|
||||
}
|
||||
}
|
||||
.nav-item {
|
||||
margin-right: 1px;
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
@import "fonts";
|
||||
@import "borders";
|
||||
@import "dashboard";
|
||||
@import "navigation";
|
||||
@import "buttons";
|
||||
@import "scss/fontawesome.scss" ;
|
||||
@import "scss/solid.scss";
|
||||
|
|
|
|||
|
|
@ -1,8 +1,16 @@
|
|||
class SqmCategoriesController < SqmApplicationController
|
||||
|
||||
def show
|
||||
@categories = SqmCategory.all.order(:sort_index).map do |category|
|
||||
CategoryPresenter.new(
|
||||
category: category,
|
||||
academic_year: academic_year,
|
||||
school: school,
|
||||
)
|
||||
end
|
||||
|
||||
@category = CategoryPresenter.new(
|
||||
category: SqmCategory.find_by_name('Teachers & Leadership'),
|
||||
category: SqmCategory.find_by_slug(params[:id]),
|
||||
academic_year: academic_year,
|
||||
school: school,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
class SqmCategory < ActiveRecord::Base
|
||||
include FriendlyId
|
||||
|
||||
friendly_id :name, use: [:slugged]
|
||||
|
||||
has_many :subcategories
|
||||
end
|
||||
|
|
|
|||
|
|
@ -37,4 +37,8 @@ class CategoryPresenter
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
def to_model
|
||||
@category
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<div class="bg-color-blue">
|
||||
<div class="container">
|
||||
<div class="row py-4 justify-content-between align-items-center">
|
||||
<div class="col">
|
||||
<div class="col align-self-end">
|
||||
<% if content_for?(:navigation) %>
|
||||
<%= yield(:navigation) %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,15 @@
|
|||
<% content_for :navigation do %>
|
||||
<nav class="nav nav-tabs">
|
||||
<% @categories.each do |category| %>
|
||||
<div class="nav-item">
|
||||
<%= link_to [@district, @school, category, { year: @academic_year.range }], class: ["font-bitter", "weight-600","nav-link", "bg-color-dark-blue", current_page?([@district, @school, category, { year: @academic_year.range }]) ? "active" : ""] do %>
|
||||
<i class="fa fa-<%= category.icon %> me-2"></i> <%= category.name %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</nav>
|
||||
<% end %>
|
||||
|
||||
<h1 class="sub-header font-bitter color-red"><%= @category.name %></h1>
|
||||
<h2 class="col-8 body-large"><%= @category.description %></h2>
|
||||
|
||||
|
|
@ -19,7 +31,7 @@
|
|||
<div class="measure-presenter d-flex flex-column justify-space-between align-items-center px-5">
|
||||
<h3 class="measure-description sub-header-4 mb-5 "><%= measure_presenter.name %></h3>
|
||||
<div>
|
||||
<%= render partial: "gauge_graph", locals: { gauge: measure_presenter.gauge_presenter, gauge_class: 'gauge-graph-sm', font_class: 'font-cabin'} %>
|
||||
<%= render partial: "gauge_graph", locals: { gauge: measure_presenter.gauge_presenter, gauge_class: 'gauge-graph-sm', font_class: 'font-cabin' } %>
|
||||
</div>
|
||||
<p class="measure-description body-small mt-5 mb-4 "><%= measure_presenter.description %></p>
|
||||
</div>
|
||||
|
|
|
|||
6
db/migrate/20211007190742_add_slug_to_sqm_category.rb
Normal file
6
db/migrate/20211007190742_add_slug_to_sqm_category.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class AddSlugToSqmCategory < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :sqm_categories, :slug, :string
|
||||
add_index :sqm_categories, :slug, unique: true
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddSortIndexToSqmCategory < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :sqm_categories, :sort_index, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20211006174717) do
|
||||
ActiveRecord::Schema.define(version: 20211007204840) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
@ -207,6 +207,9 @@ ActiveRecord::Schema.define(version: 20211006174717) do
|
|||
create_table "sqm_categories", id: :serial, force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
t.string "slug"
|
||||
t.integer "sort_index"
|
||||
t.index ["slug"], name: "index_sqm_categories_on_slug", unique: true
|
||||
end
|
||||
|
||||
create_table "students", id: :serial, force: :cascade do |t|
|
||||
|
|
|
|||
15
db/seeds.rb
15
db/seeds.rb
|
|
@ -37,9 +37,18 @@ CSV.parse(measure_key_2021, headers: true).each do |row|
|
|||
|
||||
category = SqmCategory.find_or_create_by(name: category_name)
|
||||
|
||||
if category.description.nil?
|
||||
category.update(description: row['Category Description'])
|
||||
end
|
||||
category_slugs = {
|
||||
'Teachers & Leadership' => 'teachers-and-leadership',
|
||||
'School Culture' => 'school-culture',
|
||||
'Resources' => 'resources',
|
||||
'Academic Learning' => 'academic-learning',
|
||||
'Citizenship & Wellbeing' => 'citizenship-and-wellbeing',
|
||||
}
|
||||
|
||||
category.description = row['Category Description']
|
||||
category.slug = category_slugs[category_name]
|
||||
category.sort_index = category_slugs.keys.index(category_name)
|
||||
category.save
|
||||
|
||||
subcategory_name = row['Subcategory']
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,25 @@
|
|||
FactoryBot.define do
|
||||
|
||||
factory :district do
|
||||
name { "#{rand} District" }
|
||||
slug { name.parameterize }
|
||||
end
|
||||
|
||||
factory :school do
|
||||
name { "#{rand} School" }
|
||||
slug { name.parameterize }
|
||||
district
|
||||
end
|
||||
|
||||
factory :academic_year do
|
||||
range { '2050-51' }
|
||||
end
|
||||
|
||||
factory :sqm_category do
|
||||
name { "A category" }
|
||||
description { "A description of a category" }
|
||||
slug { 'a-category' }
|
||||
sort_index { 1 }
|
||||
end
|
||||
|
||||
factory :subcategory do
|
||||
|
|
@ -34,14 +52,6 @@ FactoryBot.define do
|
|||
measure
|
||||
end
|
||||
|
||||
factory :academic_year do
|
||||
range { '2050-51' }
|
||||
end
|
||||
|
||||
factory :school do
|
||||
name { "#{rand} School" }
|
||||
end
|
||||
|
||||
factory :survey_item_response do
|
||||
likert_score { 3 }
|
||||
response_id { rand.to_s }
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ feature 'School dashboard', type: feature do
|
|||
expect(page).to have_text('Teachers & Leadership')
|
||||
expect(page).to have_text('Approval')
|
||||
|
||||
click_on 'School Culture'
|
||||
|
||||
expect(page).to have_text('This category measures the degree to which the school environment is safe, caring, and academically-oriented.')
|
||||
end
|
||||
|
||||
scenario 'user sees schools in the same district' do
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ describe 'sqm_categories/show.html.erb' do
|
|||
school = create(:school, name: 'Best School')
|
||||
|
||||
category = create(:sqm_category, name: 'Some Category', description: 'Some description of the category')
|
||||
category_presenter = CategoryPresenter.new(category: category, academic_year: academic_year, school: school)
|
||||
|
||||
subcategory1 = create(:subcategory, sqm_category: category, name: 'A subcategory', description: 'Some description of the subcategory')
|
||||
subcategory2 = create(:subcategory_with_measures, sqm_category: category, name: 'Another subcategory', description: 'Another description of the subcategory')
|
||||
|
|
@ -18,7 +19,12 @@ describe 'sqm_categories/show.html.erb' do
|
|||
survey_item2 = create(:survey_item, measure: measure2)
|
||||
create(:survey_item_response, survey_item: survey_item2, academic_year: academic_year, school: school, likert_score: 5)
|
||||
|
||||
assign :category, CategoryPresenter.new(category: category, academic_year: academic_year, school: school)
|
||||
assign :category, category_presenter
|
||||
|
||||
assign :categories, [category_presenter]
|
||||
assign :school, school
|
||||
assign :district, create(:district)
|
||||
assign :academic_year, academic_year
|
||||
|
||||
render
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue