Created
November 30, 2010 18:14
-
-
Save timruffles/722105 to your computer and use it in GitHub Desktop.
This view is way too smart... It'd be great to remove it all to helpers and plugins, but most important is BonusOffer.signup.enabled? && ! current_user.identity_verified?, buiz logic that is in the view :(
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
<%= | |
if not logged_in? | |
# Log in | |
# A button for each stake | |
@real_game.stake_amounts.sum do |stake_amount| | |
render 'games/buttons/login_to_play_stake', :stake_amount => stake_amount | |
end | |
elsif current_user.has_enough_funds_to_bet? | |
# A button for each stake | |
@real_game.stake_amounts.sum do |stake_amount| | |
if current_user.account_balance >= stake_amount | |
render 'games/buttons/play_stake', :stake_amount => stake_amount | |
else | |
render 'games/buttons/deposit_to_play_stake', :stake_amount => stake_amount | |
end | |
end | |
elsif BonusOffer.signup.enabled? && ! current_user.identity_verified? | |
# ID check | |
render 'games/buttons/signup' | |
else | |
# Deposit | |
render 'games/buttons/deposit_to_play' | |
end | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 23 is the worst part - this is a textbook example of buiz logic being encoded in the view