simple_teams 0.1.4 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +67 -7
- data/app/controllers/simple_teams/accept_invitations_controller.rb +1 -1
- data/app/controllers/simple_teams/invitations_controller.rb +1 -1
- data/app/controllers/simple_teams/memberships_controller.rb +1 -1
- data/app/forms/application_form.rb +3 -0
- data/app/forms/simple_teams/invitation_forms/create.rb +1 -1
- data/app/forms/simple_teams/invitation_forms/create_bulk.rb +1 -1
- data/app/forms/simple_teams/invitation_forms/update.rb +1 -1
- data/app/forms/simple_teams/membership_form.rb +1 -1
- data/app/helpers/simple_teams/base_helper.rb +11 -0
- data/app/helpers/simple_teams/teams_helper.rb +7 -0
- data/app/mailers/simple_teams/application_mailer.rb +1 -1
- data/app/models/concerns/simple_teams/member_object.rb +1 -0
- data/app/models/simple_teams/ability.rb +2 -2
- data/app/notifiers/concerns/simple_teams/invitation_notifier.rb +59 -0
- data/app/notifiers/concerns/simple_teams/membership_notifier.rb +63 -0
- data/app/notifiers/simple_teams/application_notifier.rb +6 -0
- data/app/notifiers/simple_teams/bulk_invitations_notifier.rb +52 -0
- data/app/notifiers/simple_teams/invitations/accepted_notifier.rb +16 -0
- data/app/notifiers/simple_teams/invitations/created_notifier.rb +16 -0
- data/app/notifiers/simple_teams/invitations/destroyed_notifier.rb +16 -0
- data/app/notifiers/simple_teams/invitations/updated_notifier.rb +16 -0
- data/app/notifiers/simple_teams/memberships/destroyed_notifier.rb +16 -0
- data/app/notifiers/simple_teams/memberships/left_notifier.rb +20 -0
- data/app/notifiers/simple_teams/memberships/updated_notifier.rb +20 -0
- data/app/service_objects/simple_teams/leave_team_service.rb +1 -1
- data/app/views/simple_teams/_nested_action_breadcrumb.html.erb +8 -0
- data/app/views/simple_teams/_roles_field.html.erb +2 -2
- data/app/views/simple_teams/invitations/_invitation.html.erb +1 -1
- data/app/views/simple_teams/invitations/edit.html.erb +1 -6
- data/app/views/simple_teams/invitations/new.html.erb +1 -6
- data/app/views/simple_teams/memberships/_membership.html.erb +1 -1
- data/app/views/simple_teams/memberships/edit.html.erb +1 -6
- data/app/views/simple_teams/teams/_add_member_link.html.erb +1 -1
- data/app/views/simple_teams/teams/_dropdown_menu.html.erb +14 -0
- data/app/views/simple_teams/teams/_index_breadcrumb.html.erb +7 -0
- data/app/views/simple_teams/teams/_members_table.html.erb +1 -1
- data/app/views/simple_teams/teams/show.html.erb +8 -33
- data/config/locales/simple_teams.en.yml +18 -3
- data/lib/simple_teams/engine.rb +5 -0
- data/lib/simple_teams/version.rb +1 -1
- metadata +78 -38
- data/app/controllers/simple_teams/admin/invitations_controller.rb +0 -60
- data/app/controllers/simple_teams/admin/memberships_controller.rb +0 -60
- data/app/controllers/simple_teams/admin/teams_controller.rb +0 -60
- data/app/notifications/application_notification.rb +0 -4
- data/app/notifications/simple_teams/bulk_invitations_notification.rb +0 -51
- data/app/notifications/simple_teams/invitation_notification.rb +0 -54
- data/app/notifications/simple_teams/invitations/accepted_notification.rb +0 -13
- data/app/notifications/simple_teams/invitations/created_notification.rb +0 -13
- data/app/notifications/simple_teams/invitations/destroyed_notification.rb +0 -13
- data/app/notifications/simple_teams/invitations/updated_notification.rb +0 -13
- data/app/notifications/simple_teams/membership_notification.rb +0 -58
- data/app/notifications/simple_teams/memberships/destroyed_notification.rb +0 -13
- data/app/notifications/simple_teams/memberships/left_notification.rb +0 -17
- data/app/notifications/simple_teams/memberships/updated_notification.rb +0 -17
- data/app/views/simple_teams/admin/invitations/_form.html.erb +0 -62
- data/app/views/simple_teams/admin/invitations/_invitation.html.erb +0 -47
- data/app/views/simple_teams/admin/invitations/edit.html.erb +0 -10
- data/app/views/simple_teams/admin/invitations/index.html.erb +0 -14
- data/app/views/simple_teams/admin/invitations/new.html.erb +0 -9
- data/app/views/simple_teams/admin/invitations/show.html.erb +0 -10
- data/app/views/simple_teams/admin/memberships/_form.html.erb +0 -32
- data/app/views/simple_teams/admin/memberships/_membership.html.erb +0 -17
- data/app/views/simple_teams/admin/memberships/edit.html.erb +0 -10
- data/app/views/simple_teams/admin/memberships/index.html.erb +0 -14
- data/app/views/simple_teams/admin/memberships/new.html.erb +0 -9
- data/app/views/simple_teams/admin/memberships/show.html.erb +0 -10
- data/app/views/simple_teams/admin/teams/_form.html.erb +0 -22
- data/app/views/simple_teams/admin/teams/_team.html.erb +0 -7
- data/app/views/simple_teams/admin/teams/edit.html.erb +0 -10
- data/app/views/simple_teams/admin/teams/index.html.erb +0 -14
- data/app/views/simple_teams/admin/teams/new.html.erb +0 -9
- data/app/views/simple_teams/admin/teams/show.html.erb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7269707d1cb9ecf7ebc402e57e9c0575d859ae09423b37679fd952a6542e02a
|
4
|
+
data.tar.gz: d91aa3498e0dbf574afdf1280ffa87e4614da9e45a5c6aaf4e263cb23929df36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22d4b9d0f0b45b10b6636ae23d2d5f6f48af925dfb494394c9c6db51c1cfc59b69cf02d75890f96f7cf8f168ee63081ce4d36284aa6d9729d6157ec70b87ad48
|
7
|
+
data.tar.gz: 1b0fd8305e5140e901b4849c676acd8b07331dfff4d487ff490b794e47fd1eb9a4c78aa55febc008a913d45eef9c7b5cd56be362bf03e2450d9d60c9d8e78dc5
|
data/README.md
CHANGED
@@ -1,17 +1,77 @@
|
|
1
|
-
# WARNING:
|
2
|
-
This gem is a work in progress. If you like what we are doing, feel free to watch it for updates, but please do not attempt to use it in production.
|
3
|
-
|
4
1
|
# SimpleTeams
|
5
2
|
SimpleTeams is an all-in-one solution for implementing teams quickly in a Ruby on Rails (RoR) application. It follows best practices, using the Rails Engine design pattern for easy configurability, CanCan for authorization, and polymorphic association (like ActiveStorage) to avoid dictating model names.
|
6
3
|
|
7
|
-
##
|
8
|
-
|
4
|
+
## STATUS
|
5
|
+
SimpleTeams is in use within several client-facing applications. However, the gem is still under development, and notably lacks standalone testing.
|
6
|
+
|
7
|
+
That said, feel free to try it out, and let us know if you have any comments/questions. Just make sure to test things thoroughly, and be patient with the (sparse) documentation.
|
9
8
|
|
10
9
|
## Installation
|
11
|
-
|
10
|
+
1. Add simple_teams to your Gemfile and run bundle install
|
11
|
+
|
12
|
+
2. Add the necessary initializers to your config directory (NEED TO ADD DETAILS)
|
13
|
+
|
14
|
+
- devise.rb (see devise gem for further details)
|
15
|
+
|
16
|
+
- simple\_form.rb (see simple_form gem for further details)
|
17
|
+
|
18
|
+
- simple\_teams.rb (NEED TO MAKE THIS AN INSTALL SCRIPT)
|
19
|
+
|
20
|
+
3. Install the necessary migrations for simple\_teams and it's dependencies
|
21
|
+
|
22
|
+
```
|
23
|
+
devise generate User
|
24
|
+
rails noticed:install:migrations
|
25
|
+
rails simple_teams:install:migrations
|
26
|
+
```
|
27
|
+
|
28
|
+
4. Add the SimpleTeams concerns to the desired models. E.g.
|
29
|
+
|
30
|
+
```
|
31
|
+
#app/models/user.rb
|
32
|
+
class User
|
33
|
+
include SimpleTeams::MemberObject
|
34
|
+
...
|
35
|
+
|
36
|
+
#app/models/Organization.rb
|
37
|
+
class Organization
|
38
|
+
include SimpleTeams::TeamObject
|
39
|
+
...
|
40
|
+
```
|
41
|
+
|
42
|
+
5. Make sure to initialize the TeamObject properly via the InitializeTeamService to specify the owner of the team. E.g.
|
43
|
+
|
44
|
+
```
|
45
|
+
#within the create action of app/controllers/organizations_controller.rb
|
46
|
+
|
47
|
+
def create
|
48
|
+
if @organization.update(organization_params)
|
49
|
+
SimpleTeams::InitializeTeamService.new(current_user, @organization.team).perform
|
50
|
+
redirect_to @organization, ...
|
51
|
+
...
|
52
|
+
```
|
53
|
+
|
54
|
+
## Usage
|
55
|
+
1. SimpleTeams comes pre-packaged with all of the necessary controllers and views for adding/updating/removing team members. For the default functionality, you can simply link from the teamable object (e.g. the "Organization") to the team for users to view/manage these permissions. E.g.
|
56
|
+
|
57
|
+
```
|
58
|
+
#app/views/organizations/show.html.erb
|
59
|
+
|
60
|
+
link_to "Organization Roles", simple_teams.team_path(@organization.team)
|
61
|
+
|
62
|
+
```
|
63
|
+
|
64
|
+
2. The breadcrumbs in these views will reference the default routes for the teamable resource automatically. E.g.
|
65
|
+
Organizations / Test Organization / Team Members
|
66
|
+
|
67
|
+
However, you can customize these views, as well, by installing them in your application via the standard Engine functionality (i.e. "rails simple\_teams:install:views")
|
68
|
+
|
69
|
+
3. NOTE: NEED TO ADD INSTRUCTIONS REGARDING locale configuration.
|
12
70
|
|
13
71
|
## Contributing
|
14
|
-
|
72
|
+
This gem is still in its initial stages, so it is important to ensure that it grows in the proper directions.
|
73
|
+
|
74
|
+
That said, contributions are welcome, but please give me a heads up on your ideas (via Github issues) so that we can discuss them beforehand.
|
15
75
|
|
16
76
|
## License
|
17
77
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -16,7 +16,7 @@ module SimpleTeams
|
|
16
16
|
if @service_object.valid?
|
17
17
|
@service_object.perform
|
18
18
|
|
19
|
-
SimpleTeams::Invitations::
|
19
|
+
SimpleTeams::Invitations::AcceptedNotifier.with(
|
20
20
|
:team_id => @team.id,
|
21
21
|
:invitation_id => @invitation.id,
|
22
22
|
:user_id => current_user.id,
|
@@ -60,7 +60,7 @@ module SimpleTeams
|
|
60
60
|
invitation_email = @invitation.email
|
61
61
|
@invitation.destroy
|
62
62
|
|
63
|
-
SimpleTeams::Invitations::
|
63
|
+
SimpleTeams::Invitations::DestroyedNotifier.with(
|
64
64
|
:team_id => @team.id,
|
65
65
|
:invitation_id => invitation_id,
|
66
66
|
:user_id => current_user.id,
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module SimpleTeams
|
2
|
+
module BaseHelper
|
3
|
+
def team_based_role_name(team, role)
|
4
|
+
t "simple_teams.#{team.teamable.class.model_name.plural}.roles.names.#{role}", :default => [t("simple_teams.roles.names.#{role}")]
|
5
|
+
end
|
6
|
+
|
7
|
+
def team_based_role_description(team, role)
|
8
|
+
t "simple_teams.#{team.teamable.class.model_name.plural}.roles.descriptions.#{role}", :default => [t("simple_teams.roles.descriptions.#{role}")]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,4 +1,11 @@
|
|
1
1
|
module SimpleTeams
|
2
2
|
module TeamsHelper
|
3
|
+
def team_based_role_name(team, role)
|
4
|
+
t "simple_teams.#{team.teamable.class.to_s.underscore}.role_names.#{role}", :default => [t("simple_teams.role_names.#{role}")]
|
5
|
+
end
|
6
|
+
|
7
|
+
def team_based_role_description(team, role)
|
8
|
+
t "simple_teams.#{team.teamable.class.to_s.underscore}.role_descriptions.#{role}", :default => [t("simple_teams.role_descriptions.#{role}")]
|
9
|
+
end
|
3
10
|
end
|
4
11
|
end
|
@@ -5,6 +5,7 @@ module SimpleTeams::MemberObject
|
|
5
5
|
has_many :team_memberships, :class_name => "SimpleTeams::Membership", :foreign_key => :member_id, :dependent => :destroy
|
6
6
|
has_many :teams, :through => :team_memberships, :class_name => "SimpleTeams::Team"
|
7
7
|
has_many :team_members, :through => :teams, :source => :members, :class_name => SimpleTeams.member_class.to_s
|
8
|
+
has_many :notifications, as: :recipient, :class_name => "Noticed::Notification", dependent: :destroy
|
8
9
|
end
|
9
10
|
|
10
11
|
def member_of_team?(team)
|
@@ -14,11 +14,11 @@ module SimpleTeams
|
|
14
14
|
end
|
15
15
|
|
16
16
|
can [:update], Team do |team|
|
17
|
-
|
17
|
+
%w"owner administrator".include? user.role_for_team(team)
|
18
18
|
end
|
19
19
|
|
20
20
|
can [:destroy], Team do |team|
|
21
|
-
|
21
|
+
%w"owner".include? user.role_for_team(team)
|
22
22
|
end
|
23
23
|
|
24
24
|
# Team Memberships/Invitations
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module SimpleTeams
|
2
|
+
module InvitationNotifier
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
required_params :team_id, :invitation_id, :user_id, :team_name, :invitation_name, :user_name
|
7
|
+
|
8
|
+
notification_methods do
|
9
|
+
def message
|
10
|
+
raise NotImplemented
|
11
|
+
end
|
12
|
+
|
13
|
+
def subject
|
14
|
+
raise NotImplemented
|
15
|
+
end
|
16
|
+
|
17
|
+
def url
|
18
|
+
if team.present? and team.members.include? recipient
|
19
|
+
SimpleTeams::Engine.routes.url_helpers.team_path(team)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def link_text
|
24
|
+
"View Invitations"
|
25
|
+
end
|
26
|
+
|
27
|
+
# Objects
|
28
|
+
def team
|
29
|
+
Team.find_by(id: params[:team_id])
|
30
|
+
end
|
31
|
+
|
32
|
+
def user
|
33
|
+
User.find_by(id: params[:user_id])
|
34
|
+
end
|
35
|
+
|
36
|
+
def invitation
|
37
|
+
team.invitations.find_by(id: params[:invitation_id]) if team.present?
|
38
|
+
end
|
39
|
+
|
40
|
+
# Names (fallback)
|
41
|
+
def team_name
|
42
|
+
team.present? ? team.name : params[:team_name]
|
43
|
+
end
|
44
|
+
|
45
|
+
def invitation_name
|
46
|
+
invitation.present? ? invitation.email : params[:invitation_name]
|
47
|
+
end
|
48
|
+
|
49
|
+
def user_name
|
50
|
+
if recipient.id == params[:user_id]
|
51
|
+
"You"
|
52
|
+
else
|
53
|
+
user.present? ? user.full_name : params[:user_name]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module SimpleTeams
|
2
|
+
module MembershipNotifier
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
required_params :team_id, :member_id, :user_id, :team_name, :member_name, :user_name
|
7
|
+
|
8
|
+
notification_methods do
|
9
|
+
def message
|
10
|
+
raise NotImplemented
|
11
|
+
end
|
12
|
+
|
13
|
+
def subject
|
14
|
+
raise NotImplemented
|
15
|
+
end
|
16
|
+
|
17
|
+
def url
|
18
|
+
if team.present? and team.members.include? recipient
|
19
|
+
SimpleTeams::Engine.routes.url_helpers.team_path(team)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def link_text
|
24
|
+
"View Permissions"
|
25
|
+
end
|
26
|
+
|
27
|
+
# Objects
|
28
|
+
def team
|
29
|
+
Team.find_by(id: params[:team_id])
|
30
|
+
end
|
31
|
+
|
32
|
+
def user
|
33
|
+
User.find_by(id: params[:user_id])
|
34
|
+
end
|
35
|
+
|
36
|
+
def member
|
37
|
+
team.members.find_by(id: params[:member_id]) if team.present?
|
38
|
+
end
|
39
|
+
|
40
|
+
# Names (fallback)
|
41
|
+
def team_name
|
42
|
+
team.present? ? team.name : params[:team_name]
|
43
|
+
end
|
44
|
+
|
45
|
+
def member_name
|
46
|
+
if recipient.id == params[:member_id]
|
47
|
+
"you"
|
48
|
+
else
|
49
|
+
member.present? ? member.full_name : params[:member_name]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def user_name
|
54
|
+
if recipient.id == params[:user_id]
|
55
|
+
"You"
|
56
|
+
else
|
57
|
+
user.present? ? user.full_name : params[:user_name]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module SimpleTeams
|
2
|
+
class BulkInvitationsNotifier < SimpleTeams::ApplicationNotifier
|
3
|
+
required_params :team_id, :user_id, :team_name, :user_name, :invitation_names
|
4
|
+
|
5
|
+
notification_methods do
|
6
|
+
def message
|
7
|
+
"#{user_name} invited #{invitation_names.to_sentence} to #{team_name}."
|
8
|
+
end
|
9
|
+
|
10
|
+
def subject
|
11
|
+
"Users Invited"
|
12
|
+
end
|
13
|
+
|
14
|
+
def url
|
15
|
+
if team.present?
|
16
|
+
SimpleTeams::Engine.routes.url_helpers.team_path(team)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def link_text
|
21
|
+
"View Invitations"
|
22
|
+
end
|
23
|
+
|
24
|
+
# Objects
|
25
|
+
def team
|
26
|
+
Team.find_by(id: params[:team_id])
|
27
|
+
end
|
28
|
+
|
29
|
+
def user
|
30
|
+
User.find_by(id: params[:user_id])
|
31
|
+
end
|
32
|
+
|
33
|
+
# Names (fallback)
|
34
|
+
def team_name
|
35
|
+
team.present? ? team.name : params[:team_name]
|
36
|
+
end
|
37
|
+
|
38
|
+
def invitation_names
|
39
|
+
params[:invitation_names]
|
40
|
+
end
|
41
|
+
|
42
|
+
def user_name
|
43
|
+
if recipient.id == params[:user_id]
|
44
|
+
"You"
|
45
|
+
else
|
46
|
+
user.present? ? user.full_name : params[:user_name]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module SimpleTeams
|
2
|
+
class Invitations::AcceptedNotifier < ApplicationNotifier
|
3
|
+
include SimpleTeams::InvitationNotifier
|
4
|
+
|
5
|
+
notification_methods do
|
6
|
+
def message
|
7
|
+
"#{user_name} accepted the invitation to #{team_name}."
|
8
|
+
end
|
9
|
+
|
10
|
+
def subject
|
11
|
+
"Invitation Accepted"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module SimpleTeams
|
2
|
+
class Invitations::CreatedNotifier < ApplicationNotifier
|
3
|
+
include SimpleTeams::InvitationNotifier
|
4
|
+
|
5
|
+
notification_methods do
|
6
|
+
def message
|
7
|
+
"#{user_name} invited #{invitation_name} to #{team_name}."
|
8
|
+
end
|
9
|
+
|
10
|
+
def subject
|
11
|
+
"User Invited"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module SimpleTeams
|
2
|
+
class Invitations::DestroyedNotifier < ApplicationNotifier
|
3
|
+
include SimpleTeams::InvitationNotifier
|
4
|
+
|
5
|
+
notification_methods do
|
6
|
+
def message
|
7
|
+
"#{user_name} deleted the invitation for #{invitation_name} to #{team_name}."
|
8
|
+
end
|
9
|
+
|
10
|
+
def subject
|
11
|
+
"Invitation Deleted"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module SimpleTeams
|
2
|
+
class Invitations::UpdatedNotifier < ApplicationNotifier
|
3
|
+
include SimpleTeams::InvitationNotifier
|
4
|
+
|
5
|
+
notification_methods do
|
6
|
+
def message
|
7
|
+
"#{user_name} updated the invitation for #{invitation_name} to #{team_name}."
|
8
|
+
end
|
9
|
+
|
10
|
+
def subject
|
11
|
+
"Invitation Updated"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module SimpleTeams
|
2
|
+
class Memberships::DestroyedNotifier < ApplicationNotifier
|
3
|
+
include SimpleTeams::MembershipNotifier
|
4
|
+
|
5
|
+
notification_methods do
|
6
|
+
def message
|
7
|
+
"#{user_name} removed #{member_name} from #{team_name}."
|
8
|
+
end
|
9
|
+
|
10
|
+
def subject
|
11
|
+
"Member Removed"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module SimpleTeams
|
2
|
+
class Memberships::LeftNotifier < ApplicationNotifier
|
3
|
+
include SimpleTeams::MembershipNotifier
|
4
|
+
|
5
|
+
notification_methods do
|
6
|
+
def message
|
7
|
+
if recipient.id == params[:member_id]
|
8
|
+
"You left #{team_name}."
|
9
|
+
else
|
10
|
+
"#{member_name} left #{team_name}."
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def subject
|
15
|
+
"Member Left"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module SimpleTeams
|
2
|
+
class Memberships::UpdatedNotifier < ApplicationNotifier
|
3
|
+
include SimpleTeams::MembershipNotifier
|
4
|
+
|
5
|
+
notification_methods do
|
6
|
+
def message
|
7
|
+
if recipient.id == params[:member_id]
|
8
|
+
"#{user_name} updated your role for #{team_name}."
|
9
|
+
else
|
10
|
+
"#{user_name} updated the role of #{member_name} for #{team_name}."
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def subject
|
15
|
+
"Member Updated"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -42,7 +42,7 @@ module SimpleTeams
|
|
42
42
|
|
43
43
|
def generate_notification
|
44
44
|
recipients = team.members.to_a << user
|
45
|
-
SimpleTeams::Memberships::
|
45
|
+
SimpleTeams::Memberships::LeftNotifier.with(
|
46
46
|
:team_id => team.id,
|
47
47
|
:member_id => user.id,
|
48
48
|
:user_id => user.id,
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<nav aria-label="breadcrumb">
|
2
|
+
<ol class="breadcrumb">
|
3
|
+
<li class="breadcrumb-item"><%= link_to @team.teamable.class.model_name.human(count: 2), main_app.url_for(@team.teamable.class) %></li>
|
4
|
+
<li class="breadcrumb-item"><%= link_to @team.teamable.name, main_app.url_for(@team.teamable) %></li>
|
5
|
+
<li class="breadcrumb-item"><%= link_to "Team Members", @team %></li>
|
6
|
+
<li class="breadcrumb-item active" aria-current="page"><%= current_page_name %></li>
|
7
|
+
</ol>
|
8
|
+
</nav>
|
@@ -7,8 +7,8 @@
|
|
7
7
|
<%= radio_button_tag "#{prefix}[role]", name, [name].include?(f.object.role), :class => "form-check-input" %>
|
8
8
|
<%= label_tag "#{prefix}_role_#{name}", :class => "form-check-label w-100" do %>
|
9
9
|
<div class="">
|
10
|
-
<div class="col"><b><%= name
|
11
|
-
<div class="col"><%=
|
10
|
+
<div class="col"><b><%= team_based_role_name(@team, name) %></b></div>
|
11
|
+
<div class="col"><%= team_based_role_description(@team, name) %></div>
|
12
12
|
</div>
|
13
13
|
<% end %>
|
14
14
|
</div>
|
@@ -1,10 +1,5 @@
|
|
1
1
|
<div class="centered-content-template">
|
2
|
-
|
3
|
-
<ol class="breadcrumb">
|
4
|
-
<li class="breadcrumb-item"><a href="<%= team_path(@team) %>"><%= @team.name %></a></li>
|
5
|
-
<li class="breadcrumb-item active" aria-current="page">Update Invitation</li>
|
6
|
-
</ol>
|
7
|
-
</nav>
|
2
|
+
<%= render "simple_teams/nested_action_breadcrumb", :current_page_name => "Update Invitation" %>
|
8
3
|
|
9
4
|
<h1>Update Invitation</h1>
|
10
5
|
|
@@ -1,10 +1,5 @@
|
|
1
1
|
<div class="centered-content-template">
|
2
|
-
|
3
|
-
<ol class="breadcrumb">
|
4
|
-
<li class="breadcrumb-item"><a href="<%= team_path(@team) %>"><%= @team.name %></a></li>
|
5
|
-
<li class="breadcrumb-item active" aria-current="page">Invite User</li>
|
6
|
-
</ol>
|
7
|
-
</nav>
|
2
|
+
<%= render "simple_teams/nested_action_breadcrumb", :current_page_name => "Invite Users" %>
|
8
3
|
|
9
4
|
<h1>Invite Users</h1>
|
10
5
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<tr id="<%= dom_id membership %>">
|
2
2
|
<td><%= membership.member.full_name %><%= " (you)" if current_user.membership_for_team(team) == membership %></td>
|
3
|
-
<td><%= membership.role
|
3
|
+
<td><%= team_based_role_name(team, membership.role) %></td>
|
4
4
|
<td>Active</td>
|
5
5
|
<td><%= membership.created_at.to_date %></td>
|
6
6
|
<td>
|
@@ -1,10 +1,5 @@
|
|
1
1
|
<div class="centered-content-template">
|
2
|
-
|
3
|
-
<ol class="breadcrumb">
|
4
|
-
<li class="breadcrumb-item"><a href="<%= team_path(@team) %>"><%= @team.name %></a></li>
|
5
|
-
<li class="breadcrumb-item active" aria-current="page">Edit Member</li>
|
6
|
-
</ol>
|
7
|
-
</nav>
|
2
|
+
<%= render "simple_teams/nested_action_breadcrumb", :current_page_name => "Edit Member" %>
|
8
3
|
|
9
4
|
<h1>Edit Member: <%= @membership.member.full_name %></h1>
|
10
5
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="dropdown mt-2">
|
2
|
+
<button class="btn btn-outline-dark btn-sm dropdown-toggle" type="button" id="<%= @team.id %>-dropdown-menu" data-bs-toggle="dropdown" aria-expanded="false">
|
3
|
+
Actions
|
4
|
+
</button>
|
5
|
+
<ul class="dropdown-menu" aria-labelledby="<%= @team.id %>-dropdown-menu">
|
6
|
+
<% if can? :create, @team.invitations.new %>
|
7
|
+
<%= link_to "Invite Users", new_team_invitation_path(@team), :class => "dropdown-item" %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% if current_user.membership_for_team(@team).present? %>
|
11
|
+
<%= button_to "Leave", team_leave_team_path(@team), :method => :delete, :class => "btn btn-link dropdown-item", :form => { :data => { "turbo-confirm" => "Are you sure you want to leave this #{ @team.teamable.class.model_name.human }?" } } %>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|