Skip to content

Commit

Permalink
Add message partials
Browse files Browse the repository at this point in the history
  • Loading branch information
mhartl committed Aug 19, 2016
1 parent 37d98ab commit c4b8fb3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
8 changes: 8 additions & 0 deletions app/views/messages/_message.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="message">
<div class="message-user">
<%= message.user.username %>:
</div>
<div class="message-content">
<%= message.content %>
</div>
</div>
6 changes: 6 additions & 0 deletions app/views/messages/_message_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="message-input">
<%= form_for(@message) do |f| %>
<%= f.text_area :content %>
<%= f.submit "Send" %>
<% end %>
</div>
7 changes: 7 additions & 0 deletions app/views/messages/_messages.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="messages">
<div class="messages-table">
<% if @messages.any? %>
<%= render @messages %>
<% end %>
</div>
</div>
25 changes: 2 additions & 23 deletions app/views/messages/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
<div class="message-wr">
<div class="messages">
<div class="messages-table">
<% if @messages && @messages.any? %>
<% @messages.each do |message| %>
<div class="message">
<div class="message-user">
<%= message.user.username %>:
</div>
<div class="message-content">
<%= message.content %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>

<div class="message-input">
<%= form_for(@message) do |f| %>
<%= f.text_area :content %>
<%= f.submit "Send" %>
<% end %>
</div>
<%= render 'messages' %>
<%= render 'message_form' %>
</div>

0 comments on commit c4b8fb3

Please sign in to comment.