This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
binaryattraction/app/helpers/votes_helper.rb

14 lines
423 B
Ruby

module Merb
module VotesHelper
def stat_chart
curl = Gchart.pie(
:size => '300x200',
:title => "Voting results for #{@user.votes.size} photos",
:legend => [ 'Not One', 'One' ],
:data => [ @user.votes.select { |v| v.zero? }.size, @user.votes.select { |v| v.one? }.size ],
:theme => :pastel
)
"<img src='#{curl}' alt='Chart Results' />"
end
end
end # Merb