Skip to content

Commit

Permalink
Kredits colours. Fixes #23.
Browse files Browse the repository at this point in the history
  • Loading branch information
polarina committed Oct 15, 2011
1 parent 4e4a20f commit fd1ff98
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions app/helpers/application_helper.rb
Expand Up @@ -13,10 +13,12 @@ def link(controller, action, params = { }, &block)
end

def pretty_kredits(kredits)
if kredits < 0
"-" + number_to_human_size(kredits.abs)
if kredits == 0
number_to_human_size(kredits.abs)
elsif kredits < 0
"<span style=\"color: #8b0000;\">-" + number_to_human_size(kredits.abs) + "</span>"
else
number_to_human_size(kredits)
"<span style=\"color: #006400;\">+" + number_to_human_size(kredits) + "</span>"
end
end

Expand Down
4 changes: 3 additions & 1 deletion app/views/layouts/application.html.haml
Expand Up @@ -51,7 +51,9 @@
= link_to current_user.username, current_user
%li= link_to "Boðslyklar", invitations_path
%ul
%li Kredits: #{pretty_kredits current_user.kredits}
%li
Kredits:
!= pretty_kredits current_user.kredits
- if flash[:notice]
#notification= flash[:notice]
#content
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/index.html.haml
Expand Up @@ -12,7 +12,7 @@
%tr
%td.nowrap= user.created_at
%td= link_to user.username, user
%td.nowrap= pretty_kredits user.kredits
%td.nowrap!= pretty_kredits user.kredits
- if @users.empty?
%tr
%td.notice{:colspan => 2}
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/show.html.haml
Expand Up @@ -8,7 +8,7 @@
%dt Skráð
%dd= @user.created_at
%dt Kredits
%dd= pretty_kredits @user.kredits
%dd!= pretty_kredits @user.kredits
%dt Avatar
%dd= gravatar_image(@user, :class => :border)
- if @user.inviter
Expand Down

0 comments on commit fd1ff98

Please sign in to comment.