working on displaying data

pull/1/head
Jared Cosulich 9 years ago
parent 74ff33d74e
commit a8862d1734

@ -10,7 +10,8 @@
}
}
.indicator {
.indicator-container {
.indicator {
padding-top: 6px;
height: 90px;
@ -48,22 +49,24 @@
.average {
position: absolute;
width: 10%;
height: 125%;
height: 107%;
top: -3px;
border: 2px dashed black;
font-weight: bold;
font-size: 12px;
font-size: 14px;
span {
text-align: center;
position: absolute;
width: 7.75em;
margin-top: -1.5em;
}
}
}
}
}
.indicator {
&.short {
.indicator {
height: 30px;
.indicator-circle {
@ -71,34 +74,40 @@
height: 100%;
.average {
height: 120%;
span {
top: -13px;
left: -2.5em;
left: -1.5em;
font-size: 10px;
border: none;
line-height: 10px;
}
}
}
&.small {
height: 90px;
.indicator-circle {
width: 90px;
overflow: hidden;
.indicator-zones {
width: 900px;
}
.average {
border: none;
text-align: center;
width: 100%;
line-height: 90px;
}
}
}
}
// .indicator {
//
// &.small {
// height: 90px;
//
// .indicator-circle {
// width: 90px;
// overflow: hidden;
//
// .indicator-zones {
// width: 900px;
// }
//
// .average {
// border: none;
// text-align: center;
// width: 100%;
// line-height: 90px;
// }
// }
// }
//
// }

@ -11,6 +11,8 @@ class CategoriesController < ApplicationController
# GET /categories/1
# GET /categories/1.json
def show
@school_category = SchoolCategory.for(@school, @category).first
@child_school_categories = SchoolCategory.for_parent_category(@school, @category)
end
# GET /categories/new

@ -10,7 +10,7 @@ class SchoolsController < ApplicationController
# GET /schools/1
# GET /schools/1.json
def show
@school_categories = @school.school_categories.for_parent_category(nil).sort
@school_categories = @school.school_categories.for_parent_category(@school, nil).sort
end
# GET /schools/new

@ -9,12 +9,15 @@ class Category < ApplicationRecord
scope :for_parent, -> (category=nil) { where(parent_category_id: category.try(:id)) }
def root_identifier
def path
p = self
while p.parent_category.present?
p = p.parent_category
items = [p]
items << p while (p = p.try(:parent_category))
items.uniq.compact.reverse
end
p.name.downcase.gsub(/\s/, '-')
def root_identifier
path.first.name.downcase.gsub(/\s/, '-')
end
def root_index

@ -7,7 +7,7 @@ class SchoolCategory < ApplicationRecord
validates_associated :category
scope :for, -> (school, category) { where(school: school).where(category: category) }
scope :for_parent_category, -> (category=nil) { joins(:category).merge(Category.for_parent(category)) }
scope :for_parent_category, -> (school, category=nil) { where(school: school).joins(:category).merge(Category.for_parent(category)) }
def answer_index_average
answer_index_total.to_f / response_count.to_f

@ -0,0 +1,2 @@
%p
= school_category.category.path.map { |c| link_to(c.name, [school_category.school, c]) }.join(' > ').html_safe

@ -1,38 +1,30 @@
%p#notice= notice
%p
%strong Name:
= @category.name
%p
%strong Blurb:
= @category.blurb
%p
%strong Description:
= @category.description
%p
%strong External:
= @category.external_id
%p
%strong Parent Category:
&nbsp;
= render partial: 'categories/full_path', locals: {category: @category}
= render 'layouts/school_header'
- if @category.child_categories.present?
.row
.col-12
%p
%strong Child Categories:
- @category.child_categories.each do |child_category|
&nbsp;
= link_to child_category.name, child_category
= render 'categories/breadcrumbs', school_category: @school_category
.row
.col-12
.school_category.p-2
%h3.title.text-center.pt-3
= @category.name
%p
%strong Questions
%p= @category.description
%p
%b Total Responses:
= number_with_delimiter(@school_category.response_count)
- @category.questions.each do |question|
%p= link_to(question.text, question)
&nbsp; &nbsp; &nbsp;
%b Average Response:
= @school_category.answer_index_average.round(1)
(out of 5)
.indicator-container.py-3
= render 'school_categories/indicator', school_category: @school_category
= link_to 'Edit', edit_category_path(@category)
|
= link_to 'Back', categories_path
- if @child_school_categories.present?
.row
= render @child_school_categories

@ -0,0 +1,10 @@
.row
.col
=# link_to(image_tag(@district.logo), @district) if @district.present?
%h2= link_to @school.name, @school
= simple_format(@school.description)
%p Data for 2015-2016 school year.
- if @school.district.present?
%p
%strong District:
= link_to @school.district.name, @school.district

@ -1,12 +1,12 @@
.col-4.py-3
.school_category.p-2
.col-6.py-3
.school_category.short.p-2
%h4.title.text-center.pt-3
= link_to(school_category.category.name, [school_category.school, school_category.category])
.indicator-container
.indicator-container.short
= render 'school_categories/indicator', school_category: school_category
.description.px-2.pt-3.pb-2
.description.px-2.pt-3.pb-2.mt-2
- if false #(measurements = school_category.questions.measurements.for_school(school_measure.school)).present?
= render 'measurements/nonlikert', measurement: measurements.first, description: school_measure.measure.description
- else

@ -1,12 +1,4 @@
.row
.col
%p
%strong Name:
= @school.name
- if @school.district.present?
%p
%strong District:
= link_to @school.district.name, @school.district
= render 'layouts/school_header'
.row
= render @school_categories

Loading…
Cancel
Save