Sha256: ef6c0a796908101e55dddf36cf4571ca538a02dccdeddfdae324d93b706a9a53

Contents?: true

Size: 744 Bytes

Versions: 4

Compression:

Stored size: 744 Bytes

Contents

# frozen_string_literal: true

class WebhooksController < ::ApplicationController
  include ForemanWebhooks::Controller::Parameters::Webhook
  include Foreman::Controller::AutoCompleteSearch

  before_action :find_resource, only: %i[edit update destroy]

  def new
    @webhook = Webhook.new
  end

  def create
    @webhook = Webhook.new(webhook_params)
    if @webhook.save
      process_success success_redirect: '/webhooks'
    else
      process_error
    end
  end

  def edit; end

  def update
    if @webhook.update(webhook_params)
      process_success success_redirect: '/webhooks'
    else
      process_error
    end
  end

  def destroy
    if @webhook.destroy
      process_success
    else
      process_error
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_webhooks-1.0.0 app/controllers/webhooks_controller.rb
foreman_webhooks-0.0.3 app/controllers/webhooks_controller.rb
foreman_webhooks-0.0.2 app/controllers/webhooks_controller.rb
foreman_webhooks-0.0.1 app/controllers/webhooks_controller.rb