Read about our upcoming Code of Conduct on this issue

This instance was upgraded to Heptapod 0.28.0 today

triggers_controller.rb 702 Bytes
Newer Older
1
2
3
4
5
6
class Projects::TriggersController < Projects::ApplicationController
  before_action :authorize_admin_project!

  layout 'project_settings'

  def index
7
    @triggers = project.triggers
8
9
10
11
    @trigger = Ci::Trigger.new
  end

  def create
12
    @trigger = project.triggers.new
13
14
15
16
17
    @trigger.save

    if @trigger.valid?
      redirect_to namespace_project_triggers_path(@project.namespace, @project)
    else
18
      @triggers = project.triggers.select(&:persisted?)
19
20
21
22
23
24
25
26
27
28
29
30
31
      render :index
    end
  end

  def destroy
    trigger.destroy

    redirect_to namespace_project_triggers_path(@project.namespace, @project)
  end

  private

  def trigger
32
    @trigger ||= project.triggers.find(params[:id])
33
34
  end
end