Sha256: 60c3fb9301568ba162846e84c592ce6099d1235d0ee22613801a2799f30492dc

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

module ForeignOffice
  module ForeignOfficeHelper
    def listener_attrs(resource, key, subtype: nil)
      data_attrs = "data-listener=true data-channel=#{resource.class.name}#{resource.id} data-key=#{key}"
      data_attrs += " data-sub-type=#{subtype}" if subtype
      data_attrs
    end

    def listener_attrs_raw(channel, key, subtype: nil)
      data_attrs = "data-listener=true data-channel=#{channel} data-key=#{key}"
      data_attrs += " data-sub-type=#{subtype}" if subtype
      data_attrs
    end
  end

  def listener_hash(resource, key, reveal_hide: false)
    hash = {listener: true, channel: resource.class.name + resource.id.to_s, key: key}
    hash[:reveal_hide] = true if reveal_hide
    hash
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreign_office-0.5.0 lib/foreign_office/foreign_office_helper.rb