User#completed_build_bikes method, and stats page list

This commit is contained in:
Jason Denney
2013-06-01 17:11:57 -04:00
parent 1defca3668
commit 2c548ff63c
2 changed files with 27 additions and 3 deletions
+14 -3
View File
@@ -2,15 +2,26 @@ class UserStats < Netzke::Base
def body_content(user)
bike = user.bike
%Q(
<div id="user_stats_page">
completed = user.completed_build_bikes
#I think it's time to switch to a template
body = ""
body += %Q(<div id="user_stats_page">)
body += %Q(
<p>Username: #{user.username}</p>
<p>Total Hours Worked: #{user.total_hours}</p>
<p>Hours worked in #{Time.now.strftime('%B')}: #{user.current_month_hours}</p>
<p>Current bike Shop ID: #{bike.shop_id if bike}</p>
<p>Current bike S/N: #{bike.serial_number if bike}</p>
</div>
)
unless completed.empty?
body += %Q(<p>Previously built bikes (#{completed.count}):</p>)
body += %Q(<ul>)
completed.each do |b|
body += %Q(<li>#{b.shop_id}</li>)
end
body += %Q(</ul>)
end
body += %Q(</div>)
end
js_configure do |c|