Sha256: 8374816ee54ff085e7a0ebde0c14d86532a5585ba511ccec2697235455c4161e

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

<p id="notice"><%= notice %></p>

<p>
  <b>Chat name:</b>
  <span id="chat_name"><%= @chat.name %></span>
</p>

<ul id="users">
  <h3>Present users</h3>
  <% present_users.each do |user| %>
    <%= user.username %>
  <% end %>
</ul>

<div id="messages">
  <h3>Messages</h3>
  <% @chat.messages.each do |msg| %>
    <div class="message">
      <%= simple_format msg.text %>
    </div>
    <hr/>
  <% end %>
</div>

<%= form_for [@chat, @chat.messages.build] do |f| %>
  <h3>New Message</h3>
  <%= f.text_area :text, :rows => 5 %>

  <p>
    <%= f.submit 'send' %>
  </p>
<% end %>

<%= link_to 'Back', chats_path %>

<%= javascript_include_tag 'alondra-client' %>

<script type="text/javascript">
  var client = new AlondraClient('localhost', <%= Alondra::Alondra.config.port %>, '<%= chat_path(@path) %>', '<%= encrypted_token %>');

  $(client).bind('subscribed.Chat', function(event, resource){
    console.log('Received subscribed event!');
    $('#messages').append('<div class="message">Subscribed to channel</div>');
  })

  $(client).bind('updated.Chat', function(event, resource){
    $('#chat_name').text(resource.name);
  })
</script>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alondra-0.0.3 test/dummy/app/views/chats/show.html.erb