simple_teams 0.1.3 → 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: acdf88bfe936ac559c9454125c3219d9eba2e9a8d029cda43ac7d749231ac273
4
- data.tar.gz: 5eb9a31ff2ab4a078e086c80396ad822f0baf718823de36ca3927290ea1b3a2b
3
+ metadata.gz: ea436fc244351fbe757513bc528932e72825f362859ce81edf4036a2b353bfc1
4
+ data.tar.gz: 636891c0d6281d29494eef2231b7a76245b062c04c506af26cc969136e48fc51
5
5
  SHA512:
6
- metadata.gz: d5dc54ba9215f56f8161b8b22e7e1b110f5e3a73a74be7ed3e57460dc119e38d1bc323c99e21b7ffa92413a942e05144d13892fc9693da96142b0dcbea969326
7
- data.tar.gz: c345c9fc4fcbedbf30055ff8af61b48751badceebccfd1b36921a08b038c65757f90088fb41032226ea09e9510896e43fa2c968ef30e192decee50cb31dd9ccd
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,5 +1,5 @@
1
1
  module SimpleTeams
2
- class RelatedMembersController < ApplicationController
2
+ class RelatedMembersController < BaseController
3
3
 
4
4
  def index
5
5
  if params[:term].present?
@@ -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.3"
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.3
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