Color momey
This commit is contained in:
parent
1dc14ac245
commit
cfce9d80ab
2 changed files with 6 additions and 2 deletions
6
app.rb
6
app.rb
|
@ -66,6 +66,10 @@ def players
|
|||
}
|
||||
end
|
||||
|
||||
def money_style(value)
|
||||
value.to_f < 0 ? 'color:#a94442' : 'color:#3c763d'
|
||||
end
|
||||
|
||||
def readable_number(value)
|
||||
if value.to_f < 0
|
||||
negative = true
|
||||
|
@ -83,7 +87,7 @@ def readable_number(value)
|
|||
end
|
||||
|
||||
value = 0.0 unless value
|
||||
return sprintf('%.2f', value) + "_"
|
||||
return sprintf('%.2f', value) + " "
|
||||
end
|
||||
|
||||
def numbers
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<td style="<%= player_style(raid.attacker) %>"><%= raid.attacker %></td>
|
||||
<td style="<%= player_style(raid.defender) %>"><%= raid.defender %></td>
|
||||
<td class="text-right"><%= readable_number(raid.soldiers) %></td>
|
||||
<td class="text-right"><%= readable_number(raid.money) %></td>
|
||||
<td class="text-right" style="<%=money_style(raid.money)%>"><%= readable_number(raid.money) %></td>
|
||||
<td class="text-right"><%= raid.created_at.strftime('%H:%M on %m-%d-%Y') %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in a new issue