diff --git a/app/views/component/locations/detail/_body.html.haml b/app/views/component/locations/detail/_body.html.haml index 967f33065..c330637f1 100644 --- a/app/views/component/locations/detail/_body.html.haml +++ b/app/views/component/locations/detail/_body.html.haml @@ -1,57 +1,57 @@ -= render 'component/locations/detail/header' += render 'component/locations/detail/header', location: location %section#detail-info{ itemscope: '', itemtype: 'http://schema.org/Organization' } %header %section - %p{ class: "kind icon #{@location.kind.parameterize}" } - = link_to @location.kind, locations_path(kind: @location.kind), title: "All locations of type #{@location.kind}" + %p{ class: "kind icon #{location.kind.parameterize}" } + = link_to location.kind, locations_path(kind: location.kind), title: "All locations of type #{location.kind}" %hgroup %h1.name - = superscript_ordinals(full_name_content_for(@location)) + = superscript_ordinals(full_name_content_for(location)) - - if @location.organization.name && @location.organization.name != @location.name + - if location.organization.name && location.organization.name != location.name %h2.agency - = link_to(locations_path(org_name: @location.organization.name)) do + = link_to(locations_path(org_name: location.organization.name)) do %span - = superscript_ordinals(@location.organization.name) + = superscript_ordinals(location.organization.name) / detail sidebar content .location-sidebar-box %aside.location-sidebar - - if @location.hours.present? + - if location.hours.present? %section.schedules-box.location-sidebar-section %h1 Location Hours %section.location-sidebar-content - = render 'component/detail/location_hours', location: @location + = render 'component/detail/location_hours', location: location - - if @location.regular_schedules.present? + - if location.regular_schedules.present? %section.schedules-box.location-sidebar-section %h1 Regular Hours %section.location-sidebar-content - = render 'component/detail/location_regular_schedule', schedules: @location.regular_schedules + = render 'component/detail/location_regular_schedule', schedules: location.regular_schedules - - if @location.holiday_schedules.present? + - if location.holiday_schedules.present? %section.schedules-box.location-sidebar-section %h1 Holiday Hours %section.location-sidebar-content - = render 'component/detail/location_holiday_schedule', schedules: @location.holiday_schedules + = render 'component/detail/location_holiday_schedule', schedules: location.holiday_schedules - - if (@location.fields & location_contact_fields).any? + - if (location.fields & location_contact_fields).any? %section.contact-box-general.location-sidebar-section %h1 General Contact Info %section.location-sidebar-content - = render 'component/detail/website', website: @location.website - = render 'component/detail/email', email: @location.email + = render 'component/detail/website', website: location.website + = render 'component/detail/email', email: location.email - - if @location.phones.present? + - if location.phones.present? %section.phones.location-sidebar-content-group - - @location.phones.each do |phone| + - location.phones.each do |phone| = render 'component/detail/phone', phone: phone, show_phone_type_and_department: true - - if @location[:contacts].present? - - @location.contacts.each do |contact| + - if location[:contacts].present? + - location.contacts.each do |contact| %section.contact-box-specific.location-sidebar-section %h1 Specific Contact %section.location-sidebar-content @@ -69,23 +69,23 @@ - contact.phones.each do |phone| = render 'component/detail/phone', phone: phone, show_phone_type_and_department: true - - if @location.address.present? + - if location.address.present? %section.address-box.location-sidebar-section %h1 Physical Address %section.location-sidebar-content %section.address.icon-text-block %i.fa.fa-map-marker %span - = render 'component/detail/address', location: @location, lines: 2 + = render 'component/detail/address', location: location, lines: 2 - - if @location.mail_address.present? + - if location.mail_address.present? %section.address-box.location-sidebar-section %h1 Mailing Address %section.location-sidebar-content %section.mail-address.icon-text-block %i.fa.fa-envelope %span - = render 'component/detail/mail_address', location: @location + = render 'component/detail/mail_address', location: location - if @categories.present? %aside.location-sidebar @@ -103,53 +103,53 @@ %section %section.overview-box %section - = render 'component/detail/location_short_desc', location: @location - = render 'component/detail/location_description', location: @location + = render 'component/detail/location_short_desc', location: location + = render 'component/detail/location_description', location: location - - if @location[:coordinates].present? || @location[:transportation].present? + - if location[:coordinates].present? || location[:transportation].present? %section.map-box %h1 Location %div - - if @location[:transportation].present? + - if location[:transportation].present? %section.transportation-availability %h1 Public Transit: %span - = @location.transportation + = location.transportation - - if @location.coordinates.present? + - if location.coordinates.present? %section.map#detail-map-view #detail-map-canvas %span.hide#detail-map-canvas-title - = full_address_for(@location.address) + = full_address_for(location.address) %span.hide#detail-map-canvas-lat - = @location.latitude + = location.latitude %span.hide#detail-map-canvas-lng - = @location.longitude + = location.longitude %span.hide#detail-map-canvas-kind - = @location.kind + = location.kind %noscript -# Hides map when JavaScript is disabled. :sass #detail-map-view display: none - - if @location[:languages].present? || @location[:accessibility].present? + - if location[:languages].present? || location[:accessibility].present? %section.service-opt-box %h1 Service Options %section - = render 'component/detail/languages', location: @location - = render 'component/detail/accessibility', location: @location + = render 'component/detail/languages', location: location + = render 'component/detail/accessibility', location: location - - if @location.kind == "Farmers' Markets" + - if location.kind == "Farmers' Markets" %section.payment-box %h1 Payment & Products = render 'component/detail/farmers_markets' - - if @location.services.present? + - if location.services.present? %section.services-box %h1 Services - - @location.services.each do |service| + - location.services.each do |service| %section.service{ itemscope: '', itemtype: 'http://schema.org/Service' } %section.title-box @@ -190,10 +190,10 @@ = render 'component/detail/service_service_areas', service: service / Detail footer content. - - if @location.updated_at.present? + - if location.updated_at.present? %footer %section.metadata .button-edit - = link_to "#{SETTINGS[:admin_site]}/locations/#{@location.slug}", rel: 'nofollow' do + = link_to "#{SETTINGS[:admin_site]}/locations/#{location.slug}", rel: 'nofollow' do %i.fa.fa-pencil Edit diff --git a/app/views/component/locations/detail/_header.html.haml b/app/views/component/locations/detail/_header.html.haml index 93716e7c0..55ad4de1e 100644 --- a/app/views/component/locations/detail/_header.html.haml +++ b/app/views/component/locations/detail/_header.html.haml @@ -1,2 +1,31 @@ %header.results-header#floating-results-header - = render partial: 'component/locations/detail/header_summary', locals: { location: @location } + %div + .right-column + .floating-content.hide>< + %span + %a.button-utility.button-top{ href: '#' } + %i.fa.fa-chevron-up + Top + %span.utility-links + %span.button-print-container>< + %a.button-utility.button-print.hide{ href: '#' } + %i.fa.fa-print + Print + %span>< + %a.button-utility.button-share-email{ href: mailto_url } + %i.fa.fa-share + Email + - if location.coordinates.present? + %span>< + %a.button-utility.button-directions{ href: "https://maps.google.com/maps?saddr=current+location&daddr=#{full_address_for(location.address)}", target: '_blank' } + %i.fa.fa-external-link-square + %span Directions + %span + %a.button-utility.button-back{ href: "#{locations_url(request.query_parameters)}##{location.id}", target: '_self' } + %i.fa.fa-arrow-circle-left + Back + + .left-column + .floating-content.hide + %h1 + = superscript_ordinals(full_name_content_for(location)) diff --git a/app/views/component/locations/detail/_header_summary.html.haml b/app/views/component/locations/detail/_header_summary.html.haml deleted file mode 100644 index ce84093bd..000000000 --- a/app/views/component/locations/detail/_header_summary.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -%div - .right-column - .floating-content.hide>< - %span - %a.button-utility.button-top{ href: '#' } - %i.fa.fa-chevron-up - Top - %span.utility-links - %span.button-print-container>< - %a.button-utility.button-print.hide{ href: '#' } - %i.fa.fa-print - Print - %span>< - %a.button-utility.button-share-email{ href: mailto_url } - %i.fa.fa-share - Email - - if location.coordinates.present? - %span>< - %a.button-utility.button-directions{ href: "https://maps.google.com/maps?saddr=current+location&daddr=#{full_address_for(location.address)}", target: '_blank' } - %i.fa.fa-external-link-square - %span Directions - %span - %a.button-utility.button-back{ href: "#{locations_url(request.query_parameters)}##{location.id}", target: '_self' } - %i.fa.fa-arrow-circle-left - Back - - .left-column - .floating-content.hide - %h1 - = superscript_ordinals(full_name_content_for(@location)) diff --git a/app/views/component/locations/results/_body.html.haml b/app/views/component/locations/results/_body.html.haml index fcd7ecec5..ee465ed69 100644 --- a/app/views/component/locations/results/_body.html.haml +++ b/app/views/component/locations/results/_body.html.haml @@ -1,21 +1,21 @@ -= render 'component/locations/results/header' += render 'component/locations/results/header', search: search %section#results-entries - - unless @search.map_data.empty? - = render 'component/locations/results/map_view' + - unless search.map_data.empty? + = render 'component/locations/results/map_view', search: search - if info_box_key_corresponding_to_keyword.present? %section#terminology-box-container .terminology-box = render_info_box(info_box_key_corresponding_to_keyword) - - if @search.locations.present? + - if search.locations.present? - if params[:org_name].present? %section#organization-detail-container = render 'component/locations/results/organization_detail', - organization: @search.locations.first.organization + organization: search.locations.first.organization - = render 'component/locations/results/list_view' + = render 'component/locations/results/list_view', search: search - else %section.no-results .message diff --git a/app/views/component/locations/results/_header.html.haml b/app/views/component/locations/results/_header.html.haml index 6027ef626..0ffb4638b 100644 --- a/app/views/component/locations/results/_header.html.haml +++ b/app/views/component/locations/results/_header.html.haml @@ -1,2 +1,23 @@ %header.results-header#floating-results-header - = render 'component/locations/results/header_summary' + %div + .right-column + .floating-content.hide>< + %span + %a.button-utility.button-top{ href: '#' } + %i.fa.fa-chevron-up + Top + + = paginate search.results + + .left-column + %span.static-content>< + - unless search.map_data.empty? + %a.button-utility.button-map-zoom#map-size-control{ href: '#', disabled: 'disabled' } + %i.fa.fa-refresh.fa-spin + Loading map... + %p.search-summary + %span + = page_entries_info search.results, entry_name: 'result' + + %span.map-summary.static-content + = map_summary unless search.map_data.empty? diff --git a/app/views/component/locations/results/_header_summary.html.haml b/app/views/component/locations/results/_header_summary.html.haml deleted file mode 100644 index 088a5aa2a..000000000 --- a/app/views/component/locations/results/_header_summary.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -%div - .right-column - .floating-content.hide>< - %span - %a.button-utility.button-top{ href: '#' } - %i.fa.fa-chevron-up - Top - - = paginate @search.results - - .left-column - %span.static-content>< - - unless @search.map_data.empty? - %a.button-utility.button-map-zoom#map-size-control{ href: '#', disabled: 'disabled' } - %i.fa.fa-refresh.fa-spin - Loading map... - %p.search-summary - %span - = page_entries_info @search.results, entry_name: 'result' - - %span.map-summary.static-content - = map_summary unless @search.map_data.empty? diff --git a/app/views/component/locations/results/_list_view.html.haml b/app/views/component/locations/results/_list_view.html.haml index e38ddd910..4e33ad295 100644 --- a/app/views/component/locations/results/_list_view.html.haml +++ b/app/views/component/locations/results/_list_view.html.haml @@ -1,6 +1,6 @@ %section#list-view %ul - - @search.locations.each do |location| + - search.locations.each do |location| %li %a{ href: location_link_for(location), title: location.name, name: location.id } @@ -33,4 +33,4 @@ %p.short-desc = location.short_desc %footer - = paginate @search.results + = paginate search.results diff --git a/app/views/component/locations/results/_map_view.html.haml b/app/views/component/locations/results/_map_view.html.haml index 0e31d78da..a8c825aab 100644 --- a/app/views/component/locations/results/_map_view.html.haml +++ b/app/views/component/locations/results/_map_view.html.haml @@ -1,6 +1,7 @@ %section#map-view #map-canvas - = render 'component/search/map_data' + %script#map-locations-data{ type: 'application/json' } + = raw(search.map_data.to_json) %noscript -# Hide map when JavaScript is disabled. :sass diff --git a/app/views/component/search/_map_data.html.haml b/app/views/component/search/_map_data.html.haml deleted file mode 100644 index 8a80f1fdb..000000000 --- a/app/views/component/search/_map_data.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%script#map-locations-data{ type: 'application/json' } - = raw(@search.map_data.to_json) diff --git a/app/views/locations/index.html.haml b/app/views/locations/index.html.haml index 335dabec3..afc11d344 100644 --- a/app/views/locations/index.html.haml +++ b/app/views/locations/index.html.haml @@ -1,4 +1,4 @@ - title search_results_page_title = render 'component/search/aside' %section#results-container{ class: ('result-map-showing' unless @search.map_data.empty?) } - = render 'component/locations/results/body' + = render 'component/locations/results/body', search: @search diff --git a/app/views/locations/show.html.haml b/app/views/locations/show.html.haml index 62cc5134e..16476d908 100644 --- a/app/views/locations/show.html.haml +++ b/app/views/locations/show.html.haml @@ -2,4 +2,4 @@ - @location.name == @location.organization.name ? canonical("#{locations_url}/#{@location.slug}") : canonical("#{locations_url}/#{@location.organization.slug}/#{@location.slug}") = render 'component/search/aside' %section#results-container - = render 'component/locations/detail/body' + = render 'component/locations/detail/body', location: @location