Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memberships: Adds Breadcrumb from Membership: Show page #899

Merged
merged 1 commit into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/models/membership.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class Membership < ApplicationRecord

validates :member, uniqueness: { scope: :space_id }

def member_name
member.display_name
end

enum status: {
active: 'active',
revoked: 'revoked'
Expand Down
3 changes: 2 additions & 1 deletion app/views/memberships/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%- breadcrumb :show_membership, membership %>
<h1><%= membership.member.name %></h1>
<p><%= membership.member.email %></p>

Expand All @@ -6,4 +7,4 @@
<ul>
<%= render membership.sent_invitations %>
</ul>
</section>
</section>
13 changes: 11 additions & 2 deletions config/breadcrumbs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@

crumb :memberships do |space|
link 'Members', [space, :memberships]
parent :edit_space, space
if policy(space).edit?
parent :edit_space, Space
else
parent :root
end
end

crumb :show_membership do |membership|
link membership.member_name, [membership.space, membership]
parent :memberships, membership.space
end

crumb :invitations do |space|
Expand Down Expand Up @@ -59,4 +68,4 @@
crumb :rsvp do |rsvp|
link 'Respond to your Invitation'
parent :root, rsvp.space
end
end