From 5f74212603f1da3bfc42594bc79df88c04f8f4f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Sun, 26 Feb 2023 11:33:11 +0800 Subject: [PATCH] Improve admin donation pages --- app/views/admin/donations/_form.html.erb | 48 +++++----------- app/views/admin/donations/edit.html.erb | 7 +-- app/views/admin/donations/new.html.erb | 4 +- app/views/admin/donations/show.html.erb | 70 +++++++++++++----------- 4 files changed, 53 insertions(+), 76 deletions(-) diff --git a/app/views/admin/donations/_form.html.erb b/app/views/admin/donations/_form.html.erb index 1405b08..0522cb0 100644 --- a/app/views/admin/donations/_form.html.erb +++ b/app/views/admin/donations/_form.html.erb @@ -10,46 +10,24 @@ <% end %> -
-

- <%= form.label :user_id %> - <%= form.collection_select :user_id, User.where(ou: "kosmos.org").order(:cn), :id, :cn %> -

-
+
+ <%= form.label :user_id %> + <%= form.collection_select :user_id, User.where(ou: "kosmos.org").order(:cn), :id, :cn, {} %> -
-

- <%= form.label :amount_sats, "Amount BTC (sats)" %> - <%= form.number_field :amount_sats %> -

-
+ <%= form.label :amount_sats, "Amount BTC (sats)" %> + <%= form.number_field :amount_sats %> -
-

- <%= form.label :amount_eur, "Amount EUR (cents)" %> - <%= form.number_field :amount_eur %> -

-
+ <%= form.label :amount_eur, "Amount EUR (cents)" %> + <%= form.number_field :amount_eur %> -
-

- <%= form.label :amount_usd, "Amount USD (cents)"%> - <%= form.number_field :amount_usd %> -

-
+ <%= form.label :amount_usd, "Amount USD (cents)"%> + <%= form.number_field :amount_usd %> -
-

- <%= form.label :public_name %> - <%= form.text_field :public_name %> -

-
+ <%= form.label :public_name %> + <%= form.text_field :public_name %> -
-

- <%= form.label :paid_at %> - <%= form.text_field :paid_at %> -

+ <%= form.label :paid_at %> + <%= form.text_field :paid_at %>

diff --git a/app/views/admin/donations/edit.html.erb b/app/views/admin/donations/edit.html.erb index ba590b2..27340f1 100644 --- a/app/views/admin/donations/edit.html.erb +++ b/app/views/admin/donations/edit.html.erb @@ -1,12 +1,9 @@ -<%= render HeaderComponent.new(title: "Donations") %> +<%= render HeaderComponent.new(title: "Donation ##{@donation.id}") %> <%= render MainSimpleComponent.new do %> -

Editing Donation

- <%= render 'form', donation: @donation, url: admin_donation_path(@donation) %>

- <%= link_to 'Show', admin_donation_path(@donation), class: 'ks-text-link' %> | - <%= link_to 'Back', admin_donations_path, class: 'ks-text-link' %> + <%= link_to 'Cancel', admin_donation_path(@donation), class: 'btn-sm btn-gray' %>

<% end %> diff --git a/app/views/admin/donations/new.html.erb b/app/views/admin/donations/new.html.erb index d831813..176b659 100644 --- a/app/views/admin/donations/new.html.erb +++ b/app/views/admin/donations/new.html.erb @@ -1,8 +1,6 @@ -<%= render HeaderComponent.new(title: "Donations") %> +<%= render HeaderComponent.new(title: "Add Donation") %> <%= render MainSimpleComponent.new do %> -

New Donation

- <%= render 'form', donation: @donation, url: admin_donations_path %>

diff --git a/app/views/admin/donations/show.html.erb b/app/views/admin/donations/show.html.erb index 57b0531..1526789 100644 --- a/app/views/admin/donations/show.html.erb +++ b/app/views/admin/donations/show.html.erb @@ -1,37 +1,41 @@ -<%= render HeaderComponent.new(title: "Donations") %> +<%= render HeaderComponent.new(title: "Donation ##{@donation.id}") %> <%= render MainSimpleComponent.new do %> - - - - - - - - - - - - - - - - - - - - - - - - - - - -
User<%= link_to @donation.user.address, admin_user_path(@donation.user.address), class: 'ks-text-link' %>
Amount sats<%= @donation.amount_sats %>
Amount EUR<%= @donation.amount_eur %>
Amount USD<%= @donation.amount_usd %>
Public name<%= @donation.public_name %>
Date<%= @donation.paid_at.strftime("%Y-%m-%d (%H:%M UTC)") %>
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
User<%= link_to @donation.user.address, admin_user_path(@donation.user.address), class: 'ks-text-link' %>
Amount sats<%= @donation.amount_sats %>
Amount EUR<%= @donation.amount_eur %>
Amount USD<%= @donation.amount_usd %>
Public name<%= @donation.public_name %>
Date<%= @donation.paid_at.strftime("%Y-%m-%d (%H:%M UTC)") %>
+
-

- <%= link_to 'Edit', edit_admin_donation_path(@donation), class: 'ks-text-link' %> | - <%= link_to 'Back', admin_donations_path, class: 'ks-text-link' %> -

+
+

+ <%= link_to 'Edit', edit_admin_donation_path(@donation), class: 'btn-md btn-blue mr-1' %> + <%= link_to 'Back', admin_donations_path, class: 'btn-md btn-gray' %> +

+
<% end %>