ref: master
plugins/community_track/lib/community_track_plugin/track_helper.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
module CommunityTrackPlugin::TrackHelper include CategoriesHelper def category_class(track) 'category_' + (track.categories.empty? ? 'not_defined' : track.categories.first.name.to_slug) end def track_card_lead(track) lead_stripped = strip_tags(track.lead) excerpt lead_stripped, lead_stripped.first(3), radius: if track.image then 180 else 300 end end def track_color_style(track) category_color_style(track.categories.first.with_color) if !track.categories.empty? end def track_name_color_style(track) category = track.categories.empty? ? nil : track.categories.first.with_color category ? "color: ##{category.display_color};" : '' end end |