zold-io/zold

View on GitHub
views/wallet.haml

Summary

Maintainability
Test Coverage
%p
  = wallet.network
  %br
  = wallet.protocol.to_s
  %br
  %code= wallet.id.to_s
  %br
  = wallet.key.to_pub.gsub(/([^ ]{16})/, '\1­')

%table
  %thead
    %tr
      %th Id
      %th Date
      %th Amount
      %th Wallet
      %th Details
  %tbody
    - wallet.txns.each do |t|
      %tr
        - color = t.amount.negative? ? 'red' : 'green'
        %td{style: "color:#{color};"}= t.id
        %td= t.date.utc.iso8601
        %td{style:"text-align:right;color:#{color};"}= t.amount.to_zld(2)
        %td
          %a{href: "/wallet/#{t.bnf}.html"}
            %code= t.bnf
        %td= CGI.escapeHTML(t.details).gsub(/([^ ]{16})/, '\1­')

%p
  = '—'
  %br
  Balance:
  = wallet.balance.to_zld(8)
  ZLD
  = "(#{wallet.balance.to_i} zents)"
  %br
  Transactions:
  = wallet.txns.count
  %br
  Taxes:
  = Zold::Tax.new(wallet).paid
  paid, the debt is
  = Zold::Tax.new(wallet).debt
  %br
  File size:
  = "#{Zold::Size.new(wallet.size)}/#{wallet.size}"
  = Zold::Copies.new(File.join(settings.copies, wallet.id)).all.count
  copies
  %br
  Modified:
  = wallet.mtime.utc.iso8601
  = "(#{Zold::Age.new(wallet.mtime.utc.iso8601)} ago)"
  %br
  Digest:
  %code= wallet.digest