Skip to content

Commit 45b142b

Browse files
committed
feat(models): specify translation types for name and update building connection labels
1 parent 1406180 commit 45b142b

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

app/models/better_together/community.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Community < ApplicationRecord
2424
joinable joinable_type: 'community',
2525
member_type: 'person'
2626

27-
translates :name
27+
translates :name, type: :string
2828
translates :description, type: :text
2929
translates :description_html, backend: :action_text
3030

app/models/concerns/better_together/infrastructure/building_connections.rb

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,22 @@ def leaflet_points # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
3535
point = building.to_leaflet_point
3636
next if point.nil?
3737

38+
place_label = (" - #{building.address.text_label}" if building.address.text_label.present?)
39+
40+
place_url = Rails.application.routes.url_helpers.polymorphic_path(
41+
self,
42+
locale: I18n.locale
43+
)
44+
45+
place_link = "<a href='#{place_url}' class='text-decoration-none'><strong>#{name}#{place_label}</strong></a>"
46+
47+
address_label = building.address.to_formatted_s(
48+
excluded: [:display_label]
49+
)
50+
3851
point.merge(
39-
label: "<a href='#{Rails.application.routes.url_helpers.polymorphic_path(
40-
self,
41-
locale: I18n.locale
42-
)}' class='text-decoration-none'><strong>#{name}#{if building.address.text_label.present?
43-
building.address.text_label
44-
end}</strong></a>",
45-
popup_html: "<a href='#{Rails.application.routes.url_helpers.polymorphic_path(
46-
self,
47-
locale: I18n.locale
48-
)}' class='text-decoration-none'><strong>#{name}#{if building.address.text_label.present?
49-
" - #{building.address.text_label}"
50-
end}</strong></a><br>#{
51-
building.address.to_formatted_s(
52-
excluded: [:display_label]
53-
)
54-
}"
52+
label: place_link,
53+
popup_html: place_link + "<br>#{address_label}"
5554
)
5655
end.compact
5756
end

0 commit comments

Comments
 (0)