gitlab-org--gitlab-foss/app/controllers/projects/triggers_controller.rb
Dmitriy Zaporozhets 2a0d4e7200
Move CI triggers page to project settings area
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-09-29 10:37:31 +02:00

35 lines
746 B
Ruby

class Projects::TriggersController < Projects::ApplicationController
before_action :ci_project
before_action :authorize_admin_project!
layout 'project_settings'
def index
@triggers = @ci_project.triggers
@trigger = Ci::Trigger.new
end
def create
@trigger = @ci_project.triggers.new
@trigger.save
if @trigger.valid?
redirect_to namespace_project_triggers_path(@project.namespace, @project)
else
@triggers = @ci_project.triggers.select(&:persisted?)
render :index
end
end
def destroy
trigger.destroy
redirect_to namespace_project_triggers_path(@project.namespace, @project)
end
private
def trigger
@trigger ||= @ci_project.triggers.find(params[:id])
end
end