Class: LesliShield::InvitesController
- Inherits:
-
ApplicationController
- Object
- Lesli::ApplicationLesliController
- ApplicationController
- LesliShield::InvitesController
- Defined in:
- app/controllers/lesli_shield/invites_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /invites.
-
#destroy ⇒ Object
DELETE /invites/1.
-
#edit ⇒ Object
GET /invites/1/edit.
-
#index ⇒ Object
GET /invites.
-
#new ⇒ Object
GET /invites/new.
-
#show ⇒ Object
GET /invites/1.
-
#update ⇒ Object
PATCH/PUT /invites/1.
Instance Method Details
#create ⇒ Object
POST /invites
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/lesli_shield/invites_controller.rb', line 24 def create @invite = current_user.account.shield.invites.new(invite_params) @invite.user = current_user if @invite.save log( subject: @invite, operation: 'invite.created', description: "Invitation created successfully created for: #{@invite.email}" ) success("Invite was successfully created.") respond_with_lesli( turbo: stream_redirection(invite_path(@invite)) ) else respond_with_lesli( turbo: stream_notification_danger(@invite.errors..to_sentence) ) end end |
#destroy ⇒ Object
DELETE /invites/1
64 65 66 67 |
# File 'app/controllers/lesli_shield/invites_controller.rb', line 64 def destroy @invite.destroy! redirect_to invites_path, notice: "Invite was successfully destroyed.", status: :see_other end |
#edit ⇒ Object
GET /invites/1/edit
20 21 |
# File 'app/controllers/lesli_shield/invites_controller.rb', line 20 def edit end |
#index ⇒ Object
GET /invites
6 7 8 |
# File 'app/controllers/lesli_shield/invites_controller.rb', line 6 def index @invites = respond_with_pagination(LesliShield::InviteService.new(current_user, query).index(params)) end |
#new ⇒ Object
GET /invites/new
15 16 17 |
# File 'app/controllers/lesli_shield/invites_controller.rb', line 15 def new @invite = Invite.new end |
#show ⇒ Object
GET /invites/1
11 12 |
# File 'app/controllers/lesli_shield/invites_controller.rb', line 11 def show end |
#update ⇒ Object
PATCH/PUT /invites/1
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/lesli_shield/invites_controller.rb', line 47 def update if @invite.update(invite_params) log( subject: @invite, description: "Invitation updated successfully" ) respond_with_lesli( :turbo => stream_notification_success("Invite was successfully updated.") ) else respond_with_lesli( :turbo => stream_notification_danger(@invite.errors..to_sentence) ) end end |