app/views/users/memberships/index.html.erb
<% cache [
@owned_groups,
@associated_groups,
current_user,
current_user.confirmed?
] do %>
<div class="container-fluid pb-1">
<div class="container">
<div class="row d-flex justify-content-center">
<div class="col-sm-12 col-lg-10 col-xl-8 pb-3">
<h2 class="text-center mt-2rem mb-2rem pt-2 pb-2">
Owned Groups
</h2>
<% if @owned_groups.any? %>
<%= render partial: "user_group",
collection: @owned_groups, as: :group,
locals: { user: @user }, cached: true %>
<% else %>
<h3 class="h5 text-center pb-3">
You still don't own any group. Why not creating one? :)
</h3>
<% end %>
<!-- current_user.confirmed? -->
<%= render "application/create_group_button_with_alert" %>
<% if @associated_groups.any? %>
<div class="mb-2rem">
<h2 class="text-center mt-1rem mb-2rem">With Membership</h2>
<!-- Not caching to show the [Organizer] label -->
<%= render partial: "user_group",
collection: @associated_groups, as: :group,
locals: { user: @user } %>
</div>
<% end %>
</div>
</div>
</div>
</div>
<% end %>