From 14e3d7584863b4f6c128cb4fff24fa7a775cd540 Mon Sep 17 00:00:00 2001 From: Jared Cosulich Date: Thu, 13 Apr 2017 20:44:12 -0400 Subject: [PATCH] fixing mobile styles --- app/assets/stylesheets/school_categories.scss | 8 ++++++++ app/controllers/attempts_controller.rb | 4 ++-- app/views/categories/show.html.haml | 4 ++-- app/views/questions/_question.html.haml | 8 ++++---- spec/controllers/attempts_controller_spec.rb | 4 ++-- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/school_categories.scss b/app/assets/stylesheets/school_categories.scss index 8aa29e5b..d67c4ff2 100644 --- a/app/assets/stylesheets/school_categories.scss +++ b/app/assets/stylesheets/school_categories.scss @@ -11,6 +11,14 @@ } .indicator-container { + &.centered { + margin-top: -3px; + + .indicator-circle { + margin: auto; + } + } + .indicator { padding-top: 6px; height: 90px; diff --git a/app/controllers/attempts_controller.rb b/app/controllers/attempts_controller.rb index e61c7a53..3f5b990e 100644 --- a/app/controllers/attempts_controller.rb +++ b/app/controllers/attempts_controller.rb @@ -23,9 +23,9 @@ class AttemptsController < ApplicationController response_count = Attempt.for_question(attempt.question).for_school(recipient.school).with_response.count if response_count > 1 - response_message << "#{response_count} people have responded to this question so far. To see all responses visit" + response_message << "#{response_count} people have responded to this question so far. To see all responses visit:" else - response_message << 'You are the first person to respond to this question. Once more people have responded you will be able to see all responses at' + response_message << 'You are the first person to respond to this question. Once more people have responded you will be able to see all responses at:' end response_message << school_category_url(attempt.recipient.school, attempt.question.category) diff --git a/app/views/categories/show.html.haml b/app/views/categories/show.html.haml index 3ee3da10..12cd8c15 100644 --- a/app/views/categories/show.html.haml +++ b/app/views/categories/show.html.haml @@ -13,12 +13,12 @@ %p= @category.description %p - %b Total Responses: + %b Total Responses: = number_with_delimiter(@school_category.response_count)       - %b Average Response: + %b Average Response: = @school_category.answer_index_average.round(1) (out of 5) diff --git a/app/views/questions/_question.html.haml b/app/views/questions/_question.html.haml index 54af6e43..323cb56d 100644 --- a/app/views/questions/_question.html.haml +++ b/app/views/questions/_question.html.haml @@ -1,16 +1,16 @@ - aggregated_responses = question.aggregated_responses_for_school(@school) - return if aggregated_responses.nil? -.col-12.col-sm-6.py-3 +.col-12.col-md-6.py-3 .question.p-2{id: "question-#{question.id}"} %p.question-text.pt-3.px-2 = question.text - .pb-3.px-2 - .indicator-container.float-left + .row.pt-2 + .col-4.indicator-container.centered = render 'school_categories/indicator', info: aggregated_responses, small: true - .pl-3.pt-1.float-left + .col-8 %p %b Total Responses: = aggregated_responses.count diff --git a/spec/controllers/attempts_controller_spec.rb b/spec/controllers/attempts_controller_spec.rb index d26db241..c7340ffe 100644 --- a/spec/controllers/attempts_controller_spec.rb +++ b/spec/controllers/attempts_controller_spec.rb @@ -66,7 +66,7 @@ RSpec.describe AttemptsController, type: :controller do end it "sends back a message" do - expect(response.body).to eq "We've registered your response of \"Option 0:1 C\". You are the first person to respond to this question. Once more people have responded you will be able to see all responses at http://test.host/schools/school/categories/category" + expect(response.body).to eq "We've registered your response of \"Option 0:1 C\". You are the first person to respond to this question. Once more people have responded you will be able to see all responses at: http://test.host/schools/school/categories/category" end context "with second response" do @@ -90,7 +90,7 @@ RSpec.describe AttemptsController, type: :controller do end it "sends back a message" do - expect(response.body).to eq "We've registered your response of \"Option 0:1 D\". 2 people have responded to this question so far. To see all responses visit http://test.host/schools/school/categories/category" + expect(response.body).to eq "We've registered your response of \"Option 0:1 D\". 2 people have responded to this question so far. To see all responses visit: http://test.host/schools/school/categories/category" end end end