Add pagination to admin pages
This commit is contained in:
parent
3aad27c7bd
commit
cbbb4c6e47
@ -5,7 +5,8 @@ class Admin::DonationsController < Admin::BaseController
|
||||
# GET /donations
|
||||
# GET /donations.json
|
||||
def index
|
||||
@donations = Donation.all.order('created_at desc')
|
||||
@pagy, @donations = pagy(Donation.all.order('created_at desc'))
|
||||
|
||||
@stats = {
|
||||
overall_sats: @donations.all.sum("amount_sats"),
|
||||
donor_count: Donation.distinct.count(:user_id)
|
||||
|
@ -1,7 +1,8 @@
|
||||
class Admin::InvitationsController < Admin::BaseController
|
||||
def index
|
||||
@current_section = :invitations
|
||||
@invitations_used = Invitation.used.order('used_at desc')
|
||||
@pagy, @invitations_used = pagy(Invitation.used.order('used_at desc'))
|
||||
|
||||
@stats = {
|
||||
available: Invitation.unused.count,
|
||||
accepted: @invitations_used.length,
|
||||
|
@ -6,7 +6,7 @@ class Admin::UsersController < Admin::BaseController
|
||||
ldap = LdapService.new
|
||||
@ou = params[:ou] || "kosmos.org"
|
||||
@orgs = ldap.fetch_organizations
|
||||
@users = User.where(ou: @ou).order(cn: :asc).to_a
|
||||
@pagy, @users = pagy(User.where(ou: @ou).order(cn: :asc))
|
||||
|
||||
@stats = {
|
||||
users_confirmed: User.where(ou: @ou).confirmed.count,
|
||||
|
@ -21,7 +21,7 @@
|
||||
<section>
|
||||
<% if @donations.any? %>
|
||||
<h3>Recent Donations</h3>
|
||||
<table class="divided">
|
||||
<table class="divided mb-8">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
@ -52,6 +52,7 @@
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%== pagy_nav @pagy %>
|
||||
<% else %>
|
||||
<p>
|
||||
No donations yet.
|
||||
|
@ -24,7 +24,7 @@
|
||||
<% if @invitations_used.any? %>
|
||||
<section>
|
||||
<h3>Recently Accepted</h3>
|
||||
<table class="divided">
|
||||
<table class="divided mb-8">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Token</th>
|
||||
@ -44,6 +44,7 @@
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%== pagy_nav @pagy %>
|
||||
</section>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -30,7 +30,7 @@
|
||||
<% end %>
|
||||
|
||||
<section>
|
||||
<table class="divided">
|
||||
<table class="divided mb-8">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>UID</th>
|
||||
@ -49,5 +49,6 @@
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%== pagy_nav @pagy %>
|
||||
</section>
|
||||
<% end %>
|
||||
|
Loading…
x
Reference in New Issue
Block a user