Sha256: 188a97f085baf9c668805837488aa7078cbe3ccafbfca2dae821faf6a84b5d37

Contents?: true

Size: 832 Bytes

Versions: 3

Compression:

Stored size: 832 Bytes

Contents

module CubismHelper
  include CableReady::StreamIdentifier

  def cubicle_for(resource, user, html_options: {}, appear_trigger: :connect, disappear_trigger: nil, trigger_root: nil, exclude_current_user: true, &block)
    key = "#{block.source_location.join(":")}:#{resource.to_gid}:#{user.to_gid}"
    digested_id = ActiveSupport::Digest.hexdigest(key)

    Cubism.store[digested_id] = Cubism::BlockStoreItem.new(context: self, block: block.dup)
    tag.cubicle_element(
      identifier: signed_stream_identifier(resource.to_gid.to_s),
      user: user.to_sgid.to_s,
      "appear-trigger": Array(appear_trigger).join(","),
      "disappear-trigger": disappear_trigger,
      "trigger-root": trigger_root,
      id: "cubicle-#{digested_id}",
      "exclude-current-user": exclude_current_user,
      **html_options
    )
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cubism-0.1.0.pre9 app/helpers/cubism_helper.rb
cubism-0.1.0.pre8 app/helpers/cubism_helper.rb
cubism-0.1.0.pre7 app/helpers/cubism_helper.rb