Refactor admin donation pages, fix errors
All checks were successful
continuous-integration/drone/push Build is passing

Not sending the right response codes for Turbo to handle.
This commit is contained in:
Râu Cao
2023-03-15 15:24:00 +07:00
parent 95fac38b53
commit f050d010fd
7 changed files with 23 additions and 20 deletions

View File

@@ -1,16 +1,16 @@
<%= form_with(url: url, model: donation, local: true) do |form| %>
<% if donation.errors.any? %>
<div id="error_explanation">
<section id="error_explanation">
<h3><%= pluralize(donation.errors.count, "error") %> prohibited this donation from being saved:</h3>
<ul>
<ul class="list-disc list-inside">
<% donation.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
</section>
<% end %>
<div class="sm:w-1/2 grid grid-cols-2 items-center gap-y-2">
<section class="sm:w-1/2 grid grid-cols-2 items-center gap-y-2">
<%= form.label :user_id %>
<%= form.collection_select :user_id, User.where(ou: "kosmos.org").order(:cn), :id, :cn, {} %>
@@ -28,9 +28,14 @@
<%= form.label :paid_at %>
<%= form.text_field :paid_at %>
</div>
</section>
<p class="mt-8">
<%= form.submit class: 'btn-md btn-blue' %>
</p>
<section>
<p class="pt-6 border-t border-gray-200 text-right">
<%= link_to 'Cancel',
@donation.id.present? ? admin_donation_path(@donation) : admin_donations_path,
class: 'btn-md btn-gray' %>
<%= form.submit class: 'ml-2 btn-md btn-blue' %>
</p>
</section>
<% end %>

View File

@@ -2,8 +2,4 @@
<%= render MainSimpleComponent.new do %>
<%= render 'form', donation: @donation, url: admin_donation_path(@donation) %>
<p class="mt-8">
<%= link_to 'Cancel', admin_donation_path(@donation), class: 'btn-sm btn-gray' %>
<p>
<% end %>

View File

@@ -2,8 +2,4 @@
<%= render MainSimpleComponent.new do %>
<%= render 'form', donation: @donation, url: admin_donations_path %>
<p class="mt-8">
<%= link_to 'Back', admin_donations_path, class: 'ks-text-link' %>
</p>
<% end %>

View File

@@ -33,9 +33,9 @@
</section>
<section>
<p>
<%= link_to 'Edit', edit_admin_donation_path(@donation), class: 'btn-md btn-blue mr-1' %>
<p class="pt-6 border-t border-gray-200 text-right">
<%= link_to 'Back', admin_donations_path, class: 'btn-md btn-gray' %>
<%= link_to 'Edit', edit_admin_donation_path(@donation), class: 'ml-2 btn-md btn-blue mr-1' %>
</p>
</section>
<% end %>