Skip to content

Commit

Permalink
Modify index.html.erb for Bet
Browse files Browse the repository at this point in the history
-Added the paginator helper method to index.html.erb for Bet that
renders the pagination panel with given parameters;
-Added display_bets partial that renders all the bets in the bets
instance variable;
-Added bet partial for Bet model;
  • Loading branch information
LeonTenko committed Mar 27, 2017
1 parent 0a265b5 commit 7701211
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/views/bets/_bet.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<tr>
<td class="col-md-2"><%= bet.creator_id %></td>
<td class="col-md-2"><%= bet.created_at %></td>
<td class="col-md-2"><%= bet.expires_at %></td>
<td class="col-md-2"><%= bet.bet_total %></td>
<td class="col-md-4"><%= bet.bet %></td>
</tr>
8 changes: 7 additions & 1 deletion app/views/bets/_display_bets.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
<tr>
<th class="col-md-2">Created By</th>
<th class="col-md-2">Created at</th>
<th class="col-md-2">Expires at</th>
<th class="col-md-2">Total amount bet</th>
<th class="col-md-6">Bet description</th>
<th class="col-md-4">Bet description</th>
</tr>
</thead>
<tbody>
<% bets.each do |bet| %>
<%= render 'bet', bet: bet %>
<% end %>
</tbody>
</table>
</div>
</div>
13 changes: 12 additions & 1 deletion app/views/bets/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,16 @@
<h4>This page will display all the existing bets (25/page) and allow the user to use custom search criteria.</h4>
</div>
</div>
<%= render 'bets/display_bets' %>
<div class="d-flex flex-column">
<div class="p-2">
<%= render 'display_bets', bets: @bets %>
</div>
<div class="mt-auto p-2">
<div class="row footer">
<div class="col col-md-12">
<%= paginator %>
</div>
</div>
</div>
</div>
<% end %>

0 comments on commit 7701211

Please sign in to comment.