Set location title to link text on the schedule (#263)
* Added optional text attribute to location link * Set location title to link text on the schedule
This commit is contained in:
parent
3d02e09807
commit
5f2add7f64
@ -84,9 +84,13 @@ module GeocoderHelper
|
|||||||
return hash.length > 1 ? _("geography.formats.#{hash.keys.join('_')}", locale: locale, vars: hash) : hash.values.first
|
return hash.length > 1 ? _("geography.formats.#{hash.keys.join('_')}", locale: locale, vars: hash) : hash.values.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def location_link(location)
|
def location_link(location, text = nil)
|
||||||
return '' unless location.present?
|
return '' unless location.present?
|
||||||
address = if location.is_a?(Location)
|
address = if text is_a?(Symbol)
|
||||||
|
location.send(text)
|
||||||
|
elsif location.is_a?(String)
|
||||||
|
text
|
||||||
|
elsif location.is_a?(Location)
|
||||||
location.street
|
location.street
|
||||||
else
|
else
|
||||||
location.address
|
location.address
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
%tr
|
%tr
|
||||||
%th.corner
|
%th.corner
|
||||||
- data[:locations].each do |id, location|
|
- data[:locations].each do |id, location|
|
||||||
%th.location-header=location.is_a?(Symbol) ? '' : location_link(location)
|
%th.location-header=location.is_a?(Symbol) ? '' : location_link(location, :title)
|
||||||
%tbody
|
%tbody
|
||||||
- data[:times].each do |time, time_data|
|
- data[:times].each do |time, time_data|
|
||||||
%tr{class: "row-type-#{time_data[:type] || 'nil'}"}
|
%tr{class: "row-type-#{time_data[:type] || 'nil'}"}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user