mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
Add links to subcategories from overview page framework indicator
section. Finishes #181681266
This commit is contained in:
parent
5a9e8a9b01
commit
bf8b824ab8
5 changed files with 14 additions and 7 deletions
|
|
@ -1,8 +1,11 @@
|
|||
class SubcategoryCardPresenter
|
||||
attr_reader :name
|
||||
attr_reader :name, :subcategory, :category, :subcategory_id
|
||||
|
||||
def initialize(name:, zones:, score:)
|
||||
@name = name
|
||||
def initialize(subcategory:, zones:, score:)
|
||||
@name = subcategory.name
|
||||
@subcategory = subcategory
|
||||
@category = subcategory.category
|
||||
@subcategory_id = subcategory.subcategory_id
|
||||
@zones = zones
|
||||
@score = score
|
||||
end
|
||||
|
|
@ -19,6 +22,10 @@ class SubcategoryCardPresenter
|
|||
zone.type == :insufficient_data
|
||||
end
|
||||
|
||||
def to_model
|
||||
subcategory
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def zone
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class SubcategoryPresenter
|
|||
end
|
||||
|
||||
def subcategory_card_presenter
|
||||
SubcategoryCardPresenter.new(name: @subcategory.name, zones:, score: average_score)
|
||||
SubcategoryCardPresenter.new(subcategory: @subcategory, zones:, score: average_score)
|
||||
end
|
||||
|
||||
def average_score
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<section class="subcategory-section">
|
||||
<section id="<%= subcategory.id %>" class="subcategory-section">
|
||||
<div class="p-7">
|
||||
<p class="construct-id">Subcategory <%= subcategory.id %></p>
|
||||
<h2 class="sub-header-2 font-bitter mb-7"><%= subcategory.name %></h2>
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@
|
|||
<use class="harvey-ball harvey-ball--<%= subcategory_card.color %>" xlink:href="#<%= subcategory_card.harvey_ball_icon %>"></use>
|
||||
</svg>
|
||||
|
||||
<div class="subcategory-card__name"><%= subcategory_card.name %></div>
|
||||
<%= link_to(subcategory_card.name, district_school_category_path( @district, @school, subcategory_card.category, {year: @academic_year.range, anchor: "#{subcategory_card.subcategory_id}"})) %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ describe SubcategoryCardPresenter do
|
|||
)
|
||||
end
|
||||
|
||||
let(:subcategory_card_presenter) { SubcategoryCardPresenter.new(name: 'Card name', zones:, score:) }
|
||||
let(:subcategory_card_presenter) { SubcategoryCardPresenter.new(subcategory: Subcategory.new(name: 'A subcategory'), zones:, score:) }
|
||||
|
||||
context 'when the given score is in the Warning zone for the given scale' do
|
||||
let(:score) { 1 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue