app/views/accounts/voting.html.haml
= render partial: 'nav'
.card.border-top-0{style: 'padding-top: 0'}
.card-block
.row
.col-md-12
%div.float-right
= form_tag accounts_path, method: :get do
= hidden_field_tag :voting, true
Accounts:
= text_field_tag :account_names, @account_names, size: 50
= submit_tag 'Query', class: 'btn btn-primary'
%table.table-sm.table-striped.table-bordered
%thead
%tr
%th Name
%th Upvotes
%th Downvotes
%th Unvotes
%th First Vote
%th Last Vote
%tbody
- @accounts.each do |name, votes|
- next if votes.empty?
%tr
%td= name
%td
= link_to accounts_path upvoted: true, account_names: name do
= votes.map{ |v| v if v[:vote].weight > 0 }.compact.size
%td
= link_to accounts_path downvoted: true, account_names: name do
= votes.map{ |v| v if v[:vote].weight < 0 }.compact.size
%td
= link_to accounts_path unvoted: true, account_names: name do
= votes.map{ |v| v if v[:vote].weight == 0 }.compact.size
%td
= time_ago_in_words votes.first[:timestamp]
ago
%td
= time_ago_in_words votes.last[:timestamp]
ago