Module: Baldur::MarketingHelper

Includes:
RenderHelper
Included in:
UiHelper
Defined in:
app/helpers/baldur/marketing_helper.rb

Instance Method Summary collapse

Instance Method Details

#ui_marketing_action_string(*actions) ⇒ Object



92
93
94
# File 'app/helpers/baldur/marketing_helper.rb', line 92

def ui_marketing_action_string(*actions)
  actions.flatten.compact.map(&:to_s).map(&:strip).reject(&:blank?).uniq.join(" ")
end

#ui_marketing_configured_brandObject



109
110
111
112
113
114
115
116
117
118
119
# File 'app/helpers/baldur/marketing_helper.rb', line 109

def ui_marketing_configured_brand
  config = Baldur.config
  brand = if config.respond_to?(:marketing_brand)
    config.public_send(:marketing_brand)
  elsif config.instance_variable_defined?(:@marketing_brand)
    config.instance_variable_get(:@marketing_brand)
  end

  resolved_brand = brand.respond_to?(:to_h) ? brand.to_h.symbolize_keys : {}
  resolved_brand
end

#ui_marketing_cta_banner(banner:, classes: nil) ⇒ Object



59
60
61
# File 'app/helpers/baldur/marketing_helper.rb', line 59

def ui_marketing_cta_banner(banner:, classes: nil)
  baldur_render "baldur/marketing/cta_banner", banner: banner, classes: classes
end

#ui_marketing_faq_section(title:, items:, id: "faq", description: nil, classes: nil, container_class: nil) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'app/helpers/baldur/marketing_helper.rb', line 49

def ui_marketing_faq_section(title:, items:, id: "faq", description: nil, classes: nil, container_class: nil)
  baldur_render "baldur/marketing/faq_section",
         title: title,
         description: description,
         items: Array(items),
         id: id,
         classes: classes,
         container_class: container_class
end

#ui_marketing_features_section(title:, tabs:, id: "use-cases", description: nil, cta: nil, question_label: "Answers to questions like:", classes: nil) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'app/helpers/baldur/marketing_helper.rb', line 29

def ui_marketing_features_section(title:, tabs:, id: "use-cases", description: nil, cta: nil, question_label: "Answers to questions like:", classes: nil)
  baldur_render "baldur/marketing/features_section",
         title: title,
         description: description,
         tabs: Array(tabs),
         cta: cta,
         question_label: question_label,
         id: id,
         classes: classes
end


75
76
77
78
79
80
81
82
# File 'app/helpers/baldur/marketing_helper.rb', line 75

def ui_marketing_footer(columns:, description:, copyright: nil, classes: nil, brand: {})
  baldur_render "baldur/marketing/footer",
         columns: Array(columns),
         description: description,
         copyright: copyright,
         classes: classes,
         brand: ui_marketing_resolve_brand(brand)
end

#ui_marketing_hero_section(variant:, headline:, body:, primary_action:, centerpiece_image:, id: "hero", secondary_action: nil, supporting_action: nil, callouts: [], orbit_sources: [], classes: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/baldur/marketing_helper.rb', line 14

def ui_marketing_hero_section(variant:, headline:, body:, primary_action:, centerpiece_image:, id: "hero", secondary_action: nil, supporting_action: nil, callouts: [], orbit_sources: [], classes: nil)
  baldur_render "baldur/marketing/hero_section",
         variant: variant,
         headline: headline,
         body: body,
         primary_action: primary_action,
         secondary_action: secondary_action,
         supporting_action: supporting_action,
         callouts: Array(callouts),
         orbit_sources: Array(orbit_sources),
         centerpiece_image: centerpiece_image,
         id: id,
         classes: classes
end

#ui_marketing_pricing_tables(headline:, subheadline:, billing_options:, plans:, shared_capabilities:, eyebrow: "Pricing", fair_use_link: nil, classes: nil) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
# File 'app/helpers/baldur/marketing_helper.rb', line 63

def ui_marketing_pricing_tables(headline:, subheadline:, billing_options:, plans:, shared_capabilities:, eyebrow: "Pricing", fair_use_link: nil, classes: nil)
  baldur_render "baldur/marketing/pricing_tables",
         headline: headline,
         subheadline: subheadline,
         billing_options: Array(billing_options),
         plans: Array(plans),
         shared_capabilities: shared_capabilities,
         eyebrow: eyebrow,
         fair_use_link: fair_use_link,
         classes: classes
end

#ui_marketing_render_content(content) ⇒ Object



84
85
86
87
88
89
90
# File 'app/helpers/baldur/marketing_helper.rb', line 84

def ui_marketing_render_content(content)
  if content.respond_to?(:call)
    capture(&content)
  else
    content
  end
end

#ui_marketing_resolve_brand(overrides = {}) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
# File 'app/helpers/baldur/marketing_helper.rb', line 96

def ui_marketing_resolve_brand(overrides = {})
  configured_brand = ui_marketing_configured_brand
  override_brand = overrides.to_h.symbolize_keys
  resolved_brand = configured_brand.merge(override_brand)
  resolved_name = resolved_brand[:name].presence || "Brand"

  resolved_brand[:name] = resolved_name
  resolved_brand[:wordmark] = resolved_brand[:wordmark].presence || resolved_name
  resolved_brand[:logo_src] = resolved_brand[:logo_src].presence || "/icon.png"
  resolved_brand[:logo_alt] = resolved_brand[:logo_alt].presence || "#{resolved_name} logo"
  resolved_brand
end

#ui_marketing_testimonials_section(variant:, title:, items:, id: "proof", classes: nil) ⇒ Object



40
41
42
43
44
45
46
47
# File 'app/helpers/baldur/marketing_helper.rb', line 40

def ui_marketing_testimonials_section(variant:, title:, items:, id: "proof", classes: nil)
  baldur_render "baldur/marketing/testimonials_section",
         variant: variant,
         title: title,
         items: Array(items),
         id: id,
         classes: classes
end

#ui_marketing_top_nav(links:, primary_action:, theme_toggle: nil, classes: nil, brand: {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'app/helpers/baldur/marketing_helper.rb', line 5

def ui_marketing_top_nav(links:, primary_action:, theme_toggle: nil, classes: nil, brand: {})
  baldur_render "baldur/marketing/top_nav",
         links: Array(links),
         primary_action: primary_action,
         theme_toggle: theme_toggle,
         classes: classes,
         brand: ui_marketing_resolve_brand(brand)
end