diff --git a/app/assets/stylesheets/donations.scss b/app/assets/stylesheets/donations.scss new file mode 100644 index 0000000..ef401ab --- /dev/null +++ b/app/assets/stylesheets/donations.scss @@ -0,0 +1,40 @@ +ul.donations { + list-style: none; + + li { + margin-bottom: 2rem; + display: grid; + grid-row-gap: 0.5rem; + grid-column-gap: 2rem; + grid-template-columns: 1fr 1fr; + grid-template-areas: + "date amount-btc" + "public-name amounts-fiat"; + + h3 { + grid-area: "date"; + margin-bottom: 0; + } + + p { + margin-bottom: 0; + + &.amount-btc { + grid-area: amount-btc; + text-align: right; + font-family: monospace; + font-size: 1.25rem; + } + &.amounts-fiat { + grid-area: amounts-fiat; + text-align: right; + font-family: monospace; + font-size: 0.85rem; + color: #888; + } + &.public-name { + grid-area: public-name; + } + } + } +} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..e2ff699 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,5 @@ module ApplicationHelper + def sats_to_btc(sats) + sats.to_f / 100000000 + end end diff --git a/app/views/donations/index.html.erb b/app/views/donations/index.html.erb index 67c2fe2..f2a3e8d 100644 --- a/app/views/donations/index.html.erb +++ b/app/views/donations/index.html.erb @@ -1,29 +1,38 @@ -

Donations

- -<% if @donations.any? %> - - - - - - - - - - - - <% @donations.each do |donation| %> - - - - - - - <% end %> - -
Amount BTC (sats)in EURin USDPublic name
<%= donation.amount_sats %><%= donation.amount_eur %><%= donation.amount_usd %><%= donation.public_name %>
-<% else %> +
+

Donations

- No donations to show. + Your financial contributions to the development and + upkeep of Kosmos software and services.

-<% end %> +
+ +
+ <% if @donations.any? %> + + <% else %> +

+ No donations to show. +

+ <% end %> +
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb new file mode 100644 index 0000000..92f8de4 --- /dev/null +++ b/spec/helpers/application_helper_spec.rb @@ -0,0 +1,9 @@ +require 'rails_helper' + +describe ApplicationHelper do + describe "sats_to_btc" do + it "converts satoshis to BTC" do + expect(helper.sats_to_btc(120000000)).to eq(1.2) + end + end +end