docbrown/app/helpers/broadcasts_helper.rb
Vaidehi Joshi 904f0dac78
Add ahoy + welcome notification tracking (#8758) [deploy]
* Set up ahoy gem, add ahoy-js

* Import ahoy.js into base.js.erb

* Add trackNotification function to notifications/index.html.erb

* Add sanitized_broadcast_id helper

* Use sanitized_broadcast_id in broadcast partial

* Add specs around tracking welcome notifications

* Remove optional fields from Ahoy::Visit migration + table

* Fiddle with trait to see if it helps with CI failures

* Disable geocode tracking in ahoy

* Stub out SiteConfig in notifications page spec
2020-06-18 13:40:14 -07:00

15 lines
364 B
Ruby

module BroadcastsHelper
def banner_class(broadcast)
return if broadcast.banner_style.blank?
if broadcast.banner_style == "default"
"crayons-banner"
else
"crayons-banner crayons-banner--#{broadcast.banner_style}"
end
end
def sanitized_broadcast_id(broadcast_title)
broadcast_title.downcase.delete(":").tr(" ", "_")
end
end