diff --git a/app/models/membership.rb b/app/models/membership.rb index 74417e06b..4f5927b0e 100644 --- a/app/models/membership.rb +++ b/app/models/membership.rb @@ -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' diff --git a/app/views/memberships/show.html.erb b/app/views/memberships/show.html.erb index 6949416b1..2856e617d 100644 --- a/app/views/memberships/show.html.erb +++ b/app/views/memberships/show.html.erb @@ -1,3 +1,4 @@ +<%- breadcrumb :show_membership, membership %>

<%= membership.member.name %>

<%= membership.member.email %>

@@ -6,4 +7,4 @@ - \ No newline at end of file + diff --git a/config/breadcrumbs.rb b/config/breadcrumbs.rb index 309a315e2..96c5843a8 100644 --- a/config/breadcrumbs.rb +++ b/config/breadcrumbs.rb @@ -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| @@ -59,4 +68,4 @@ crumb :rsvp do |rsvp| link 'Respond to your Invitation' parent :root, rsvp.space -end \ No newline at end of file +end