simple_teams 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da8068e7298920ff8cce86d505171c99e7e9c37a0dea9423f0847fd28440b455
4
- data.tar.gz: 7806782011712e2964aeec5d9031e30bc5d4190177e66bd16bafab5aa273e14c
3
+ metadata.gz: ea436fc244351fbe757513bc528932e72825f362859ce81edf4036a2b353bfc1
4
+ data.tar.gz: 636891c0d6281d29494eef2231b7a76245b062c04c506af26cc969136e48fc51
5
5
  SHA512:
6
- metadata.gz: 387bf7830fbc9badf2b076ae56c7190a2af366aa7e1633fcfb1d39441c3280c6507e22b783e2150e6646c7d9551b440d309109c9644e2b7b4412734050df2e8c
7
- data.tar.gz: 17401c280915409b8128d13d24492a23916f6fd422f11ae59ff036c7afe0c7efd7c0b68de4734ce5231dc0f54235c40d1ac0b25ac443b493691685f862268ac3
6
+ metadata.gz: d8953835540518f246b25150d052553e8fce1de4bdbf70f8bb9045b918323b28d6d57a6b9ef18be6e998be6014816a23d5636de917cc30b1c7f235c5e397db25
7
+ data.tar.gz: 596cc17142a92d83a48393dc75e299941bde02cfedf5374db8be52526c2a870e3aac796259753500aa4dcc4818e5083671b5ab25a25d8dfa59fdef1fb3c15f70
@@ -1,6 +1,5 @@
1
1
  module SimpleTeams
2
- class AcceptInvitationsController < ApplicationController
3
- skip_before_action :authenticate_user!
2
+ class AcceptInvitationsController < BaseController
4
3
  before_action :set_invitation
5
4
  before_action :ensure_invitation_token_is_valid
6
5
  before_action :set_team
@@ -12,7 +11,7 @@ module SimpleTeams
12
11
  def create
13
12
  if params[:commit] == "Decline"
14
13
  @invitation.declined!
15
- redirect_to root_path, :notice => "You have declined the invitation to the '#{@team.name}' #{@team.teamable.class.model_name.human}."
14
+ redirect_to main_app.root_path, :notice => "You have declined the invitation to the '#{@team.name}' #{@team.teamable.class.model_name.human}."
16
15
  else
17
16
  if @service_object.valid?
18
17
  @service_object.perform
@@ -26,7 +25,7 @@ module SimpleTeams
26
25
  :user_name => current_user.full_name
27
26
  ).deliver_later(@team.members)
28
27
 
29
- redirect_to url_for(@team.teamable), :notice => "You have accepted the invitation to the '#{@team.name}' #{@team.teamable.class.model_name.human}."
28
+ redirect_to main_app.url_for(@team.teamable), :notice => "You have accepted the invitation to the '#{@team.name}' #{@team.teamable.class.model_name.human}."
30
29
  else
31
30
  render :new
32
31
  end
@@ -1,13 +1,6 @@
1
1
  module SimpleTeams
2
- class ApplicationController < SimpleTeams.parent_controller
2
+ class ApplicationController < ActionController::Base
3
3
  before_action :authenticate_user!
4
4
 
5
- layout SimpleTeams.layout
6
-
7
- def current_ability
8
- SimpleTeams::Ability.new(current_user)
9
- end
10
- helper_method :current_ability
11
-
12
5
  end
13
6
  end
@@ -0,0 +1,12 @@
1
+ module SimpleTeams
2
+ class BaseController < SimpleTeams.parent_controller
3
+
4
+ layout SimpleTeams.layout
5
+
6
+ def current_ability
7
+ SimpleTeams::Ability.new(current_user)
8
+ end
9
+ helper_method :current_ability
10
+
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  module SimpleTeams
2
- class InvitationsController < ApplicationController
2
+ class InvitationsController < BaseController
3
3
  before_action :set_team
4
4
  before_action :set_invitation, except: %i[ new create index]
5
5
 
@@ -1,11 +1,11 @@
1
1
  module SimpleTeams
2
- class LeaveTeamsController < ApplicationController
2
+ class LeaveTeamsController < BaseController
3
3
  before_action :set_team
4
4
  before_action :set_service_object
5
5
 
6
6
  def destroy
7
7
  if @service_object.valid? and @service_object.perform
8
- redirect_to root_path, :notice => "You have successfully left the #{@team.name} #{@team.teamable.class.model_name.human}."
8
+ redirect_to main_app.url_for(@team.teamable.class), :notice => "You have successfully left the #{@team.name} #{@team.teamable.class.model_name.human}."
9
9
  else
10
10
  redirect_to team_path(@team), :notice => @service_object.errors[:user_id].first
11
11
  end
@@ -1,5 +1,5 @@
1
1
  module SimpleTeams
2
- class MembershipsController < ApplicationController
2
+ class MembershipsController < BaseController
3
3
  before_action :set_team
4
4
  before_action :set_membership, :except => [:index]
5
5
 
@@ -1,11 +1,11 @@
1
1
  module SimpleTeams
2
- class RelatedUsersController < ApplicationController
2
+ class RelatedMembersController < BaseController
3
3
 
4
4
  def index
5
5
  if params[:term].present?
6
6
  @members = SimpleTeams.member_class
7
7
  .joins(:team_memberships, :teams)
8
- .where("teams_teams.id" => current_user.teams.pluck(:id))
8
+ .where("simple_teams_teams.id" => current_user.teams.pluck(:id))
9
9
  .where("email ilike ?", "%#{params[:term]}%")
10
10
  .order("#{SimpleTeams.member_class.table_name}.first_name")
11
11
  .uniq
@@ -1,5 +1,5 @@
1
1
  module SimpleTeams
2
- class TeamsController < ApplicationController
2
+ class TeamsController < BaseController
3
3
  before_action :set_team
4
4
 
5
5
  def show
@@ -32,7 +32,7 @@ module SimpleTeams
32
32
  end
33
33
 
34
34
  def invitation
35
- @invitation ||= Teams::Invitation.find_by(token: @invitation_token)
35
+ @invitation ||= Invitation.find_by(token: @invitation_token)
36
36
  end
37
37
 
38
38
  private
data/config/routes.rb CHANGED
@@ -15,7 +15,7 @@ SimpleTeams::Engine.routes.draw do
15
15
  end
16
16
 
17
17
  # Team Invitations
18
- get "accept_team_invitation/:id", :as => "accept_team_invitation", to: "teams/accept_invitations#new"
19
- post "accept_team_invitation/:id", to: "teams/accept_invitations#create"
18
+ get "accept_team_invitation/:id", :as => "accept_team_invitation", to: "accept_invitations#new"
19
+ post "accept_team_invitation/:id", to: "accept_invitations#create"
20
20
 
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleTeams
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_teams
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Laney Stroup
@@ -44,6 +44,7 @@ files:
44
44
  - app/controllers/simple_teams/admin/memberships_controller.rb
45
45
  - app/controllers/simple_teams/admin/teams_controller.rb
46
46
  - app/controllers/simple_teams/application_controller.rb
47
+ - app/controllers/simple_teams/base_controller.rb
47
48
  - app/controllers/simple_teams/invitations_controller.rb
48
49
  - app/controllers/simple_teams/leave_teams_controller.rb
49
50
  - app/controllers/simple_teams/memberships_controller.rb
@@ -112,6 +113,7 @@ files:
112
113
  - app/views/simple_teams/invitations/edit.html.erb
113
114
  - app/views/simple_teams/invitations/new.html.erb
114
115
  - app/views/simple_teams/leave_teams/edit.html.erb
116
+ - app/views/simple_teams/mailer/invitation_notification.html.erb
115
117
  - app/views/simple_teams/memberships/_form.html.erb
116
118
  - app/views/simple_teams/memberships/_membership.html.erb
117
119
  - app/views/simple_teams/memberships/edit.html.erb
@@ -120,7 +122,6 @@ files:
120
122
  - app/views/simple_teams/teams/_add_member_link.html.erb
121
123
  - app/views/simple_teams/teams/_members_table.html.erb
122
124
  - app/views/simple_teams/teams/show.html.erb
123
- - app/views/simple_teams/teams_mailer/invitation_notification.html.erb
124
125
  - config/locales/simple_teams.en.yml
125
126
  - config/routes.rb
126
127
  - db/migrate/20240311052758_create_simple_teams_teams.rb