Module: Bh::Helpers::Chats

Includes:
Asides, Asks
Included in:
Bh::Helpers
Defined in:
lib/bh/helpers/chats.rb,
lib/bh/helpers/chats/asks.rb,
lib/bh/helpers/chats/asides.rb

Overview

A conversation drawn as the bubbles every Bh chat wears.

Defined Under Namespace

Modules: Asides, Asks

Constant Summary

Constants included from Asides

Asides::DELIVERIES, Asides::SIDES

Constants included from Asks

Asks::SEND_CLASSES

Instance Method Summary collapse

Instance Method Details

#chat_with(messages:, url: nil, hints: [], note: nil) ⇒ Object

messages as a thread that opens at its newest and, where url is given, a field under it that posts the next message there, suggesting hints one at a time. A note stands over the whole thread: what this conversation is about, or the other way to reach whoever is on the far end of it.



14
15
16
17
18
19
20
21
# File 'lib/bh/helpers/chats.rb', line 14

def chat_with(messages:, url: nil, hints: [], note: nil)
  parts = [bh_chat_note(note), bh_chat_messages(messages)]
  parts.push bh_chat_ask(url, hints) if url

  said = safe_join parts.compact, "\n"

  tag.div said, class: 'chat-thread', data: { controller: 'thread' }
end