Class: SimpleTeams::InvitationsController
- Inherits:
-
BaseController
- Object
- BaseController
- SimpleTeams::InvitationsController
- Defined in:
- app/controllers/simple_teams/invitations_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/simple_teams/invitations_controller.rb', line 11 def create :create, @team.invitations.new @service_object = SimpleTeams::InvitationForms::CreateCombo.new(@team, current_user) respond_to do |format| if @service_object.perform(new_service_object_params) format.html { redirect_to team_path(@team), notice: "Invitations were successfully created." } format.json { render :show, status: :created, location: @invitation } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @invitation.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'app/controllers/simple_teams/invitations_controller.rb', line 57 def destroy :destroy, @invitation invitation_id = @invitation.id invitation_email = @invitation.email @invitation.destroy SimpleTeams::Invitations::DestroyedNotifier.with( :team_id => @team.id, :invitation_id => invitation_id, :user_id => current_user.id, :team_name => @team.name, :invitation_name => invitation_email, :user_name => current_user.full_name ).deliver_later(@team.members) respond_to do |format| format.html { redirect_to team_path(@team), notice: "Invitation was successfully destroyed." } format.json { head :no_content } end end |
#edit ⇒ Object
26 27 28 29 |
# File 'app/controllers/simple_teams/invitations_controller.rb', line 26 def edit :update, @invitation @service_object = SimpleTeams::InvitationForms::Update.new(@invitation, current_user) end |
#new ⇒ Object
6 7 8 9 |
# File 'app/controllers/simple_teams/invitations_controller.rb', line 6 def new :create, @team.invitations.new @service_object = SimpleTeams::InvitationForms::CreateCombo.new(@team, current_user) end |
#resend ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/simple_teams/invitations_controller.rb', line 47 def resend :update, @invitation @invitation.resend_invitation_notification respond_to do |format| format.html { redirect_to team_path(@team), notice: "Invitation was successfully resent." } format.json { head :no_content } end end |
#update ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/simple_teams/invitations_controller.rb', line 31 def update :update, @invitation @service_object = SimpleTeams::InvitationForms::Update.new(@invitation, current_user) respond_to do |format| if @service_object.perform(service_object_params) format.html { redirect_to team_path(@team), notice: "Invitation was successfully updated." } format.json { head :no_content } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @invitation.errors, status: :unprocessable_entity } end end end |