Permalink
Browse files

Improve the alt attribute of Google maps.

  • Loading branch information...
1 parent fc95338 commit 537bc23536fb7f4997f24a157593bad96eccfc56 @vanderhoorn vanderhoorn committed Nov 2, 2012
@@ -1,16 +1,18 @@
module DevcmsGeoHelper
-
+
def default_fields_after_form(form)
- after_form_fields = super
- geo_data_block = render '/admin/geo_viewers/geo_data_fields', :form => form
+ after_form_fields = super
+ geo_data_block = render '/admin/geo_viewers/geo_data_fields', :form => form
raw [after_form_fields, geo_data_block].join
- end
+ end
# Given an array of addresses, will return an image an
- # image tag with a static google map plotting those points.
- def static_map_of_addresses(addresses, options = {})
+ # image tag with a static Google map plotting those points.
+ def static_map_of_addresses(addresses, options = {}, alt)
if !addresses.nil?
- image_tag(DevcmsGeo::StaticMap.for_addresses(addresses, options), :alt => "A map of #{pluralize addresses.size, "address"}")
+ alt = "A map of #{pluralize addresses.size, "address"}" if !alt
+
+ image_tag(DevcmsGeo::StaticMap.for_addresses(addresses, options), :alt => alt)
end
end
end
@@ -1,10 +1,10 @@
- geo_viewer = node.content
-- nodes = geo_viewer.filtered_nodes({},{ :limit => 26 }) # Fetch the different marks
+- nodes = geo_viewer.filtered_nodes({}, { :limit => 26 }) # Fetch the different marks
- # Center the map on the default address when no marks are available
- center = nodes.empty? ? geo_viewer.map_settings[:center] : nil
.description
= static_map_of_addresses(nodes, { :width => 230, :height => 160, :center => center })
-
+
= read_more_link(node.content)
@@ -8,7 +8,7 @@
= render 'filters'
.gmap{ :id => "geo_viewer_#{@geo_viewer.id}" }
- = static_map_of_addresses(@nodes, { :center => @center, :bounds => @bounds })
+ = static_map_of_addresses(@nodes, { :center => @center, :bounds => @bounds }, @geo_viewer.title)
= @expl
@@ -5,18 +5,18 @@
.geoViewer.regularPage
%h1= @geo_viewer.title
-
+
.offscreen= link_to t('geo_viewers.goto_screen_reader'), screenreader_geo_viewer_path(@geo_viewer)
-
+
- unless @geo_viewer.has_own_content_representation?
- if @geo_viewer.description.present?
.htmlField= w @geo_viewer.description
-
+
= render 'filters'
-
+
.gmap{ :id => "geo_viewer_#{@geo_viewer.id}" }
- = static_map_of_addresses(@nodes, { :center => @center, :bounds => @bounds })
+ = static_map_of_addresses(@nodes, { :center => @center, :bounds => @bounds }, @geo_viewer.title)
%noscript= @expl

0 comments on commit 537bc23

Please sign in to comment.