From bd1b0acfacb8cc61495efba7ac0a85f2b5950e93 Mon Sep 17 00:00:00 2001 From: YarekTenko Date: Mon, 27 Mar 2017 10:22:01 -0700 Subject: [PATCH] Add Paginator for Bet views -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; --- app/views/bets/_bet.html.erb | 7 +++++++ app/views/bets/_display_bets.html.erb | 8 +++++++- app/views/bets/index.html.erb | 13 ++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 app/views/bets/_bet.html.erb diff --git a/app/views/bets/_bet.html.erb b/app/views/bets/_bet.html.erb new file mode 100644 index 0000000..87890d0 --- /dev/null +++ b/app/views/bets/_bet.html.erb @@ -0,0 +1,7 @@ + + <%= bet.creator_id %> + <%= bet.created_at %> + <%= bet.expires_at %> + <%= bet.bet_total %> + <%= bet.bet %> + diff --git a/app/views/bets/_display_bets.html.erb b/app/views/bets/_display_bets.html.erb index 37c7d69..a12cb53 100644 --- a/app/views/bets/_display_bets.html.erb +++ b/app/views/bets/_display_bets.html.erb @@ -5,10 +5,16 @@ Created By Created at + Expires at Total amount bet - Bet description + Bet description + + <% bets.each do |bet| %> + <%= render 'bet', bet: bet %> + <% end %> + diff --git a/app/views/bets/index.html.erb b/app/views/bets/index.html.erb index 7ade0da..13f2bd7 100644 --- a/app/views/bets/index.html.erb +++ b/app/views/bets/index.html.erb @@ -5,5 +5,16 @@

This page will display all the existing bets (25/page) and allow the user to use custom search criteria.

- <%= render 'bets/display_bets' %> +
+
+ <%= render 'display_bets', bets: @bets %> +
+
+ +
+
<% end %>