Skip to content

Commit

Permalink
Fixes #476 - Adds missing location details
Browse files Browse the repository at this point in the history
- Adds keywords, service areas, and wait times fields to location
details template.
- Adds categories hierarchy styles.
- Adds service_areas template.
- Performs miscellaneous ruby style guide formatting.
- Adds location details specs (keywords, service areas, and wait times).
- Arranges location details spec checks in order they appear on details
page.
  • Loading branch information
anselmbradford committed Jul 26, 2014
1 parent 59d032c commit f68bbb5
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 43 deletions.
5 changes: 5 additions & 0 deletions app/assets/stylesheets/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,11 @@ body { top: 0px !important; }
padding: 35px;
padding-top: 0px;
padding-bottom: 20px;

// Indentation for service category hierarchy.
.hierarchy-depth-1{ margin-left: 10px; }
.hierarchy-depth-2{ margin-left: 20px; }
.hierarchy-depth-3{ margin-left: 30px; }
}

> section > section > section
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ def show

if @org[:services].present?
@categories = @org.services.map { |s| s[:categories] }.flatten.compact
@keywords = @org.services.map { |s| s[:keywords] }.flatten.compact.uniq
@service_areas = @org.services.map { |s| s[:service_areas] }.flatten.compact.uniq
end

# To disable or remove the Result list button on details page
Expand Down
4 changes: 2 additions & 2 deletions app/views/component/detail/_accessibility.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- if org[:accessibility].present?
%section{:class=>css_class_format('accessibility')}
%section{ class: css_class_format('accessibility') }
- if defined? iconclass
%i{:class=>iconclass}
%i{ class: iconclass }
%h1 Accessibility Options:
%ul
- org.accessibility.sort.each do |accessibility_option|
Expand Down
4 changes: 2 additions & 2 deletions app/views/component/detail/_languages.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- if org[:languages].present?
%section{:class=>css_class_format('languages')}
%section{ class: css_class_format('languages') }
- if defined? iconclass
%i{:class=>iconclass}
%i{ class: iconclass }
%h1 Languages Spoken:
%ul
- org.languages.sort.each do |lang|
Expand Down
8 changes: 4 additions & 4 deletions app/views/component/detail/_mail_address.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
= org.mail_address.attention
%br

%span.street-address{:itemprop=>"streetAddress"}
%span.street-address{ itemprop: 'streetAddress' }
= superscript_ordinals(org.mail_address.street)
%br

%span.city{:itemprop=>"addressLocality"}><
%span.city{ itemprop: 'addressLocality' }><
= org.mail_address.city
= ','

%span.state{:itemprop=>"addressRegion"}
%span.state{ itemprop: 'addressRegion' }
= org.mail_address.state

%span.zipcode{:itemprop=>"postalCode"}
%span.zipcode{ itemprop: 'postalCode' }
= org.mail_address.zip
8 changes: 8 additions & 0 deletions app/views/component/detail/_service_areas.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- if @service_areas.present?
%section{ class: 'service-areas' }
%h1 Service Areas:
%ul
- @service_areas.sort.each do |f|
%li
%span
= f
2 changes: 1 addition & 1 deletion app/views/component/detail/_template.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- if org[field].present?
%section{:class=>css_class_format(field.to_s)}
%section{ class: css_class_format(field.to_s) }
- if defined? iconclass
%i{ class: iconclass }
- if defined? stitle
Expand Down
2 changes: 1 addition & 1 deletion app/views/component/detail/_urls.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- if org[:urls].present?
%section{:class=>'urls'}
%section{ class: 'urls' }
- if defined? iconclass
%i{ class: iconclass }
- if defined? stitle
Expand Down
20 changes: 16 additions & 4 deletions app/views/component/organizations/detail/_body.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,24 @@
%section#categories-box
%h1 Service Categories
%section.services{ itemscope: '', itemtype: 'http://schema.org/Service' }
%ul{ itemscope: '', itemtype: 'http://schema.org/ServiceType' }
%ul{ itemscope: '', itemtype: 'http://schema.org/serviceType' }
- @categories.each do |category|
%li{ class: "depth#{category.depth}" }
%li{ class: "hierarchy-depth-#{category.depth}" }
%span{ itemprop: 'serviceType' }
-# Category links are disabled till there's a corresponding filter that can be toggled!
= link_to category.name, organizations_path(@search_params.merge(:category => category.name))
= link_to category.name, organizations_path(@search_params.merge(category: category.name))
= category.name

- if @keywords.present?
%section#keywords-box
%h1 Keyword Tags
%section.keywords
%ul
- @keywords.each do |keyword|
%li
%span
= link_to keyword, organizations_path(@search_params.merge(:keyword => keyword))

/ Main detail content.
%section

Expand Down Expand Up @@ -173,8 +183,10 @@
= render partial: 'component/detail/template', locals: { org: service, field: :audience, stitle: 'Audience' }
= render partial: 'component/detail/template', locals: { org: service, field: :eligibility, stitle: 'Eligibility' }
= render partial: 'component/detail/template', locals: { org: service, field: :how_to_apply, stitle: 'How to Apply' }
= render partial: 'component/detail/template', locals: { org: service, field: :wait, stitle: 'Service Wait Estimate' }
= render partial: 'component/detail/service_areas', locals: { org: service, field: :service_areas, stitle: 'Service Areas' }

/ detail footer content
/ Detail footer content.
- if @org[:updated_at].present?
%footer
%section.metadata
Expand Down
60 changes: 31 additions & 29 deletions spec/features/details/location_details_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,12 @@
expect(page).to have_content('Walk in or apply by phone or mail')
end

# Wait time not included in the view.
# Till we have a consistent meaning for wait time
# it's best left out of the front-end view
xit 'includes wait info' do
it 'includes wait estimate info' do
expect(page).to have_content('No wait to 2 weeks')
end

# Service areas not included in view.
# Best to leave this out of the view, this is data that could easily be
# wrong and it's better that the client contact the agency and ask for
# services and be referred accordingly vs. going off this list.
xit 'includes service areas' do
expect(page).to have_content('Marin County')
it 'includes service areas info' do
expect(page).to have_content('San Mateo County')
end

it 'includes updated time' do
Expand All @@ -121,8 +114,27 @@
end
end

it 'includes URLs' do
expect(page).to have_link('www.smchealth.org')
it 'includes short description' do
within '.short-desc' do
expect(page).
to have_content('[NOTE THIS IS NOT A REAL ENTRY--')
end
end

it 'includes description' do
expect(page).to have_content('Lorem ipsum')
end

it 'includes transporation info' do
expect(page).to have_content('SAMTRANS stops within 1 block')
end

it 'includes hours info' do
expect(page).to have_content('Monday-Friday, 8-5; Saturday, 10-6;')
end

it 'includes languages info' do
expect(page).to have_content('Chinese (Cantonese)')
end

it 'includes accessibility info' do
Expand All @@ -138,36 +150,26 @@
expect(page).to have_link('sanmaceo@co.sanmaceo.ca.us')
end

it 'includes hours info' do
expect(page).to have_content('Monday-Friday, 8-5; Saturday, 10-6;')
it 'includes URLs' do
expect(page).to have_link('www.smchealth.org')
end

it 'includes languages info' do
expect(page).to have_content('Chinese (Cantonese)')
it 'includes Physical Address info' do
expect(page).to have_content('Avenue of the fellows')
end

it 'includes Mailing Address info' do
expect(page).to have_content('Hella Fellas')
end

it 'includes description' do
expect(page).to have_content('Lorem ipsum')
end

it 'includes short description' do
within '.short-desc' do
expect(page).
to have_content('[NOTE THIS IS NOT A REAL ENTRY--')
end
end

it 'includes transporation info' do
expect(page).to have_content('SAMTRANS stops within 1 block')
it 'includes keywords' do
expect(page).to have_link('Ruby on Rails/MongoDB/Redis')
end

it 'sets the page title to the location name + site title' do
expect(page).to have_title('San Maceo Agency | Ohana Web Search')
end

end

describe 'Edit link' do
Expand Down

0 comments on commit f68bbb5

Please sign in to comment.