Module: Bh::Helpers::Flows

Included in:
Bh::Helpers
Defined in:
lib/bh/helpers/flows.rb

Overview

The page of a signup flow: a mark over whatever it stands on, a title, a line, one card, the way out.

Constant Summary collapse

WIDTH =

How wide the card is unless a page says otherwise: as wide as a thread, a table or a contract wants. A page asking one question says a narrower one.

'75rem'

Instance Method Summary collapse

Instance Method Details

#flow(header: nil, footer: [], **options) ⇒ Object

Draws the page around the card's content: header over what the view said in content_for — its :title, its :subtitle, how wide the card is in :width — and the pieces of footer under the card joined by a middot. No header draws no header, no subtitle no line and an empty footer no foot: a page says only what it has. Every other option is an attribute of the column, which is where a host names the controller that paints what the page stands on.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bh/helpers/flows.rb', line 16

def flow(header: nil, footer: [], **options, &)
  parts = [
    (tag.header header if header),
    *bh_flow_words,
    bh_flow_card(content_for(:width), &),
    bh_flow_footer(footer),
  ]
  classes = class_names 'flow', options[:class]

  tag.div safe_join(parts.compact), class: classes, **options.except(:class)
end