From dfc49d109af7634a92712cf1bca11cf291aae0f4 Mon Sep 17 00:00:00 2001 From: Liam Morley Date: Tue, 26 Oct 2021 17:31:10 -0400 Subject: [PATCH] Display harvey balls with white backgrounds and display no-zone harvey balls --- app/assets/stylesheets/dashboard.scss | 34 +++++++++++++++++-- app/presenters/subcategory_card_presenter.rb | 8 ++--- .../dashboard/_subcategory_card.html.erb | 4 +-- app/views/dashboard/index.html.erb | 27 +++++++-------- .../subcategory_card_presenter_spec.rb | 26 ++------------ 5 files changed, 50 insertions(+), 49 deletions(-) diff --git a/app/assets/stylesheets/dashboard.scss b/app/assets/stylesheets/dashboard.scss index c052d888..f5813ed0 100644 --- a/app/assets/stylesheets/dashboard.scss +++ b/app/assets/stylesheets/dashboard.scss @@ -13,7 +13,7 @@ font-family: 'Cabin', sans-serif; } -.harvey-ball__legend { +.harvey-ball-legend { display: flex; justify-content: space-around; align-items: center; @@ -23,12 +23,11 @@ } .subcategory-card { - border: 1px solid #CECECE; + border: 1px solid $gray-2; background-color: $gray-3; min-width: 95%; margin: auto; padding: 8px; - border: 1px solid #CECECE; font-size: 14px; } @@ -70,3 +69,32 @@ .zone-header { @extend .sub-header-4; } + +.harvey-ball { + stroke: $black; +} + +.harvey-ball__ideal { + fill: $purple; +} + +.harvey-ball__approval { + fill: $purple; +} + +.harvey-ball__growth { + fill: $gold; +} + +.harvey-ball__watch { + fill: $gold; +} + +.harvey-ball__warning { + fill: $white; +} + +.harvey-ball__no_zone { + stroke: $gray-2; + fill: $gray-3; +} diff --git a/app/presenters/subcategory_card_presenter.rb b/app/presenters/subcategory_card_presenter.rb index 8f54af8b..9082e5cd 100644 --- a/app/presenters/subcategory_card_presenter.rb +++ b/app/presenters/subcategory_card_presenter.rb @@ -5,18 +5,14 @@ class SubcategoryCardPresenter @score = score end - def display_icon? - zone.type != :no_zone - end - def harvey_ball_icon icons_by_zone_type = { ideal: "full-circle", approval: "three-quarter-circle", growth: "half-circle", watch: "one-quarter-circle", - warning: "empty-circle", - no_zone: "empty-circle" + warning: "full-circle", + no_zone: "full-circle" } icons_by_zone_type[zone.type] end diff --git a/app/views/dashboard/_subcategory_card.html.erb b/app/views/dashboard/_subcategory_card.html.erb index e11bd6c7..f5f39cf9 100644 --- a/app/views/dashboard/_subcategory_card.html.erb +++ b/app/views/dashboard/_subcategory_card.html.erb @@ -1,8 +1,6 @@
- <% if presenter.display_icon? %> - - <% end %> +
<%= subcategory.name %>
diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index 37478c81..511b4433 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -3,11 +3,8 @@ <% end %> - - - - + - + + - + + - + - + @@ -49,22 +48,22 @@

School Quality Framework Indicators

-
+
Warning
- + - + - + - + - +
Ideal
diff --git a/spec/presenters/subcategory_card_presenter_spec.rb b/spec/presenters/subcategory_card_presenter_spec.rb index 2d6b529f..f7dcb93d 100644 --- a/spec/presenters/subcategory_card_presenter_spec.rb +++ b/spec/presenters/subcategory_card_presenter_spec.rb @@ -15,12 +15,8 @@ describe SubcategoryCardPresenter do context 'when the given score is in the Warning zone for the given scale' do let(:score) { 1 } - it 'returns a boolean indicating that the icon should be displayed' do - expect(subcategory_card_presenter.display_icon?).to be_truthy - end - it 'returns the icon that represents the zone' do - expect(subcategory_card_presenter.harvey_ball_icon).to eq "empty-circle" + expect(subcategory_card_presenter.harvey_ball_icon).to eq "full-circle" end it 'returns the color class of the zone' do @@ -31,10 +27,6 @@ describe SubcategoryCardPresenter do context 'when the given score is in the Watch zone for the given scale' do let(:score) { 2 } - it 'returns a boolean indicating that the icon should be displayed' do - expect(subcategory_card_presenter.display_icon?).to be_truthy - end - it 'returns the icon that represents the zone' do expect(subcategory_card_presenter.harvey_ball_icon).to eq "one-quarter-circle" end @@ -47,10 +39,6 @@ describe SubcategoryCardPresenter do context 'when the given score is in the Growth zone for the given scale' do let(:score) { 3 } - it 'returns a boolean indicating that the icon should be displayed' do - expect(subcategory_card_presenter.display_icon?).to be_truthy - end - it 'returns the icon that represents the zone' do expect(subcategory_card_presenter.harvey_ball_icon).to eq "half-circle" end @@ -63,10 +51,6 @@ describe SubcategoryCardPresenter do context 'when the given score is in the Approval zone for the given scale' do let(:score) { 4 } - it 'returns a boolean indicating that the icon should be displayed' do - expect(subcategory_card_presenter.display_icon?).to be_truthy - end - it 'returns the icon that represents the zone' do expect(subcategory_card_presenter.harvey_ball_icon).to eq "three-quarter-circle" end @@ -79,10 +63,6 @@ describe SubcategoryCardPresenter do context 'when the given score is in the Ideal zone for the given scale' do let(:score) { 5 } - it 'returns a boolean indicating that the icon should be displayed' do - expect(subcategory_card_presenter.display_icon?).to be_truthy - end - it 'returns the icon that represents the zone' do expect(subcategory_card_presenter.harvey_ball_icon).to eq "full-circle" end @@ -95,8 +75,8 @@ describe SubcategoryCardPresenter do context 'when the given score is invalid for the given scale' do let(:score) { 0 } - it 'returns a boolean indicating that the icon should be displayed' do - expect(subcategory_card_presenter.display_icon?).to be_falsey + it 'returns the icon that represents the zone' do + expect(subcategory_card_presenter.harvey_ball_icon).to eq "full-circle" end end end