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