Module: Crm::TagsHelper
- Defined in:
- app/helpers/crm/tags_helper.rb
Instance Method Summary collapse
-
#taggable_display_name(record, type) ⇒ Object
Returns a display name for a taggable record.
-
#taggable_type_icon(type) ⇒ Object
Returns a Font Awesome icon class for a taggable type.
-
#taggable_url(record, type) ⇒ Object
Returns the URL path for viewing a taggable record in CRM.
Instance Method Details
#taggable_display_name(record, type) ⇒ Object
Returns a display name for a taggable record
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/helpers/crm/tags_helper.rb', line 30 def taggable_display_name(record, type) case type when 'Article' record.try(:subject) || record.try(:title) || "Article ##{record.id}" when 'Showcase' record.try(:name) || "Showcase ##{record.id}" when 'DigitalAsset' record.try(:title) || record.try(:name) || "Digital Asset ##{record.id}" when 'FloorPlanDisplay' record.try(:name) || "Floor Plan Display ##{record.id}" when 'Item' [record.try(:sku), record.try(:name) || record.try(:name_en)].compact.join(' - ') when 'ProductLine' record.try(:name) || record.try(:name_en) || "Product Line ##{record.id}" when 'ActivityType' [record.try(:task_type), record.try(:description)].compact.join(' - ') when 'LocatorRecord' record.try(:name) || "Locator Record ##{record.id}" else record.try(:name) || record.try(:title) || "#{type} ##{record.id}" end end |
#taggable_type_icon(type) ⇒ Object
Returns a Font Awesome icon class for a taggable type
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/crm/tags_helper.rb', line 6 def taggable_type_icon(type) case type when 'Article' 'fa-solid fa-newspaper' when 'Showcase' 'fa-solid fa-images' when 'DigitalAsset' 'fa-solid fa-photo-film' when 'FloorPlanDisplay' 'fa-solid fa-map' when 'Item' 'fa-solid fa-box' when 'ProductLine' 'fa-solid fa-boxes-stacked' when 'ActivityType' 'fa-solid fa-list-check' when 'LocatorRecord' 'fa-solid fa-location-dot' else 'fa-solid fa-file' end end |
#taggable_url(record, type) ⇒ Object
Returns the URL path for viewing a taggable record in CRM
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/helpers/crm/tags_helper.rb', line 54 def taggable_url(record, type) case type when 'Article' article_crm_path(record) when 'Showcase' showcase_path(record) rescue nil when 'DigitalAsset' digital_asset_crm_path(record) when 'FloorPlanDisplay' floor_plan_display_path(record) rescue nil when 'Item' item_path(record) rescue nil when 'ProductLine' product_line_path(record) rescue nil when 'ActivityType' activity_type_path(record) rescue nil when 'LocatorRecord' locator_record_path(record) rescue nil else nil end end |