diff --git a/app/assets/stylesheets/habits.css.scss b/app/assets/stylesheets/habits.css.scss index 3170d79043..4472b1983c 100644 --- a/app/assets/stylesheets/habits.css.scss +++ b/app/assets/stylesheets/habits.css.scss @@ -1,3 +1,9 @@ // Place all the styles related to the Habits controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ + +.bad { background-color:rgb(224, 102, 102); } +.iffy { background-color:rgb(246, 178, 107); } +.ok { background-color:rgb(255, 217, 102); } +.good { background-color:rgb(147, 196, 125); } +.done { background-color:rgb(201, 218, 248); } diff --git a/app/views/habits/_habit.html.erb b/app/views/habits/_habit.html.erb index 1afa68c2ee..f901db0e81 100644 --- a/app/views/habits/_habit.html.erb +++ b/app/views/habits/_habit.html.erb @@ -1,15 +1,29 @@
+ + <% + case habit.score + when -100..-5 then score = 'bad' + when -5..0 then score = 'iffy' + when 0..5 then score = 'ok' + when 5..15 then score = 'good' + when 15..100 then score = 'done' + end + name = "#{habit.name}" + %> + + + <% if habit.habit_type==Habit::ALWAYS %> <%= link_to "√", { :action => "vote", :id => habit.id, :vote => 'up' }, :remote=>true %> <%= link_to "X", { :action => "vote", :id => habit.id, :vote => 'down' }, :remote=>true %> - <%= habit.name %> (<%= habit.score %>) + <%= raw name %> (<%= habit.score %>) <% elsif habit.habit_type==Habit::DAILY %> <% if habit.done %> <%= link_to("[X]", { :action => "vote", :id => habit.id, :vote => 'down' }, :remote=>true) %> - <%= habit.name %> (<%= habit.score %>) + <%= raw name %> (<%= habit.score %>) <% else %> <%= link_to("[ ]", { :action => "vote", :id => habit.id, :vote => 'up' }, :remote=>true) %> - <%= habit.name %> (<%= habit.score %>) + <%= raw name %> (<%= habit.score %>) <% end %> <% end %> <%= link_to 'Edit', edit_habit_path(habit) %>