Class: Cms::Admin::WebhooksController

Inherits:
BaseController show all
Defined in:
app/controllers/cms/admin/webhooks_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
# File 'app/controllers/cms/admin/webhooks_controller.rb', line 16

def create
  @webhook = current_site.webhooks.build(webhook_params)
  if @webhook.save
    redirect_to admin_webhooks_path, notice: t("cms.notices.webhook_created")
  else
    render :new, status: :unprocessable_content
  end
end

#destroyObject



35
36
37
38
# File 'app/controllers/cms/admin/webhooks_controller.rb', line 35

def destroy
  @webhook.destroy
  redirect_to admin_webhooks_path, notice: t("cms.notices.webhook_deleted")
end

#editObject



25
# File 'app/controllers/cms/admin/webhooks_controller.rb', line 25

def edit; end

#indexObject



8
9
10
# File 'app/controllers/cms/admin/webhooks_controller.rb', line 8

def index
  @webhooks = current_site.webhooks.order(created_at: :desc)
end

#newObject



12
13
14
# File 'app/controllers/cms/admin/webhooks_controller.rb', line 12

def new
  @webhook = current_site.webhooks.build
end

#updateObject



27
28
29
30
31
32
33
# File 'app/controllers/cms/admin/webhooks_controller.rb', line 27

def update
  if @webhook.update(webhook_params)
    redirect_to admin_webhooks_path, notice: t("cms.notices.webhook_updated")
  else
    render :edit, status: :unprocessable_content
  end
end