diff --git a/app/assets/stylesheets/_base.css.scss b/app/assets/stylesheets/_base.css.scss index 1248c1a6b..f6cbd53e3 100644 --- a/app/assets/stylesheets/_base.css.scss +++ b/app/assets/stylesheets/_base.css.scss @@ -1233,6 +1233,10 @@ body { } .services-box { + .status { + font-size: $font_size_95; + color: $alert-error-base; + } .website { margin-right: 10px; } @@ -1240,7 +1244,7 @@ body { .email { @include inline-block(); } - .title { + .title-box { margin-top: 10px; margin-bottom: 10px; padding-bottom: 0; diff --git a/app/views/component/detail/_service_name.html.haml b/app/views/component/detail/_service_name.html.haml index efe3d8663..0bdc944a0 100644 --- a/app/views/component/detail/_service_name.html.haml +++ b/app/views/component/detail/_service_name.html.haml @@ -1,4 +1,4 @@ -%section.title +%section.name-box %span.name = service.name - if service.alternate_name.present? diff --git a/app/views/component/detail/_service_status.html.haml b/app/views/component/detail/_service_status.html.haml new file mode 100644 index 000000000..e2d6dddf8 --- /dev/null +++ b/app/views/component/detail/_service_status.html.haml @@ -0,0 +1,8 @@ +- if service.status == 'defunct' || service.status == 'inactive' + %section.status + %i.fa.fa-warning + %span + - if service.status == 'defunct' + = t('service_fields.status_defunct') + - elsif service.status == 'inactive' + = t('service_fields.status_inactive') diff --git a/app/views/component/locations/detail/_body.html.haml b/app/views/component/locations/detail/_body.html.haml index 3178ddd15..cf577c047 100644 --- a/app/views/component/locations/detail/_body.html.haml +++ b/app/views/component/locations/detail/_body.html.haml @@ -154,7 +154,9 @@ - @location.services.each do |service| %section.service{ itemscope: '', itemtype: 'http://schema.org/Service' } - = render 'component/detail/service_name', service: service + %section.title-box + = render 'component/detail/service_status', service: service + = render 'component/detail/service_name', service: service %section.web-addresses-box = render 'component/detail/service_website', service: service = render 'component/detail/service_email', service: service diff --git a/config/locales/en.yml b/config/locales/en.yml index 17d33112b..8694e6776 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -91,6 +91,8 @@ en: keywords: 'Keyword Tags' required_documents: 'Required Documents:' service_areas: 'Service Areas:' + status_defunct: 'This service is no longer operating!' + status_inactive: 'This service is not currently operating!' urls: 'Homepage:' wait: 'Service Wait Estimate:' diff --git a/spec/cassettes/location_service_details/when_service_element_status_is_present/includes_defunct_status_notice.yml b/spec/cassettes/location_service_details/when_service_element_status_is_present/includes_defunct_status_notice.yml new file mode 100644 index 000000000..7c4d479de --- /dev/null +++ b/spec/cassettes/location_service_details/when_service_element_status_is_present/includes_defunct_status_notice.yml @@ -0,0 +1,59 @@ +--- +http_interactions: +- request: + method: get + uri: http://ohana-api-test.herokuapp.com/api/locations/location-with-no-phone + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/vnd.ohanapi-v1+json + User-Agent: + - Ohanakapa Ruby Gem 1.1.2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Server: + - Cowboy + Connection: + - close + Date: + - Wed, 05 Nov 2014 21:15:11 GMT + Status: + - 200 OK + X-Frame-Options: + - SAMEORIGIN + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + Content-Type: + - application/json; charset=utf-8 + Cache-Control: + - max-age=0, public + Etag: + - '"80cbd3badbf8bc0457a68e400dc083f4"' + X-Request-Id: + - 8340d930-08b7-40d5-b339-a132b1efa1e9 + X-Runtime: + - '0.063871' + Via: + - 1.1 vegur + body: + encoding: UTF-8 + string: '{"id":20,"active":false,"accessibility":[],"admin_emails":[],"alternate_name":null,"coordinates":null,"description":"no + phone","emails":[],"languages":null,"latitude":null,"longitude":null,"name":"Location + with no phone","short_desc":"no phone","slug":"location-with-no-phone","transportation":null,"updated_at":"2014-10-29T10:08:12.311-07:00","urls":[],"url":"http://ohana-api-test.herokuapp.com/api/locations/location-with-no-phone","address":null,"contacts":[],"mail_address":{"id":20,"attention":null,"street_1":"123 + Main Street","street_2":null,"city":"Fairfax","state":"VA","postal_code":"22031"},"phones":[],"services":[{"id":20,"accepted_payments":[],"alternate_name":null,"audience":null,"description":"no + unrequired fields for this service","eligibility":null,"email":null,"fees":null,"funding_sources":[],"how_to_apply":"Walk + in.","keywords":[],"languages":[],"name":"Service with blank fields","required_documents":[],"service_areas":[],"status":"defunct","website":null,"wait":null,"updated_at":"2014-10-29T10:08:12.309-07:00","categories":[],"regular_schedules":[]}],"regular_schedules":[],"organization":{"id":6,"accreditations":[],"alternate_name":null,"date_incorporated":null,"description":"An + organization created for testing purposes.","email":null,"funding_sources":[],"licenses":[],"name":"Fake + Org","slug":"fake-org","website":null,"url":"http://ohana-api-test.herokuapp.com/api/organizations/fake-org","locations_url":"http://ohana-api-test.herokuapp.com/api/organizations/fake-org/locations"}}' + http_version: + recorded_at: Wed, 05 Nov 2014 21:15:11 GMT +recorded_with: VCR 2.9.2 diff --git a/spec/cassettes/location_service_details/when_service_element_status_is_present/includes_inactive_status_notice.yml b/spec/cassettes/location_service_details/when_service_element_status_is_present/includes_inactive_status_notice.yml new file mode 100644 index 000000000..f902cfb60 --- /dev/null +++ b/spec/cassettes/location_service_details/when_service_element_status_is_present/includes_inactive_status_notice.yml @@ -0,0 +1,62 @@ +--- +http_interactions: +- request: + method: get + uri: http://ohana-api-test.herokuapp.com/api/locations/admin-test-location + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/vnd.ohanapi-v1+json + User-Agent: + - Ohanakapa Ruby Gem 1.1.2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Server: + - Cowboy + Connection: + - close + Date: + - Tue, 11 Nov 2014 01:08:20 GMT + Status: + - 200 OK + X-Frame-Options: + - SAMEORIGIN + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + Content-Type: + - application/json; charset=utf-8 + Cache-Control: + - max-age=0, public + Etag: + - '"05c9fa13f8a7bb4e2207a508050155a7"' + X-Request-Id: + - 61fe163f-997b-428d-b6e1-0f30c4c2147e + X-Runtime: + - '0.207930' + Via: + - 1.1 vegur + body: + encoding: UTF-8 + string: '{"id":21,"active":false,"accessibility":["Elevator","Disabled Restroom"],"admin_emails":[],"alternate_name":null,"coordinates":[-122.2871612,37.5291938],"description":"This + is a description","email":null,"languages":null,"latitude":37.5291938,"longitude":-122.2871612,"name":"Admin + Test Location","short_desc":"This is a short description","slug":"admin-test-location","transportation":"SAMTRANS + stops within 1/2 mile.","website":null,"updated_at":"2014-10-29T10:08:12.384-07:00","url":"http://ohana-api-test.herokuapp.com/api/locations/admin-test-location","address":{"id":20,"street_1":"123 + El Camino Real","street_2":null,"city":"Belmont","state":"CA","postal_code":"94002"},"contacts":[{"department":"Office + of Innovation","email":null,"id":28,"name":"Moncef","title":null,"phones":[]}],"mail_address":null,"phones":[{"id":39,"department":"CalFresh","extension":"1223","number":"7035551212","number_type":"voice","vanity_number":"703555-ABCD"},{"id":40,"department":"CalFresh","extension":null,"number":"2025551212","number_type":"fax","vanity_number":null}],"services":[{"id":21,"accepted_payments":[],"alternate_name":null,"audience":null,"description":"just + a test service","eligibility":null,"email":null,"fees":null,"funding_sources":[],"how_to_apply":"By + phone during business hours.","keywords":[],"languages":[],"name":"Service + for Admin Test Location","required_documents":[],"service_areas":["San Mateo + County"],"status":"inactive","website":null,"wait":null,"updated_at":"2014-10-29T10:08:12.381-07:00","categories":[],"contacts":[],"phones":[],"regular_schedules":[],"holiday_schedules":[]}],"regular_schedules":[],"holiday_schedules":[],"organization":{"id":7,"alternate_name":null,"name":"Admin + Test Org","slug":"admin-test-org","url":"http://ohana-api-test.herokuapp.com/api/organizations/admin-test-org"}}' + http_version: + recorded_at: Tue, 11 Nov 2014 01:08:20 GMT +recorded_with: VCR 2.9.2 diff --git a/spec/features/details/location_service_details_spec.rb b/spec/features/details/location_service_details_spec.rb index 9ffdcfcdc..2eb06eeb8 100644 --- a/spec/features/details/location_service_details_spec.rb +++ b/spec/features/details/location_service_details_spec.rb @@ -73,4 +73,18 @@ expect(page).to have_content('Monday-Friday, 8-5; Saturday, 10-6;') end end + + context 'when service element status is present', :vcr do + it 'includes defunct status notice' do + visit('/locations/fake-org/location-with-no-phone') + element = '.services-box .status' + expect(find(element)).to have_content(I18n.t('service_fields.status_defunct')) + end + + it 'includes inactive status notice' do + visit('/locations/admin-test-org/admin-test-location') + element = '.services-box .status' + expect(find(element)).to have_content(I18n.t('service_fields.status_inactive')) + end + end end