Class: Collavre::CreativeInvitationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/collavre/creative_invitations_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



21
22
23
24
25
26
27
# File 'app/controllers/collavre/creative_invitations_controller.rb', line 21

def destroy
  @invitation.destroy
  respond_to do |format|
    format.html { redirect_back fallback_location: main_app.root_path, notice: t("collavre.contacts.org_chart.invite_cancelled") }
    format.json { head :no_content }
  end
end

#updateObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/collavre/creative_invitations_controller.rb', line 7

def update
  if @invitation.update(permission: params[:permission])
    respond_to do |format|
      format.html { redirect_back fallback_location: main_app.root_path, notice: t("collavre.creatives.share.permission_updated") }
      format.json { render json: { permission: @invitation.permission }, status: :ok }
    end
  else
    respond_to do |format|
      format.html { redirect_back fallback_location: main_app.root_path, alert: @invitation.errors.full_messages.to_sentence }
      format.json { render json: { error: @invitation.errors.full_messages.to_sentence }, status: :unprocessable_entity }
    end
  end
end