From 6a0b9d88f703f0e6bee55694e85fbe9f1b88c34f Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Sat, 11 Feb 2012 17:02:04 -0500 Subject: [PATCH] Gutting all helpers --- app/helpers/application_helper.rb | 4 --- app/helpers/habits_helper.rb | 46 ------------------------------- 2 files changed, 50 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3e2eb974d5..de6be7945c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,2 @@ module ApplicationHelper - - def score - current_user.habits.sum('score').to_i - end end diff --git a/app/helpers/habits_helper.rb b/app/helpers/habits_helper.rb index fa919589d1..985812a19a 100644 --- a/app/helpers/habits_helper.rb +++ b/app/helpers/habits_helper.rb @@ -1,48 +1,2 @@ module HabitsHelper - - def habit_type(habit) - case habit.habit_type - when 1 then return "habit" - when 2 then return "daily" - when 3 then return "one-time" - end - end - - def score_color(habit) - s = habit.score - return 'done' if habit.done? - case - when s<-8 then return 'color-red' - when s>=-8 && s<-5 then return 'color-pink' - when s>=-5 && s<-1 then return 'color-orange' - when s>=-1 && s<1 then return 'color-yellow' - when s>=1 && s<5 then return 'color-green' - when s>=5 && s<10 then return 'color-light-blue' - when s>=10 then return 'color-blue' - end - end - - def vote_link(habit, direction=nil) - if direction=='up' - return unless habit.up - text,dir,style = "+","up","up" - elsif direction=='down' - return unless habit.down - text,dir,style = "-","down","down" - elsif habit.done - text,dir,style = "[X]","down","check" - else - text,dir,style = "[ ]","up","check" - end - return link_to(text, { :action => "vote", :id => habit.id, :vote => dir }, :class=>style+" vote-link", :remote=>true) - end - - def user_gold - current_user.money.to_i - end - - def user_silver - number_with_precision(current_user.money, :precision=>1).split('.')[1] - end - end