Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
97 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<h1>Listing bets</h1> | ||
|
||
<%= render 'list' %> | ||
<%= render 'list' %> | ||
|
||
<br /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<tr> | ||
<td><%= link_to bet.title, bet_path(bet) %> </td> | ||
<td> | ||
<% if bet.open? %> | ||
<%=link_to "Close", close_bet_path(bet) %>, | ||
<% end %> | ||
<% if bet.editable? %> | ||
<%=link_to "Edit", edit_bet_path(bet) %>, | ||
<% end %> | ||
<%= link_to 'Destroy', bet, :confirm => 'Are you sure?', :method => :delete %> | ||
</td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<% expired_bets = current_user.expired_bets %> | ||
<% if (expired_bets.count > 0) %> | ||
<strong> You have <%= pluralize(expired_bets.count, 'bet') %> that needs to be closed !</strong> | ||
<table> | ||
<tr> | ||
<th>Title</th> | ||
<th>Actions</th> | ||
</tr> | ||
<% expired_bets.each do |bet| %> | ||
<%= render :partial => 'show_bet', :locals => {:bet => bet} %> | ||
<% end %> | ||
</table> | ||
<% end %> | ||
<% if (current_user.bets.count == 0) %> | ||
No bet created yet. <%= link_to "Create your first bet now !", new_bet_url %> | ||
<% else %> | ||
<% if (@creation_bets.count > 0) %> | ||
<h2>Bets not yet opened</h2> | ||
<table> | ||
<tr> | ||
<th>Title</th> | ||
<th>Actions</th> | ||
</tr> | ||
<% @creation_bets.each do |bet| %> | ||
<%= render :partial => 'show_bet', :locals => {:bet => bet} %> | ||
<% end %> | ||
</table> | ||
<% end %> | ||
<% if (@open_bets.count > 0) %> | ||
<h2>Open Bets</h2> | ||
<table> | ||
<tr> | ||
<th>Title</th> | ||
<th>Actions</th> | ||
</tr> | ||
<% @open_bets.each do |bet| %> | ||
<%= render :partial => 'show_bet', :locals => {:bet => bet} %> | ||
<% end %> | ||
</table> | ||
<% end %> | ||
<% if (@closed_bets.count > 0) %> | ||
<h2>Closed Bets</h2> | ||
<table> | ||
<tr> | ||
<th>Title</th> | ||
<th>Actions</th> | ||
</tr> | ||
<% @closed_bets.each do |bet| %> | ||
<%= render :partial => 'show_bet', :locals => {:bet => bet} %> | ||
<% end %> | ||
</table> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,26 @@ | ||
|
||
<h1>Your account</h1> | ||
|
||
|
||
<ul> | ||
<li><%= link_to 'Modify my info', edit_user_registration_path %></li> | ||
<li><%= link_to 'New Bet', new_bet_path %></li> | ||
|
||
<li><%= link_to 'Modify my info', edit_user_registration_path %></li> | ||
<li><%= link_to 'New Bet', new_bet_path %></li> | ||
|
||
</ul> | ||
|
||
<p> | ||
Your credit : <strong><%= pluralize(current_user.brouzouf, "brouzouf")%></strong> | ||
Your credit : <strong><%= pluralize(current_user.brouzouf, "brouzouf") %></strong> | ||
</p> | ||
|
||
<h2>My Bets</h2> | ||
|
||
<% if ( @expired_bets_count > 0 ) %> | ||
<strong> You have <%= pluralize(@expired_bets_count, 'bet') %> that needs to be closed !</strong> | ||
<% end %> | ||
<% if(current_user.bets.count == 0 ) %> | ||
No bet created yet. <%= link_to "Create your first bet now !", new_bet_url%> | ||
<% else %> | ||
<table> | ||
<tr><th>Title</th><th>Status</th><th>Actions</th></tr> | ||
<% current_user.bets.each do |bet| %> | ||
<tr> | ||
<td><%= bet.title %> </td> | ||
<td><%= bet.state %> | ||
<% if bet.expired? & !bet.closed? %>[EXPIRED]<% end %> | ||
</td> | ||
<td> | ||
<% if bet.open? %> | ||
<%=link_to "Close", close_bet_path(bet) %>, | ||
<% end %> | ||
<% if bet.editable? %> | ||
<%=link_to "Edit", edit_bet_path(bet) %>, | ||
<% end %> | ||
<%=link_to "Show", bet_path(bet) %>, <%= link_to 'Destroy', bet, :confirm => 'Are you sure?', :method => :delete %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
<% end %> | ||
<% render :partial => 'show_bets' %> | ||
|
||
<h2>My Bids</h2> | ||
<ul> | ||
<% current_user.bids.each do |bid| %> | ||
<li> <%=I18n.l bid.created_at, :format => :short%> - <b><%= bid.choice.description %></b> on <%= link_to bid.choice.bet.title, bid.choice.bet %> </li> | ||
<% end %> | ||
<li> <%= I18n.l bid.created_at, :format => :short %> - <b><%= bid.choice.description %></b> | ||
on <%= link_to bid.choice.bet.title, bid.choice.bet %> </li> | ||
<% end %> | ||
</ul> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters