Class: SimpleTeams::InvitationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SimpleTeams::InvitationsController
- Defined in:
- app/controllers/simple_teams/invitations_controller.rb,
app/controllers/simple_teams/admin/invitations_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /invitations.
-
#destroy ⇒ Object
DELETE /invitations/1.
-
#edit ⇒ Object
GET /invitations/1/edit.
-
#index ⇒ Object
GET /invitations.
-
#new ⇒ Object
GET /invitations/new.
- #resend ⇒ Object
-
#show ⇒ Object
GET /invitations/1.
-
#update ⇒ Object
PATCH/PUT /invitations/1.
Instance Method Details
#create ⇒ Object
POST /invitations
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/simple_teams/admin/invitations_controller.rb', line 24 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
DELETE /invitations/1
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/simple_teams/admin/invitations_controller.rb', line 44 def destroy :destroy, @invitation invitation_id = @invitation.id invitation_email = @invitation.email @invitation.destroy SimpleTeams::Invitations::DestroyedNotification.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
GET /invitations/1/edit
20 21 22 23 |
# File 'app/controllers/simple_teams/admin/invitations_controller.rb', line 20 def edit :update, @invitation @service_object = SimpleTeams::InvitationForms::Update.new(@invitation, current_user) end |
#index ⇒ Object
GET /invitations
6 7 8 |
# File 'app/controllers/simple_teams/admin/invitations_controller.rb', line 6 def index @invitations = Invitation.all end |
#new ⇒ Object
GET /invitations/new
15 16 17 18 |
# File 'app/controllers/simple_teams/admin/invitations_controller.rb', line 15 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 |
#show ⇒ Object
GET /invitations/1
11 12 |
# File 'app/controllers/simple_teams/admin/invitations_controller.rb', line 11 def show end |
#update ⇒ Object
PATCH/PUT /invitations/1
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/simple_teams/admin/invitations_controller.rb', line 35 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 |