diff --git a/app/assets/stylesheets/buttons.scss b/app/assets/stylesheets/buttons.scss index 8115108c..b3522df4 100644 --- a/app/assets/stylesheets/buttons.scss +++ b/app/assets/stylesheets/buttons.scss @@ -8,5 +8,4 @@ color: $white; padding: 8px 16px; border: 0px; - width: 70%; } diff --git a/app/assets/stylesheets/reset.scss b/app/assets/stylesheets/clear-margin-padding.scss similarity index 77% rename from app/assets/stylesheets/reset.scss rename to app/assets/stylesheets/clear-margin-padding.scss index fb6cfb1c..2d47f2a1 100644 --- a/app/assets/stylesheets/reset.scss +++ b/app/assets/stylesheets/clear-margin-padding.scss @@ -1,5 +1,3 @@ -// reset.css - html, body, div, @@ -82,23 +80,7 @@ mark, audio, video { border: 0; - font: inherit; - font-size: 100%; margin: 0; padding: 0; vertical-align: baseline; } - -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -menu, -nav, -section { - display: block; -} diff --git a/app/assets/stylesheets/dashboard.scss b/app/assets/stylesheets/dashboard.scss index dd7b8bed..eb20f70c 100644 --- a/app/assets/stylesheets/dashboard.scss +++ b/app/assets/stylesheets/dashboard.scss @@ -12,17 +12,16 @@ .category-card { flex-basis: 20%; align-items: center; - padding: 0 10px; + justify-content: space-between; + height: 600px; } .category-card__title { flex-basis: 20%; - text-align: center; } .category-card__description { flex-basis: 20%; - text-align: center; } .subcategory-card { @@ -30,6 +29,7 @@ border: 1px solid #CECECE; background-color: $gray-4; width: 90%; + margin: auto; padding: 8px; border: 1px solid #CECECE; font-size: 14px; @@ -38,19 +38,20 @@ .subcategory-card__benchmark-icon { fill: Red; } -.subcategory-card__name { - flex-basis: 20%; -} + .subcategory-card__benchmark-item { align-items: center; } + .subcategory-card__circle-container { - flex-basis: 30%; + flex: 0 0 50px; + padding: 0; } .subcategory-card__benchmark-label { font-size: 30px; } + .school-quality-frameworks { background-color: $white; } diff --git a/app/assets/stylesheets/sqm_application.scss b/app/assets/stylesheets/sqm_application.scss index ae0f1718..fafa4667 100644 --- a/app/assets/stylesheets/sqm_application.scss +++ b/app/assets/stylesheets/sqm_application.scss @@ -1,6 +1,7 @@ @import "bootstrap-overrides"; @import "bootstrap"; -@import "reset"; +@import "clear-margin-padding"; +@import "fonts"; @import "colors"; @import "fonts"; @import "borders"; diff --git a/app/presenters/subcategory_card_presenter.rb b/app/presenters/subcategory_card_presenter.rb index c5e199ec..4540dbd8 100644 --- a/app/presenters/subcategory_card_presenter.rb +++ b/app/presenters/subcategory_card_presenter.rb @@ -6,7 +6,7 @@ class SubcategoryCardPresenter end def abbreviation - abbreviations = { approval: "A", ideal: "I", growth: "G", watch: "Wa", warning: "Wr" , no_zone: "N"} + abbreviations = { approval: "A", ideal: "I", growth: "G", watch: "Wa", warning: "Wr", no_zone: "N" } abbreviations[zone.type] end @@ -20,21 +20,7 @@ class SubcategoryCardPresenter end def color - case zone.type - when :warning - return "fill-warning" - when :watch - return "fill-watch" - when :growth - return "fill-growth" - when :approval - return "fill-approval" - when :ideal - return "fill-ideal" - else - return "fill-warning" - end - + "fill-#{zone.type}" end private diff --git a/app/presenters/subcategory_presenter.rb b/app/presenters/subcategory_presenter.rb index b4523f8a..6becf87a 100644 --- a/app/presenters/subcategory_presenter.rb +++ b/app/presenters/subcategory_presenter.rb @@ -42,3 +42,4 @@ class SubcategoryPresenter @measures ||= @subcategory.measures end end + diff --git a/app/views/dashboard/_quality_framework_indicators.erb b/app/views/dashboard/_quality_framework_indicators.erb index 2dd90bee..ff68ac07 100644 --- a/app/views/dashboard/_quality_framework_indicators.erb +++ b/app/views/dashboard/_quality_framework_indicators.erb @@ -3,26 +3,26 @@
<% category_presenters.each do |category_presenter| %> -
-

<%= category_presenter.name %>

-

This category measures the relevant abilities of a school's teachers and the degree to which they are receiving the support they need to grow as professionals.

-
-
+
+

<%= category_presenter.name %>

+

<%= category_presenter.description %>

+
+
<% category_presenter.subcategories.each do |subcategory | %> <% presenter = subcategory.subcategory_card_presenter %>
-
- +
+ <%= presenter.abbreviation %>
-

<%= subcategory.name %>

+
<%= subcategory.name %>
<% end %>
- +
<% end %> diff --git a/spec/presenters/category_presenter_spec.rb b/spec/presenters/category_presenter_spec.rb index a23e2801..415f5b57 100644 --- a/spec/presenters/category_presenter_spec.rb +++ b/spec/presenters/category_presenter_spec.rb @@ -5,16 +5,13 @@ describe CategoryPresenter do subcategory1 = Subcategory.new(name: 'A subcategory') subcategory2 = Subcategory.new(name: 'Another subcategory') - category = SqmCategory.new(name: 'Some Category', description: 'Some category description', subcategories: [subcategory1, subcategory2]) + category = SqmCategory.new(name: 'Some Category', subcategories: [subcategory1, subcategory2], description: 'A description for some Category') return CategoryPresenter.new(category: category, academic_year: AcademicYear.new, school: School.new) end - it 'returns the name of the category' do + it 'returns the name and description of the category' do expect(category_presenter.name).to eq 'Some Category' - end - - it 'returns the description of the category' do - expect(category_presenter.description).to eq 'Some category description' + expect(category_presenter.description).to eq 'A description for some Category' end it 'maps subcategories to subcategory presenters' do diff --git a/spec/presenters/subcategory_card_presenter_spec.rb b/spec/presenters/subcategory_card_presenter_spec.rb new file mode 100644 index 00000000..4bf004ea --- /dev/null +++ b/spec/presenters/subcategory_card_presenter_spec.rb @@ -0,0 +1,69 @@ +require 'rails_helper' + +describe SubcategoryCardPresenter do + let(:scale) do + Scale.new( + watch_low_benchmark: 1.5, + growth_low_benchmark: 2.5, + approval_low_benchmark: 3.5, + ideal_low_benchmark: 4.5, + ) + end + + let(:subcategory_card_presenter) { SubcategoryCardPresenter.new(scale: scale, score: score)} + + context 'when the given score is in the Warning zone for the given scale' do + let(:score) { 1 } + it 'returns the abbreviation of the zone' do + expect(subcategory_card_presenter.abbreviation).to eq "Wr" + end + + it 'returns the color class of the zone' do + expect(subcategory_card_presenter.color).to eq "fill-warning" + end + end + + context 'when the given score is in the Watch zone for the given scale' do + let(:score) { 2 } + it 'returns the abbreviation of the zone' do + expect(subcategory_card_presenter.abbreviation).to eq "Wa" + end + + it 'returns the color class of the zone' do + expect(subcategory_card_presenter.color).to eq "fill-watch" + end + end + + context 'when the given score is in the Growth zone for the given scale' do + let(:score) { 3 } + it 'returns the abbreviation of the zone' do + expect(subcategory_card_presenter.abbreviation).to eq "G" + end + + it 'returns the color class of the zone' do + expect(subcategory_card_presenter.color).to eq "fill-growth" + end + end + + context 'when the given score is in the Approval zone for the given scale' do + let(:score) { 4 } + it 'returns the abbreviation of the zone' do + expect(subcategory_card_presenter.abbreviation).to eq "A" + end + + it 'returns the color class of the zone' do + expect(subcategory_card_presenter.color).to eq "fill-approval" + end + end + + context 'when the given score is in the Ideal zone for the given scale' do + let(:score) { 5 } + it 'returns the abbreviation of the zone' do + expect(subcategory_card_presenter.abbreviation).to eq "I" + end + + it 'returns the color class of the zone' do + expect(subcategory_card_presenter.color).to eq "fill-ideal" + end + end +end