Add invitations page to admin panel #24

Merged
raucao merged 2 commits from feature/admin_invitations into master 2021-02-01 22:53:31 +00:00
3 changed files with 13 additions and 9 deletions
Showing only changes of commit 0110f27ada - Show all commits

View File

@@ -119,12 +119,7 @@ main {
}
section {
padding-bottom: 3rem;
margin-bottom: 3rem;
&:not(:last-of-type) {
border-bottom: 1px dotted #ccc;
}
}
table {

View File

@@ -1,6 +1,8 @@
class Admin::InvitationsController < Admin::BaseController
def index
@current_section = :invitations
@invitations_unused_count = Invitation.unused.count
@users_with_referrals_count = Invitation.used.distinct.count(:user_id)
@invitations_used = Invitation.used.order('used_at desc')
end
end

View File

@@ -1,7 +1,14 @@
<section>
<h2>Invitations</h2>
<% if @invitations_used.any? %>
<p>
There are currently <strong><%= @invitations_unused_count %>
unused invitations</strong> available to existing users.
<strong><%= @users_with_referrals_count %> users</strong> have successfully
invited new users.
</p>
</section>
<% if @invitations_used.any? %>
<section>
<h3>Accepted (<%= @invitations_used.length %>)</h3>
<table>
<thead>
@@ -21,5 +28,5 @@
<% end %>
</tbody>
</table>
<% end %>
</section>
</section>
<% end %>